diff --git a/src/files.py b/src/files.py index 5fa9c1e95..cf4d0f36a 100644 --- a/src/files.py +++ b/src/files.py @@ -77,7 +77,14 @@ class FilesBaseManager(object): self.file_view.set_model(self.file_store_sorted) self.file_view.get_selection().set_mode(gtk.SELECTION_MULTIPLE) + + try: + self.file_view.get_selection().set_select_function(self.file_clicked, + full=True) + except TypeError: + self.torrent_view.get_selection().set_select_function(self.file_clicked_old) self.file_view.connect("button-press-event", self.mouse_clicked) + self.right_click = False def clear_file_store(self): self.file_store.clear() @@ -97,7 +104,6 @@ class FilesBaseManager(object): message_format = (_("File priority can only be set when using full allocation.\nPlease change your preference to disable compact allocation, then remove and readd this torrent."))) msgBox.run() msgBox.destroy() - def priority_clicked(self, widget): if self.config.get("use_compact_storage"): @@ -118,13 +124,31 @@ class FilesBaseManager(object): priority) self.update_priorities() - + + def file_clicked_old(self, path): + return self.file_clicked(self.file_view.get_selection(), + self.file_store, path, False) + + def file_clicked(self, selection, model, path, is_selected): + if is_selected: + return not self.right_click + + return True + def mouse_clicked(self, widget, event): if event.button == 3: - self.file_view.get_selection().get_selected_rows()[1] + data = self.file_view.get_path_at_pos(int(event.x), int(event.y)) + if data is None: + return True + + path, col, cellx, celly = data + self.right_click = self.file_view.get_selection().path_is_selected(path) + self.file_view.grab_focus() + self.file_view.set_cursor(path, col, 0) self.file_menu.popup(None, None, None, event.button, event.time) - return False + return True else: + self.right_click = False return False def update_priorities(self): diff --git a/src/interface.py b/src/interface.py index 465dc5660..4e409eb2f 100644 --- a/src/interface.py +++ b/src/interface.py @@ -558,9 +558,8 @@ class DelugeGTK: def torrent_view_clicked(self, widget, event): if event.button == 3: - x = int(event.x) - y = int(event.y) - data = self.torrent_view.get_path_at_pos(x, y) + data = self.torrent_view.get_path_at_pos(int(event.x), + int(event.y)) if data is None: return True path, col, cellx, celly = data