Module: deluge
Branch: master
Commit: e5760ee3413b2bc119b4cd5652d5030d3a557ffe

Author: John Garland <[email protected]>
Date:   Sat Oct 23 01:12:21 2010 +1100

Fix uncaught exception when quitting

---

 deluge/ui/gtkui/mainwindow.py |   10 +++++++++-
 deluge/ui/gtkui/menubar.py    |    5 +----
 deluge/ui/gtkui/systemtray.py |    6 +-----
 3 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/deluge/ui/gtkui/mainwindow.py b/deluge/ui/gtkui/mainwindow.py
index 1153b1e..344359f 100644
--- a/deluge/ui/gtkui/mainwindow.py
+++ b/deluge/ui/gtkui/mainwindow.py
@@ -152,7 +152,15 @@ class MainWindow(component.Component):
         """Returns a reference to the main window glade object."""
         return self.main_glade
 
-    def quit(self):
+    def quit(self, shutdown=False):
+        """
+        Quits the GtkUI
+
+        :param shutdown: whether or not to shutdown the daemon as well
+        :type shutdown: boolean
+        """
+        if shutdown:
+            client.daemon.shutdown()
         reactor.stop()
 
     def load_window_state(self):
diff --git a/deluge/ui/gtkui/menubar.py b/deluge/ui/gtkui/menubar.py
index 7f16b11..1a90269 100644
--- a/deluge/ui/gtkui/menubar.py
+++ b/deluge/ui/gtkui/menubar.py
@@ -253,10 +253,7 @@ class MenuBar(component.Component):
 
     def on_menuitem_quitdaemon_activate(self, data=None):
         log.debug("on_menuitem_quitdaemon_activate")
-        # Tell the core to shutdown
-        def on_shutdown(result):
-            self.window.quit()
-        client.daemon.shutdown().addCallback(on_shutdown)
+        self.window.quit(shutdown=True)
 
     def on_menuitem_quit_activate(self, data=None):
         log.debug("on_menuitem_quit_activate")
diff --git a/deluge/ui/gtkui/systemtray.py b/deluge/ui/gtkui/systemtray.py
index 2ed8967..8078523 100644
--- a/deluge/ui/gtkui/systemtray.py
+++ b/deluge/ui/gtkui/systemtray.py
@@ -323,9 +323,6 @@ class SystemTray(component.Component):
         if self.config["lock_tray"] and not self.window.visible():
             self.unlock_tray()
 
-        if self.config["classic_mode"]:
-            client.daemon.shutdown()
-
         self.window.quit()
 
     def on_menuitem_quitdaemon_activate(self, menuitem):
@@ -333,8 +330,7 @@ class SystemTray(component.Component):
         if self.config["lock_tray"] and not self.window.visible():
             self.unlock_tray()
 
-        client.daemon.shutdown()
-        self.window.quit()
+        self.window.quit(shutdown=True)
 
     def tray_setbwdown(self, widget, data=None):
         self.setbwlimit(widget, _("Set Maximum Download Speed"), 
"max_download_speed",

-- 
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en.

Reply via email to