Fix turning off Classic mode dialog
Fix showing the connection manager icon on the toolbar depending on classic mode setting
This commit is contained in:
parent
e36ca0e5ba
commit
520be10e4d
|
@ -237,34 +237,42 @@ class GtkUI:
|
|||
try:
|
||||
client.start_classic_mode()
|
||||
except deluge.error.DaemonRunningError:
|
||||
response = dialogs.YesNoDialog(
|
||||
d = dialogs.YesNoDialog(
|
||||
_("Turn off Classic Mode?"),
|
||||
_("It appears that a Deluge daemon process (deluged) is already running.\n\n\
|
||||
You will either need to stop the daemon or turn off Classic Mode to continue.")).run()
|
||||
|
||||
self.started_in_classic = False
|
||||
if response != gtk.RESPONSE_YES:
|
||||
# The user does not want to turn Classic Mode off, so just quit
|
||||
reactor.stop()
|
||||
return
|
||||
# Turning off classic_mode
|
||||
self.config["classic_mode"] = False
|
||||
def on_dialog_response(response):
|
||||
if response != gtk.RESPONSE_YES:
|
||||
# The user does not want to turn Classic Mode off, so just quit
|
||||
reactor.stop()
|
||||
return
|
||||
# Turning off classic_mode
|
||||
self.config["classic_mode"] = False
|
||||
self.__start_non_classic()
|
||||
|
||||
d.addCallback(on_dialog_response)
|
||||
else:
|
||||
component.start()
|
||||
return
|
||||
|
||||
# Autoconnect to a host
|
||||
if self.config["autoconnect"]:
|
||||
for host in self.connectionmanager.config["hosts"]:
|
||||
if host[0] == self.config["autoconnect_host_id"]:
|
||||
def on_connect(connector):
|
||||
component.start()
|
||||
client.connect(*host[1:]).addCallback(on_connect)
|
||||
else:
|
||||
self.__start_non_classic()
|
||||
|
||||
if self.config["show_connection_manager_on_start"]:
|
||||
# XXX: We need to call a simulate() here, but this could be a bug in twisted
|
||||
reactor.simulate()
|
||||
self.connectionmanager.show()
|
||||
def __start_non_classic(self):
|
||||
# Autoconnect to a host
|
||||
if self.config["autoconnect"]:
|
||||
for host in self.connectionmanager.config["hosts"]:
|
||||
if host[0] == self.config["autoconnect_host_id"]:
|
||||
def on_connect(connector):
|
||||
component.start()
|
||||
client.connect(*host[1:]).addCallback(on_connect)
|
||||
|
||||
if self.config["show_connection_manager_on_start"]:
|
||||
# XXX: We need to call a simulate() here, but this could be a bug in twisted
|
||||
reactor.simulate()
|
||||
self.connectionmanager.show()
|
||||
|
||||
|
||||
def __on_disconnect(self):
|
||||
|
|
|
@ -74,13 +74,15 @@ class ToolBar(component.Component):
|
|||
"toolbutton_queue_down"
|
||||
]
|
||||
|
||||
if self.config["classic_mode"]:
|
||||
self.window.main_glade.get_widget("toolbutton_connectionmanager").hide()
|
||||
self.config.register_set_function("classic_mode", self._on_classic_mode, True)
|
||||
|
||||
# Hide if necessary
|
||||
self.visible(self.config["show_toolbar"])
|
||||
|
||||
def start(self):
|
||||
if not self.config["classic_mode"]:
|
||||
self.window.main_glade.get_widget("toolbutton_connectionmanager").show()
|
||||
|
||||
for widget in self.change_sensitivity:
|
||||
self.window.main_glade.get_widget(widget).set_sensitive(True)
|
||||
|
||||
|
@ -176,3 +178,10 @@ class ToolBar(component.Component):
|
|||
def on_toolbutton_queue_down_clicked(self, data):
|
||||
log.debug("on_toolbutton_queue_down_clicked")
|
||||
component.get("MenuBar").on_menuitem_queue_down_activate(data)
|
||||
|
||||
def _on_classic_mode(self, key, value):
|
||||
w = self.window.main_glade.get_widget("toolbutton_connectionmanager")
|
||||
if value:
|
||||
w.hide()
|
||||
else:
|
||||
w.show()
|
||||
|
|
Loading…
Reference in New Issue