mirror of
https://github.com/codex-storage/deluge.git
synced 2025-02-04 15:43:28 +00:00
Properly shutdown the daemon if changing from classic to regular
This commit is contained in:
parent
982fd4f292
commit
e905044445
@ -132,6 +132,10 @@ class GtkUI:
|
|||||||
# Make sure gtkui.conf has at least the defaults set
|
# Make sure gtkui.conf has at least the defaults set
|
||||||
self.config = deluge.configmanager.ConfigManager("gtkui.conf", DEFAULT_PREFS)
|
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
|
# Start the Dbus Interface before anything else.. Just in case we are
|
||||||
# already running.
|
# already running.
|
||||||
self.queuedtorrents = QueuedTorrents()
|
self.queuedtorrents = QueuedTorrents()
|
||||||
@ -184,6 +188,8 @@ class GtkUI:
|
|||||||
|
|
||||||
# Shutdown all components
|
# Shutdown all components
|
||||||
component.shutdown()
|
component.shutdown()
|
||||||
|
if self.started_in_classic:
|
||||||
|
client.shutdown()
|
||||||
|
|
||||||
def _on_new_core(self, data):
|
def _on_new_core(self, data):
|
||||||
component.start()
|
component.start()
|
||||||
|
@ -36,6 +36,7 @@ pygtk.require('2.0')
|
|||||||
import gtk, gtk.glade
|
import gtk, gtk.glade
|
||||||
import pkg_resources
|
import pkg_resources
|
||||||
|
|
||||||
|
import deluge.error
|
||||||
import deluge.component as component
|
import deluge.component as component
|
||||||
from deluge.ui.client import aclient as client
|
from deluge.ui.client import aclient as client
|
||||||
import deluge.common as common
|
import deluge.common as common
|
||||||
@ -222,7 +223,10 @@ class MenuBar(component.Component):
|
|||||||
def on_menuitem_quit_activate(self, data=None):
|
def on_menuitem_quit_activate(self, data=None):
|
||||||
log.debug("on_menuitem_quit_activate")
|
log.debug("on_menuitem_quit_activate")
|
||||||
if self.config["classic_mode"]:
|
if self.config["classic_mode"]:
|
||||||
|
try:
|
||||||
client.shutdown()
|
client.shutdown()
|
||||||
|
except deluge.error.NoCoreError:
|
||||||
|
pass
|
||||||
self.window.quit()
|
self.window.quit()
|
||||||
|
|
||||||
## Edit Menu ##
|
## Edit Menu ##
|
||||||
|
Loading…
x
Reference in New Issue
Block a user