Author: andar

Revision: 6026

Log:
        Fix #1086 deprecated gtk.Tooltips usage

Diff:
Modified: branches/1.2_RC/ChangeLog
===================================================================
--- branches/1.2_RC/ChangeLog   2009-12-14 02:15:08 UTC (rev 6025)
+++ branches/1.2_RC/ChangeLog   2009-12-14 18:20:51 UTC (rev 6026)
@@ -30,6 +30,7 @@
          gtkui to shutdown the currently connected daemon.
        * Fix #594 tray password dialog freeze in Windows
        * Made the password dialog prettier
+       * Fix #1086 deprecated gtk.Tooltips usage
 
 ==== Console ====
        * Fix using the console in Windows, but only in command-line mode

Modified: branches/1.2_RC/deluge/ui/gtkui/statusbar.py
===================================================================
--- branches/1.2_RC/deluge/ui/gtkui/statusbar.py        2009-12-14 02:15:08 UTC 
(rev 6025)
+++ branches/1.2_RC/deluge/ui/gtkui/statusbar.py        2009-12-14 18:20:51 UTC 
(rev 6026)
@@ -45,7 +45,7 @@
 from deluge.log import LOG as log
 
 class StatusBarItem:
-    def __init__(self, image=None, stock=None, text=None, callback=None):
+    def __init__(self, image=None, stock=None, text=None, callback=None, 
tooltip=None):
         self._widgets = []
         self._ebox = gtk.EventBox()
         self._hbox = gtk.HBox()
@@ -70,6 +70,9 @@
         if callback != None:
             self.set_callback(callback)
 
+        if tooltip:
+            self.set_tooltip(tooltip)
+
         self.show_all()
 
     def set_callback(self, callback):
@@ -91,8 +94,12 @@
         if self._label.get_text() != text:
             self._label.set_text(text)
 
+    def set_tooltip(self, tip):
+        if self._ebox.get_tooltip_text() != tip:
+            self._ebox.set_tooltip_text(tip)
+
     def get_widgets(self):
-        return self._widgets()
+        return self._widgets
 
     def get_eventbox(self):
         return self._ebox
@@ -105,7 +112,6 @@
         component.Component.__init__(self, "StatusBar", interval=3)
         self.window = component.get("MainWindow")
         self.statusbar = self.window.main_glade.get_widget("statusbar")
-        self.tooltips = gtk.Tooltips()
         self.config = ConfigManager("gtkui.conf")
 
         # Status variables that are updated via callback
@@ -172,8 +178,7 @@
             tooltip=_("Protocol Traffic Download/Upload"))
 
         self.dht_item = StatusBarItem(
-            image=deluge.common.get_pixmap("dht16.png"))
-        self.tooltips.set_tip(self.dht_item.get_eventbox(), "DHT Nodes")
+            image=deluge.common.get_pixmap("dht16.png"), tooltip=_("DHT 
Nodes"))
 
         self.health_item = self.add_item(
                 stock=gtk.STOCK_DIALOG_ERROR,
@@ -223,10 +228,8 @@
     def add_item(self, image=None, stock=None, text=None, callback=None, 
tooltip=None):
         """Adds an item to the status bar"""
         # The return tuple.. we return whatever widgets we add
-        item = StatusBarItem(image, stock, text, callback)
+        item = StatusBarItem(image, stock, text, callback, tooltip)
         self.hbox.pack_start(item.get_eventbox(), expand=False, fill=False)
-        if tooltip:
-            self.tooltips.set_tip(item.get_eventbox(), tooltip)
         return item
 
     def remove_item(self, item):

Modified: trunk/deluge/ui/gtkui/statusbar.py
===================================================================
--- trunk/deluge/ui/gtkui/statusbar.py  2009-12-14 02:15:08 UTC (rev 6025)
+++ trunk/deluge/ui/gtkui/statusbar.py  2009-12-14 18:20:51 UTC (rev 6026)
@@ -45,7 +45,7 @@
 from deluge.log import LOG as log
 
 class StatusBarItem:
-    def __init__(self, image=None, stock=None, text=None, callback=None):
+    def __init__(self, image=None, stock=None, text=None, callback=None, 
tooltip=None):
         self._widgets = []
         self._ebox = gtk.EventBox()
         self._hbox = gtk.HBox()
@@ -70,6 +70,9 @@
         if callback != None:
             self.set_callback(callback)
 
+        if tooltip:
+            self.set_tooltip(tooltip)
+
         self.show_all()
 
     def set_callback(self, callback):
@@ -91,8 +94,12 @@
         if self._label.get_text() != text:
             self._label.set_text(text)
 
+    def set_tooltip(self, tip):
+        if self._ebox.get_tooltip_text() != tip:
+            self._ebox.set_tooltip_text(tip)
+
     def get_widgets(self):
-        return self._widgets()
+        return self._widgets
 
     def get_eventbox(self):
         return self._ebox
@@ -105,7 +112,6 @@
         component.Component.__init__(self, "StatusBar", interval=3)
         self.window = component.get("MainWindow")
         self.statusbar = self.window.main_glade.get_widget("statusbar")
-        self.tooltips = gtk.Tooltips()
         self.config = ConfigManager("gtkui.conf")
 
         # Status variables that are updated via callback
@@ -172,8 +178,7 @@
             tooltip=_("Protocol Traffic Download/Upload"))
 
         self.dht_item = StatusBarItem(
-            image=deluge.common.get_pixmap("dht16.png"))
-        self.tooltips.set_tip(self.dht_item.get_eventbox(), "DHT Nodes")
+            image=deluge.common.get_pixmap("dht16.png"), tooltip=_("DHT 
Nodes"))
 
         self.health_item = self.add_item(
                 stock=gtk.STOCK_DIALOG_ERROR,
@@ -223,10 +228,8 @@
     def add_item(self, image=None, stock=None, text=None, callback=None, 
tooltip=None):
         """Adds an item to the status bar"""
         # The return tuple.. we return whatever widgets we add
-        item = StatusBarItem(image, stock, text, callback)
+        item = StatusBarItem(image, stock, text, callback, tooltip)
         self.hbox.pack_start(item.get_eventbox(), expand=False, fill=False)
-        if tooltip:
-            self.tooltips.set_tip(item.get_eventbox(), tooltip)
         return item
 
     def remove_item(self, item):


--

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


Reply via email to