Module: deluge
Branch: master
Commit: b36d62be9bc6ef00310fdb6e95852619852906da

Author: Calum Lind <calumlind+del...@gmail.com>
Date:   Wed Jul  6 18:05:28 2011 +0100

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.

---

 deluge/ui/gtkui/listview.py    |    3 +++
 deluge/ui/gtkui/torrentview.py |    5 +++++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/deluge/ui/gtkui/listview.py b/deluge/ui/gtkui/listview.py
index f708c50..869f970 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 cf63677..d84b230 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..

-- 
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to deluge-commit@googlegroups.com.
To unsubscribe from this group, send email to 
deluge-commit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en.

Reply via email to