From 6ae38464156c5ba2c06826ab9d8b9d4bd226c2bb Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Wed, 08 Aug 2007 11:03:09 +0000 Subject: Expose palette.action_bar --- (limited to 'sugar/graphics') diff --git a/sugar/graphics/palette.py b/sugar/graphics/palette.py index 4d09499..a877488 100644 --- a/sugar/graphics/palette.py +++ b/sugar/graphics/palette.py @@ -110,9 +110,9 @@ class Palette(gtk.Window): self._secondary_box.pack_start(self._content) self._content.show() - self._button_bar = gtk.HButtonBox() - self._secondary_box.pack_start(self._button_bar) - self._button_bar.show() + self.action_bar = PaletteActionBar() + self._secondary_box.pack_start(self.action_bar) + self.action_bar.show() self.add(vbox) vbox.show() @@ -145,10 +145,6 @@ class Palette(gtk.Window): self._update_accept_focus() self._update_separator() - def append_button(self, button): - self._button_bar.append_button(button) - self._button_bar.show() - def set_group_id(self, group_id): if self._group_id: group = palettegroup.get_group(self._group_id) @@ -377,6 +373,18 @@ class Palette(gtk.Window): if self != palette: self._hide() +class PaletteActionBar(gtk.HButtonBox): + def add_action(label, icon_name=None): + button = Button(label) + + if icon_name: + icon = Icon(icon_name) + button.set_image(icon) + icon.show() + + self.pack_start(button) + button.show() + class _Menu(_sugaruiext.Menu): __gtype_name__ = 'SugarPaletteMenu' -- cgit v0.9.1