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

This commit is contained in:
Calum Lind 2011-05-27 01:05:22 +01:00
parent da679371b7
commit a3d2b41b54
1 changed files with 9 additions and 11 deletions

View File

@ -502,17 +502,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)
@ -521,13 +519,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)