Add activate signal to Palette

This commit is contained in:
Tomeu Vizoso 2009-02-10 18:57:02 +01:00
parent b39ed70b11
commit 997c384405

View File

@ -137,7 +137,9 @@ class Palette(gtk.Window):
'popup' : (gobject.SIGNAL_RUN_FIRST, 'popup' : (gobject.SIGNAL_RUN_FIRST,
gobject.TYPE_NONE, ([])), gobject.TYPE_NONE, ([])),
'popdown' : (gobject.SIGNAL_RUN_FIRST, 'popdown' : (gobject.SIGNAL_RUN_FIRST,
gobject.TYPE_NONE, ([])) gobject.TYPE_NONE, ([])),
'activate' : (gobject.SIGNAL_RUN_FIRST,
gobject.TYPE_NONE, ([]))
} }
# DEPRECATED: label is passed with the primary-text property, accel_path # DEPRECATED: label is passed with the primary-text property, accel_path
@ -377,17 +379,23 @@ class Palette(gtk.Window):
self._label_alignment.set_padding(0, 0, style.DEFAULT_SPACING, self._label_alignment.set_padding(0, 0, style.DEFAULT_SPACING,
style.DEFAULT_SPACING) style.DEFAULT_SPACING)
def set_icon(self, icon): def set_icon(self, icon):
if icon is None: if icon is None:
self._icon = None self._icon = None
self._hide_icon() self._hide_icon()
else: else:
if self._icon: if self._icon:
self._icon_box.remove(self._icon) self._icon_box.remove(self._icon_box.get_children()[0])
event_box = gtk.EventBox()
event_box.connect('button-release-event',
self.__icon_button_release_event_cb)
self._icon_box.pack_start(event_box)
event_box.show()
self._icon = icon self._icon = icon
self._icon.props.icon_size = gtk.ICON_SIZE_LARGE_TOOLBAR self._icon.props.icon_size = gtk.ICON_SIZE_LARGE_TOOLBAR
self._icon_box.pack_start(self._icon) event_box.add(self._icon)
self._icon.show() self._icon.show()
self._show_icon() self._show_icon()
@ -396,6 +404,9 @@ class Palette(gtk.Window):
icon = gobject.property(type=object, getter=get_icon, setter=set_icon) icon = gobject.property(type=object, getter=get_icon, setter=set_icon)
def __icon_button_release_event_cb(self, icon, event):
self.emit('activate')
def set_icon_visible(self, visible): def set_icon_visible(self, visible):
self._icon_visible = visible self._icon_visible = visible