From ecb4f0e9daea7f1363bf129c43e7bff5eac4cef3 Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Sun, 31 Aug 2014 14:28:12 +0100 Subject: [PATCH] [#2496] [GTKUI] Fix updating core_config before setting default options * Remove duplicate entry in init. * Call update if empty config and prevent potential loop in update method. * Ensure that the queue Add button is sensitive, even when automatically adding. --- deluge/ui/gtkui/addtorrentdialog.py | 9 +++++++-- deluge/ui/gtkui/queuedtorrents.py | 9 +++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/deluge/ui/gtkui/addtorrentdialog.py b/deluge/ui/gtkui/addtorrentdialog.py index d5175deea..683f90658 100644 --- a/deluge/ui/gtkui/addtorrentdialog.py +++ b/deluge/ui/gtkui/addtorrentdialog.py @@ -164,7 +164,6 @@ class AddTorrentDialog(component.Component): "move_completed_paths_list", ] #self.core_keys += self.move_completed_path_chooser.get_config_keys() - self.core_config = {} self.builder.get_object("notebook1").connect("switch-page", self._on_switch_page) def start(self): @@ -199,7 +198,8 @@ class AddTorrentDialog(component.Component): def update_core_config(self, show=False, focus=False): def _on_config_values(config): self.core_config = config - self.set_default_options() + if self.core_config: + self.set_default_options() if show: self._show(focus) @@ -472,6 +472,11 @@ class AddTorrentDialog(component.Component): return priorities def set_default_options(self): + if not self.core_config: + # update_core_config will call this method again. + self.update_core_config() + return + self.load_path_choosers_data() self.builder.get_object("chk_pre_alloc").set_active( diff --git a/deluge/ui/gtkui/queuedtorrents.py b/deluge/ui/gtkui/queuedtorrents.py index 7eeaaa78b..7fc339579 100644 --- a/deluge/ui/gtkui/queuedtorrents.py +++ b/deluge/ui/gtkui/queuedtorrents.py @@ -87,15 +87,16 @@ class QueuedTorrents(component.Component): if len(self.queue) == 0: return - if self.config["autoadd_queued"] or self.config["classic_mode"]: - self.on_button_add_clicked(None) - return # Make sure status bar info is showing self.update_status_bar() # We only want the add button sensitive if we're connected to a host self.builder.get_object("button_add").set_sensitive(True) - self.run() + + if self.config["autoadd_queued"] or self.config["classic_mode"]: + self.on_button_add_clicked(None) + else: + self.run() def stop(self): # We only want the add button sensitive if we're connected to a host