From bbee37f54feae7c06e95f5abe1740590b3d9d123 Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Tue, 22 Jul 2008 04:01:37 +0000 Subject: [PATCH] Fix right-click selecting torrents. Behaviour is now similar to Nautilus. --- ChangeLog | 6 +++++- deluge/ui/gtkui/torrentview.py | 15 +++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5342650a8..5985cdfc9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ Deluge 0.9.04 - "1.0.0_RC4" (In Development) - + GtkUI: + * Fix selecting torrents when right-clicking on them, behaviour is now similar + to Nautilus + * Fix new release check + Deluge 0.9.03 - "1.0.0_RC3" (21 July 2008) Core: * File progress fixes from libtorrent diff --git a/deluge/ui/gtkui/torrentview.py b/deluge/ui/gtkui/torrentview.py index 5dc340462..c52ac74f2 100644 --- a/deluge/ui/gtkui/torrentview.py +++ b/deluge/ui/gtkui/torrentview.py @@ -443,8 +443,19 @@ class TorrentView(listview.ListView, component.Component): """This is a callback for showing the right-click context menu.""" log.debug("on_button_press_event") # We only care about right-clicks - if self.get_selected_torrents() and event.button == 3: - # Show the Torrent menu from the MenuBar + if event.button == 3: + x, y = event.get_coords() + path = self.treeview.get_path_at_pos(int(x), int(y)) + if not path: + return + row = self.model_filter.get_iter(path[0]) + + if self.get_selected_torrents(): + if self.model_filter.get_value(row, 0) not in self.get_selected_torrents(): + self.treeview.get_selection().unselect_all() + self.treeview.get_selection().select_iter(row) + else: + self.treeview.get_selection().select_iter(row) torrentmenu = component.get("MenuBar").torrentmenu torrentmenu.popup(None, None, None, event.button, event.time) return True