Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTomeu Vizoso <tomeu@sugarlabs.org>2009-02-10 17:57:02 (GMT)
committer Tomeu Vizoso <tomeu@sugarlabs.org>2009-02-10 17:57:02 (GMT)
commit997c384405095f943df6f658b636e4106a81159d (patch)
treea2b1edfca360292b2893b0e1977c9dafe5779d17 /src
parentb39ed70b11b377016527624d3779f36922b3a2c3 (diff)
Add activate signal to Palette
Diffstat (limited to 'src')
-rw-r--r--src/sugar/graphics/palette.py19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/sugar/graphics/palette.py b/src/sugar/graphics/palette.py
index e256a14..afc6e70 100644
--- a/src/sugar/graphics/palette.py
+++ b/src/sugar/graphics/palette.py
@@ -137,7 +137,9 @@ class Palette(gtk.Window):
'popup' : (gobject.SIGNAL_RUN_FIRST,
gobject.TYPE_NONE, ([])),
'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
@@ -377,17 +379,23 @@ class Palette(gtk.Window):
self._label_alignment.set_padding(0, 0, style.DEFAULT_SPACING,
style.DEFAULT_SPACING)
- def set_icon(self, icon):
+ def set_icon(self, icon):
if icon is None:
self._icon = None
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