Fix up stopping classic mode

This commit is contained in:
Andrew Resch 2011-06-02 11:55:26 -07:00
commit ac5f9a2828
2 changed files with 15 additions and 8 deletions

View file

@ -613,6 +613,11 @@ class Client(object):
""" """
Disconnects from the daemon. Disconnects from the daemon.
""" """
if self.is_classicmode():
self._daemon_proxy.disconnect()
self.stop_classic_mode()
return
if self._daemon_proxy: if self._daemon_proxy:
return self._daemon_proxy.disconnect() return self._daemon_proxy.disconnect()
@ -623,6 +628,13 @@ class Client(object):
self._daemon_proxy = DaemonClassicProxy(self.__event_handlers) self._daemon_proxy = DaemonClassicProxy(self.__event_handlers)
self.__started_in_classic = True self.__started_in_classic = True
def stop_classic_mode(self):
"""
Stops the daemon process in the client.
"""
self._daemon_proxy = None
self.__started_in_classic = False
def start_daemon(self, port, config): def start_daemon(self, port, config):
""" """
Starts a daemon process. Starts a daemon process.

View file

@ -830,26 +830,21 @@ class Preferences(component.Component):
# Re-show the dialog to make sure everything has been updated # Re-show the dialog to make sure everything has been updated
self.show() self.show()
if classic_mode_was_set==True and new_gtkui_in_classic_mode==False: if classic_mode_was_set == True and new_gtkui_in_classic_mode == False:
def on_response(response): def on_response(response):
if response == gtk.RESPONSE_NO: if response == gtk.RESPONSE_NO:
# Set each changed config value in the core # Set each changed config value in the core
self.gtkui_config["classic_mode"] = True self.gtkui_config["classic_mode"] = True
client.core.set_config({"classic_mode": True})
client.force_call(True)
# Update the configuration
self.core_config.update({"classic_mode": True})
self.glade.get_widget("chk_classic_mode").set_active(True) self.glade.get_widget("chk_classic_mode").set_active(True)
else: else:
client.disconnect() client.disconnect()
if client.is_classicmode(): component.stop()
component.stop()
dialog = dialogs.YesNoDialog( dialog = dialogs.YesNoDialog(
_("Attention"), _("Attention"),
_("Your current session will be stopped. Continue?") _("Your current session will be stopped. Continue?")
) )
dialog.run().addCallback(on_response) dialog.run().addCallback(on_response)
elif classic_mode_was_set==False and new_gtkui_in_classic_mode==True: elif classic_mode_was_set == False and new_gtkui_in_classic_mode == True:
dialog = dialogs.InformationDialog( dialog = dialogs.InformationDialog(
_("Attention"), _("Attention"),
_("You must now restart the deluge UI") _("You must now restart the deluge UI")