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,6 +137,8 @@ class Palette(gtk.Window):
'popup' : (gobject.SIGNAL_RUN_FIRST,
gobject.TYPE_NONE, ([])),
'popdown' : (gobject.SIGNAL_RUN_FIRST,
gobject.TYPE_NONE, ([])),
'activate' : (gobject.SIGNAL_RUN_FIRST,
gobject.TYPE_NONE, ([]))
}
@ -383,11 +385,17 @@ class Palette(gtk.Window):
self._hide_icon()
else:
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.props.icon_size = gtk.ICON_SIZE_LARGE_TOOLBAR
self._icon_box.pack_start(self._icon)
event_box.add(self._icon)
self._icon.show()
self._show_icon()
@ -396,6 +404,9 @@ class Palette(gtk.Window):
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):
self._icon_visible = visible