Fix up stopping classic mode

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

View File

@ -613,6 +613,11 @@ class Client(object):
"""
Disconnects from the daemon.
"""
if self.is_classicmode():
self._daemon_proxy.disconnect()
self.stop_classic_mode()
return
if self._daemon_proxy:
return self._daemon_proxy.disconnect()
@ -623,6 +628,13 @@ class Client(object):
self._daemon_proxy = DaemonClassicProxy(self.__event_handlers)
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):
"""
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
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):
if response == gtk.RESPONSE_NO:
# Set each changed config value in the core
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)
else:
client.disconnect()
if client.is_classicmode():
component.stop()
dialog = dialogs.YesNoDialog(
_("Attention"),
_("Your current session will be stopped. Continue?")
)
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(
_("Attention"),
_("You must now restart the deluge UI")