mirror of
https://github.com/codex-storage/deluge.git
synced 2025-02-05 08:03:40 +00:00
[#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.
This commit is contained in:
parent
ecf5af1e16
commit
33339b1dc6
@ -147,7 +147,6 @@ class AddTorrentDialog(component.Component):
|
|||||||
"move_completed",
|
"move_completed",
|
||||||
"move_completed_path"
|
"move_completed_path"
|
||||||
]
|
]
|
||||||
self.core_config = {}
|
|
||||||
|
|
||||||
self.glade.get_widget("notebook1").connect("switch-page", self._on_switch_page)
|
self.glade.get_widget("notebook1").connect("switch-page", self._on_switch_page)
|
||||||
|
|
||||||
@ -194,7 +193,8 @@ class AddTorrentDialog(component.Component):
|
|||||||
def update_core_config(self, show=False, focus=False):
|
def update_core_config(self, show=False, focus=False):
|
||||||
def _on_config_values(config):
|
def _on_config_values(config):
|
||||||
self.core_config = config
|
self.core_config = config
|
||||||
self.set_default_options()
|
if self.core_config:
|
||||||
|
self.set_default_options()
|
||||||
if show:
|
if show:
|
||||||
self._show(focus)
|
self._show(focus)
|
||||||
|
|
||||||
@ -476,6 +476,11 @@ class AddTorrentDialog(component.Component):
|
|||||||
return priorities
|
return priorities
|
||||||
|
|
||||||
def set_default_options(self):
|
def set_default_options(self):
|
||||||
|
if not self.core_config:
|
||||||
|
# update_core_config will call this method again.
|
||||||
|
self.update_core_config()
|
||||||
|
return
|
||||||
|
|
||||||
if client.is_localhost():
|
if client.is_localhost():
|
||||||
self.glade.get_widget("button_location").set_current_folder(
|
self.glade.get_widget("button_location").set_current_folder(
|
||||||
self.core_config["download_location"])
|
self.core_config["download_location"])
|
||||||
|
@ -86,15 +86,16 @@ class QueuedTorrents(component.Component):
|
|||||||
if len(self.queue) == 0:
|
if len(self.queue) == 0:
|
||||||
return
|
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
|
# Make sure status bar info is showing
|
||||||
self.update_status_bar()
|
self.update_status_bar()
|
||||||
|
|
||||||
# We only want the add button sensitive if we're connected to a host
|
# We only want the add button sensitive if we're connected to a host
|
||||||
self.glade.get_widget("button_add").set_sensitive(True)
|
self.glade.get_widget("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):
|
def stop(self):
|
||||||
# We only want the add button sensitive if we're connected to a host
|
# We only want the add button sensitive if we're connected to a host
|
||||||
@ -174,7 +175,7 @@ class QueuedTorrents(component.Component):
|
|||||||
def add_torrent(model, path, iter, data):
|
def add_torrent(model, path, iter, data):
|
||||||
torrent_path = model.get_value(iter, 1)
|
torrent_path = model.get_value(iter, 1)
|
||||||
process_args([torrent_path])
|
process_args([torrent_path])
|
||||||
|
|
||||||
self.liststore.foreach(add_torrent, None)
|
self.liststore.foreach(add_torrent, None)
|
||||||
del self.queue[:]
|
del self.queue[:]
|
||||||
self.dialog.hide()
|
self.dialog.hide()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user