From 7c276f3133916a904a2887d83680091bbf37cff6 Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Wed, 6 Jul 2011 18:05:28 +0100 Subject: [PATCH] Fix #1263: GTK UI not remembering column width Removing a column from the treeview on shutdown causes all the column widths to be zero which are saved to the state file. The workaround is to not save the state file if all columns are zero. --- ChangeLog | 1 + deluge/ui/gtkui/listview.py | 3 +++ deluge/ui/gtkui/torrentview.py | 5 +++++ 3 files changed, 9 insertions(+) diff --git a/ChangeLog b/ChangeLog index b13fd92b9..63830c33e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -18,6 +18,7 @@ * Add search as you type to the torrent view * #1456: Fix no ETA showing with multiple files * #1560: Fix FilesTab Progress value sorting by int instead of float + * #1263: Fix not remembering column widths === AutoAdd === * #1861: Fix AutoAdd Warning (column number is a boolean) diff --git a/deluge/ui/gtkui/listview.py b/deluge/ui/gtkui/listview.py index bdf8d35d2..a6872119e 100644 --- a/deluge/ui/gtkui/listview.py +++ b/deluge/ui/gtkui/listview.py @@ -263,6 +263,9 @@ class ListView: # A list of ListViewColumnStates state = [] + # Workaround for all zero widths after removing column on shutdown + if not any(c.get_width() for c in self.treeview.get_columns()): return + # Get the list of TreeViewColumns from the TreeView for counter, column in enumerate(self.treeview.get_columns()): # Append a new column state to the state list diff --git a/deluge/ui/gtkui/torrentview.py b/deluge/ui/gtkui/torrentview.py index 9fa47e476..451150f4b 100644 --- a/deluge/ui/gtkui/torrentview.py +++ b/deluge/ui/gtkui/torrentview.py @@ -319,6 +319,11 @@ class TorrentView(listview.ListView, component.Component): """ listview.ListView.save_state(self, "torrentview.state") + def remove_column(self, header): + """Removes the column with the name 'header' from the torrentview""" + self.save_state() + listview.ListView.remove_column(self, header) + def set_filter(self, filter_dict): """Sets filters for the torrentview.. see: core.get_torrents_status