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,22 +237,30 @@ 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
|
||||
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
|
||||
|
||||
else:
|
||||
self.__start_non_classic()
|
||||
|
||||
def __start_non_classic(self):
|
||||
# Autoconnect to a host
|
||||
if self.config["autoconnect"]:
|
||||
for host in self.connectionmanager.config["hosts"]:
|
||||
|
|
|
@ -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