#8485 Detach from palette when a widget is destroyed
This commit is contained in:
parent
1ab0c67830
commit
f2a8948bf1
@ -36,6 +36,12 @@ class RadioToolButton(gtk.RadioToolButton):
|
|||||||
|
|
||||||
self._palette_invoker.attach_tool(self)
|
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):
|
def set_tooltip(self, tooltip):
|
||||||
""" Set a simple palette with just a single label.
|
""" Set a simple palette with just a single label.
|
||||||
"""
|
"""
|
||||||
|
@ -30,6 +30,12 @@ class ToggleToolButton(gtk.ToggleToolButton):
|
|||||||
self._palette_invoker = ToolInvoker(self)
|
self._palette_invoker = ToolInvoker(self)
|
||||||
self.set_named_icon(named_icon)
|
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):
|
def set_named_icon(self, named_icon):
|
||||||
icon = Icon(icon_name=named_icon)
|
icon = Icon(icon_name=named_icon)
|
||||||
self.set_icon_widget(icon)
|
self.set_icon_widget(icon)
|
||||||
|
@ -68,6 +68,12 @@ class ToolButton(gtk.ToolButton):
|
|||||||
self.get_child().connect('can-activate-accel',
|
self.get_child().connect('can-activate-accel',
|
||||||
self.__button_can_activate_accel_cb)
|
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):
|
def __button_can_activate_accel_cb(self, button, signal_id):
|
||||||
# Accept activation via accelerators regardless of this widget's state
|
# Accept activation via accelerators regardless of this widget's state
|
||||||
return True
|
return True
|
||||||
|
@ -358,6 +358,12 @@ class TrayIcon(gtk.ToolItem):
|
|||||||
|
|
||||||
self.set_size_request(style.GRID_CELL_SIZE, style.GRID_CELL_SIZE)
|
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):
|
def create_palette(self):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user