Properly shutdown the daemon if changing from classic to regular

This commit is contained in:
Andrew Resch 2008-06-23 06:47:06 +00:00
parent 982fd4f292
commit e905044445
2 changed files with 11 additions and 1 deletions

View File

@ -132,6 +132,10 @@ class GtkUI:
# Make sure gtkui.conf has at least the defaults set
self.config = deluge.configmanager.ConfigManager("gtkui.conf", DEFAULT_PREFS)
# We need to check on exit if it was started in classic mode to ensure we
# shutdown the daemon.
self.started_in_classic = self.config["classic_mode"]
# Start the Dbus Interface before anything else.. Just in case we are
# already running.
self.queuedtorrents = QueuedTorrents()
@ -184,6 +188,8 @@ class GtkUI:
# Shutdown all components
component.shutdown()
if self.started_in_classic:
client.shutdown()
def _on_new_core(self, data):
component.start()

View File

@ -36,6 +36,7 @@ pygtk.require('2.0')
import gtk, gtk.glade
import pkg_resources
import deluge.error
import deluge.component as component
from deluge.ui.client import aclient as client
import deluge.common as common
@ -222,7 +223,10 @@ class MenuBar(component.Component):
def on_menuitem_quit_activate(self, data=None):
log.debug("on_menuitem_quit_activate")
if self.config["classic_mode"]:
client.shutdown()
try:
client.shutdown()
except deluge.error.NoCoreError:
pass
self.window.quit()
## Edit Menu ##