Module: deluge
Branch: master
Commit: 82712c80e148b903a0a00256cfd00e61cf5c52d8

Author: Calum Lind <[email protected]>
Date:   Fri May 27 01:05:22 2011 +0100

Fix #1195 - Right-click selecting issue when switching between files and folders

---

 deluge/ui/gtkui/files_tab.py |   20 +++++++++-----------
 1 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/deluge/ui/gtkui/files_tab.py b/deluge/ui/gtkui/files_tab.py
index 4c04d29..4e5af32 100644
--- a/deluge/ui/gtkui/files_tab.py
+++ b/deluge/ui/gtkui/files_tab.py
@@ -505,17 +505,15 @@ class FilesTab(Tab):
         # We only care about right-clicks
         if event.button == 3:
             x, y = event.get_coords()
-            path = self.listview.get_path_at_pos(int(x), int(y))
-            if not path:
+            cursor_path = self.listview.get_path_at_pos(int(x), int(y))
+            if not cursor_path:
                 return
-            row = self.treestore.get_iter(path[0])
 
-            if self.get_selected_files():
-                if self.treestore.get_value(row, 5) not in 
self.get_selected_files():
+            paths = self.listview.get_selection().get_selected_rows()[1]
+            if cursor_path[0] not in paths:
+                    row = self.treestore.get_iter(cursor_path[0])
                     self.listview.get_selection().unselect_all()
                     self.listview.get_selection().select_iter(row)
-            else:
-                self.listview.get_selection().select_iter(row)
 
             for widget in self.file_menu_priority_items:
                 widget.set_sensitive(not self.__compact)
@@ -524,13 +522,13 @@ class FilesTab(Tab):
             return True
 
     def _on_key_press_event(self, widget, event):
-        if not self.get_selected_files():
-            return
-
         keyname = gtk.gdk.keyval_name(event.keyval)
         func = getattr(self, 'keypress_' + keyname, None)
-        if func:
+        selected_rows = self.listview.get_selection().get_selected_rows()[1]
+        if func and selected_rows:
             return func(event)
+        else:
+            return
 
     def keypress_Menu(self, event):
         self.file_menu.popup(None, None, None, 3, event.time)

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

Reply via email to