From 95d5e33301516c1b20617d7a69069fab6b25262f Mon Sep 17 00:00:00 2001 From: Marcos Pinto Date: Wed, 8 Aug 2007 23:03:44 +0000 Subject: [PATCH] add custom option for file manager --- glade/preferences_dialog.glade | 84 +++++++++++++++++++++++++++++----- src/dialogs.py | 6 +++ src/interface.py | 15 +++--- src/pref.py | 3 ++ 4 files changed, 90 insertions(+), 18 deletions(-) diff --git a/glade/preferences_dialog.glade b/glade/preferences_dialog.glade index c7b041b4d..e081fce4e 100644 --- a/glade/preferences_dialog.glade +++ b/glade/preferences_dialog.glade @@ -2261,28 +2261,82 @@ HTTP W/ Auth True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - + True - 15 + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 2 + 2 - + True - 0 - Open folders with: + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Open folder with: + 0 + True + True + + + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Custom: + 0 + True + True + radio_open_folder_stock + + - False + 1 + 2 - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Konqueror + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Konqueror Nautilus Thunar - - + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + + + + + 1 + 2 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK @@ -2290,11 +2344,17 @@ Thunar - False - 1 + 1 + 2 + 1 + 2 + + False + False + diff --git a/src/dialogs.py b/src/dialogs.py index b311024d2..0d5212d7b 100644 --- a/src/dialogs.py +++ b/src/dialogs.py @@ -57,6 +57,9 @@ class PreferencesDlg: # Load settings into dialog try: self.glade.get_widget("combo_file_manager").set_active(self.preferences.get("file_manager")) + self.glade.get_widget("txt_open_folder_location").set_text(self.preferences.get("open_folder_location")) + self.glade.get_widget("radio_open_folder_stock").set_active(self.preferences.get("open_folder_stock")) + self.glade.get_widget("radio_open_folder_custom").set_active(self.preferences.get("open_folder_custom")) self.glade.get_widget("combo_encin").set_active(self.preferences.get("encin_state")) self.glade.get_widget("combo_encout").set_active(self.preferences.get("encout_state")) self.glade.get_widget("combo_enclevel").set_active(self.preferences.get("enclevel_type")) @@ -158,6 +161,9 @@ class PreferencesDlg: def ok_clicked(self, source, interface): self.dialog.hide() self.preferences.set("file_manager", self.glade.get_widget("combo_file_manager").get_active()) + self.preferences.set("open_folder_custom", self.glade.get_widget("radio_open_folder_custom").get_active()) + self.preferences.set("open_folder_stock", self.glade.get_widget("radio_open_folder_stock").get_active()) + self.preferences.set("open_folder_location", self.glade.get_widget("txt_open_folder_location").get_text()) self.preferences.set("encin_state", self.glade.get_widget("combo_encin").get_active()) self.preferences.set("encout_state", self.glade.get_widget("combo_encout").get_active()) self.preferences.set("enclevel_type", self.glade.get_widget("combo_enclevel").get_active()) diff --git a/src/interface.py b/src/interface.py index 32860cd97..dc75ae751 100644 --- a/src/interface.py +++ b/src/interface.py @@ -639,12 +639,15 @@ class DelugeGTK: unique_ids = self.get_selected_torrent_rows() try: for uid in unique_ids: - if self.config.get("file_manager") == 0: - command = "konqueror" - if self.config.get("file_manager") == 1: - command = "nautilus" - if self.config.get("file_manager") == 2: - command = "thunar" + if self.config.get("open_folder_stock"): + if self.config.get("file_manager") == 0: + command = "konqueror" + if self.config.get("file_manager") == 1: + command = "nautilus" + if self.config.get("file_manager") == 2: + command = "thunar" + elif self.config.get("open_folder_custom"): + command = self.config.get("open_folder_location") os.system('%s %s' %(command, self.manager.unique_IDs[uid].save_dir)) except KeyError: pass diff --git a/src/pref.py b/src/pref.py index 7d5311fba..468d17e23 100644 --- a/src/pref.py +++ b/src/pref.py @@ -41,6 +41,9 @@ import os.path DEFAULT_PREFS = { "file_manager" : common.FileManager.nautilus, + "open_folder_stock" : True, + "open_folder_custom" : False, + "open_folder_location": "", "send_info" : True, "auto_end_seeding" : False, "auto_seed_ratio" : 0,