#8485 Detach from palette when a widget is destroyed

This commit is contained in:
Tomeu Vizoso 2008-09-18 14:12:18 +02:00
parent 1ab0c67830
commit f2a8948bf1
4 changed files with 24 additions and 0 deletions

View File

@ -36,6 +36,12 @@ class RadioToolButton(gtk.RadioToolButton):
self._palette_invoker.attach_tool(self)
self.connect('destroy', self.__destroy_cb)
def __destroy_cb(self, icon):
if self._palette_invoker is not None:
self._palette_invoker.detach()
def set_tooltip(self, tooltip):
""" Set a simple palette with just a single label.
"""

View File

@ -30,6 +30,12 @@ class ToggleToolButton(gtk.ToggleToolButton):
self._palette_invoker = ToolInvoker(self)
self.set_named_icon(named_icon)
self.connect('destroy', self.__destroy_cb)
def __destroy_cb(self, icon):
if self._palette_invoker is not None:
self._palette_invoker.detach()
def set_named_icon(self, named_icon):
icon = Icon(icon_name=named_icon)
self.set_icon_widget(icon)

View File

@ -68,6 +68,12 @@ class ToolButton(gtk.ToolButton):
self.get_child().connect('can-activate-accel',
self.__button_can_activate_accel_cb)
self.connect('destroy', self.__destroy_cb)
def __destroy_cb(self, icon):
if self._palette_invoker is not None:
self._palette_invoker.detach()
def __button_can_activate_accel_cb(self, button, signal_id):
# Accept activation via accelerators regardless of this widget's state
return True

View File

@ -358,6 +358,12 @@ class TrayIcon(gtk.ToolItem):
self.set_size_request(style.GRID_CELL_SIZE, style.GRID_CELL_SIZE)
self.connect('destroy', self.__destroy_cb)
def __destroy_cb(self, icon):
if self._palette_invoker is not None:
self._palette_invoker.detach()
def create_palette(self):
return None