diff options
Diffstat (limited to 'lib/sugar/graphics')
-rw-r--r-- | lib/sugar/graphics/icon.py | 5 | ||||
-rw-r--r-- | lib/sugar/graphics/palette.py | 7 | ||||
-rw-r--r-- | lib/sugar/graphics/palettegroup.py | 1 |
3 files changed, 13 insertions, 0 deletions
diff --git a/lib/sugar/graphics/icon.py b/lib/sugar/graphics/icon.py index d2d71d6..ac151c3 100644 --- a/lib/sugar/graphics/icon.py +++ b/lib/sugar/graphics/icon.py @@ -386,6 +386,11 @@ class CanvasIcon(hippo.CanvasBox, hippo.CanvasItem): hippo.CanvasBox.__init__(self, **kwargs) self._palette = None + self.connect('destroy', self.__destroy_cb) + + def __destroy_cb(self, icon): + if self._palette is not None: + self._palette.destroy() def do_set_property(self, pspec, value): if pspec.name == 'file-name': diff --git a/lib/sugar/graphics/palette.py b/lib/sugar/graphics/palette.py index a4cef8f..a24a806 100644 --- a/lib/sugar/graphics/palette.py +++ b/lib/sugar/graphics/palette.py @@ -148,6 +148,7 @@ class Palette(gtk.Window): # Just assume xthickness and ythickness are the same self.set_border_width(self.style.xthickness) self.connect('realize', self._realize_cb) + self.connect('destroy', self.__destroy_cb) self.palette_state = self.PRIMARY @@ -217,6 +218,12 @@ class Palette(gtk.Window): self._mouse_detector = MouseSpeedDetector(self, 200, 5) self._mouse_detector.connect('motion-slow', self._mouse_slow_cb) + def __destroy_cb(self, palette): + self.set_group_id(None) + + if self._palette_popup_sid is not None: + _palette_observer.disconnect(self._palette_popup_sid) + def _add_menu(self): self._menu_box = gtk.VBox() self._secondary_box.pack_start(self._menu_box) diff --git a/lib/sugar/graphics/palettegroup.py b/lib/sugar/graphics/palettegroup.py index 40d4ca2..bdae76b 100644 --- a/lib/sugar/graphics/palettegroup.py +++ b/lib/sugar/graphics/palettegroup.py @@ -68,6 +68,7 @@ class Group(gobject.GObject): palette.disconnect(sid) self._palettes.remove(palette) + del self._sig_ids[palette] def popdown(self): for palette in self._palettes: |