Author: andar

Revision: 5305

Log:
        Prevent some uncaught exceptions when systemtray is not enabled

Diff:
Modified: branches/1.1.0_RC/deluge/ui/gtkui/systemtray.py
===================================================================
--- branches/1.1.0_RC/deluge/ui/gtkui/systemtray.py     2009-05-25 02:27:33 UTC 
(rev 5304)
+++ branches/1.1.0_RC/deluge/ui/gtkui/systemtray.py     2009-05-25 06:07:26 UTC 
(rev 5305)
@@ -154,15 +154,17 @@
         self.__start()
 
     def stop(self):
-        try:
-            # Hide widgets in hide list because we're not connected to a host
-            for widget in self.hide_widget_list:
-                self.tray_glade.get_widget(widget).hide()
-        except Exception, e:
-            log.debug("Unable to hide system tray menu widgets: %s", e)
+        if self.config["enable_system_tray"]:
+            try:
+                # Hide widgets in hide list because we're not connected to a 
host
+                for widget in self.hide_widget_list:
+                    self.tray_glade.get_widget(widget).hide()
+            except Exception, e:
+                log.debug("Unable to hide system tray menu widgets: %s", e)
 
     def shutdown(self):
-        self.tray.set_visible(False)
+        if self.config["enable_system_tray"]:
+            self.tray.set_visible(False)
 
     def send_status_request(self):
         client.get_download_rate(self._on_get_download_rate)

Modified: trunk/deluge/ui/gtkui/systemtray.py
===================================================================
--- trunk/deluge/ui/gtkui/systemtray.py 2009-05-25 02:27:33 UTC (rev 5304)
+++ trunk/deluge/ui/gtkui/systemtray.py 2009-05-25 06:07:26 UTC (rev 5305)
@@ -153,17 +153,19 @@
         self.__start()
 
     def stop(self):
-        try:
-            # Hide widgets in hide list because we're not connected to a host
-            for widget in self.hide_widget_list:
-                self.tray_glade.get_widget(widget).hide()
-        except Exception, e:
-            log.debug("Unable to hide system tray menu widgets: %s", e)
+        if self.config["enable_system_tray"]:
+            try:
+                # Hide widgets in hide list because we're not connected to a 
host
+                for widget in self.hide_widget_list:
+                    self.tray_glade.get_widget(widget).hide()
+            except Exception, e:
+                log.debug("Unable to hide system tray menu widgets: %s", e)
 
-        self.tray.set_tooltip(_("Deluge\nNot Connected.."))
+            self.tray.set_tooltip(_("Deluge\nNot Connected.."))
 
     def shutdown(self):
-        self.tray.set_visible(False)
+        if self.config["enable_system_tray"]:        
+            self.tray.set_visible(False)
 
     def send_status_request(self):
         client.core.get_download_rate().addCallback(self._on_get_download_rate)



--~--~---------~--~----~------------~-------~--~----~
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