conduit r1610 - in trunk: . conduit/gtkui
- From: jstowers svn gnome org
- To: svn-commits-list gnome org
- Subject: conduit r1610 - in trunk: . conduit/gtkui
- Date: Thu, 31 Jul 2008 13:23:59 +0000 (UTC)
Author: jstowers
Date: Thu Jul 31 13:23:59 2008
New Revision: 1610
URL: http://svn.gnome.org/viewvc/conduit?rev=1610&view=rev
Log:
	* conduit/gtkui/Canvas.py: Dont recurse forever when updating the
	background to match the theme on the main canvas.
Modified:
   trunk/   (props changed)
   trunk/ChangeLog
   trunk/conduit/gtkui/Canvas.py
Modified: trunk/conduit/gtkui/Canvas.py
==============================================================================
--- trunk/conduit/gtkui/Canvas.py	(original)
+++ trunk/conduit/gtkui/Canvas.py	Thu Jul 31 13:23:59 2008
@@ -191,12 +191,14 @@
                         gtk.gdk.ACTION_COPY | gtk.gdk.ACTION_LINK)
         self.connect('drag-motion', self.on_drag_motion)
         self.connect('size-allocate', self._canvas_resized)
+
         #track theme chages for canvas background
         self.connect('realize', self._update_for_theme)
-        #FIXME: Causes pygtk to recurse for ever. It appears that setting
-        #backgroun_color_rgb in the sync-set handler causes sync-set to be 
-        #emitted again
-        #self.connect("style-set", self._update_for_theme)
+        #We need a flag becuase otherwise we recurse forever.
+        #It appears that setting background_color_rgb in the 
+        #sync-set handler causes sync-set to be emitted again, and again...
+        self._changing_style = False
+        self.connect("style-set", self._update_for_theme)
 
         #keeps a reference to the currently selected (most recently clicked)
         #canvas items
@@ -212,8 +214,10 @@
         self._show_welcome_message()
         
     def _update_for_theme(self, *args):
-        if not self.get_gtk_style():
+        if not self.get_gtk_style() or self._changing_style:
             return
+
+        self._changing_style = True    
         self.set_property(
                 "background_color_rgb",
                 self.get_style_color_int_rgb("bg","normal")
@@ -223,6 +227,7 @@
                 "fill_color_rgba",
                 self.get_style_color_int_rgba("text","normal")
                 )
+        self._changing_style = False
 
     def _setup_popup_menus(self, dataproviderPopupXML, conduitPopupXML):
         """
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]