summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCalum Lind <calumlind+deluge@gmail.com>2011-07-06 18:05:28 +0100
committerCalum Lind <calumlind+deluge@gmail.com>2011-07-06 19:16:31 +0100
commitb36d62be9bc6ef00310fdb6e95852619852906da (patch)
treee079b5aa8ad81040de4a117820281742ba94ec40
parentb4cc1d43580d7292e2b6f3ac403702cf8d6eacbd (diff)
downloaddeluge-b36d62be9bc6ef00310fdb6e95852619852906da.tar.gz
deluge-b36d62be9bc6ef00310fdb6e95852619852906da.tar.bz2
deluge-b36d62be9bc6ef00310fdb6e95852619852906da.zip
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.
-rw-r--r--deluge/ui/gtkui/listview.py3
-rw-r--r--deluge/ui/gtkui/torrentview.py5
2 files changed, 8 insertions, 0 deletions
diff --git a/deluge/ui/gtkui/listview.py b/deluge/ui/gtkui/listview.py
index f708c503e..869f970ad 100644
--- a/deluge/ui/gtkui/listview.py
+++ b/deluge/ui/gtkui/listview.py
@@ -272,6 +272,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 cf636772f..d84b2308c 100644
--- a/deluge/ui/gtkui/torrentview.py
+++ b/deluge/ui/gtkui/torrentview.py
@@ -474,6 +474,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..