Make icon_name api consistent between the different toolbuttons

As discused in the mailing list [1] the api to set the icon in sugar
ToolButton, RadioToolButton and ToggleToolButton is inconsistent,
and with the port to GTK+ 3 the differences are visible (SL #3849).

This patch changes the API of ToolButton, RadioToolButton and
ToggleToolButton to override the icon-name property and add an
Icon instance with the set_icon_widget method.

Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>

[1] http://lists.sugarlabs.org/archive/sugar-devel/2012-September/039624.html
This commit is contained in:
Gonzalo Odiard
2012-09-19 17:25:30 -03:00
committed by Simon Schampijer
parent fe4667f0f5
commit fe11a3aa23
3 changed files with 19 additions and 20 deletions
+3 -3
View File
@@ -70,7 +70,7 @@ class ToolButton(Gtk.ToolButton):
self._palette_invoker.attach_tool(self)
if icon_name:
self.set_icon(icon_name)
self.set_icon_name(icon_name)
self.get_child().connect('can-activate-accel',
self.__button_can_activate_accel_cb)
@@ -114,12 +114,12 @@ class ToolButton(Gtk.ToolButton):
accelerator = GObject.property(type=str, setter=set_accelerator,
getter=get_accelerator)
def set_icon(self, icon_name):
def set_icon_name(self, icon_name):
icon = Icon(icon_name=icon_name)
self.set_icon_widget(icon)
icon.show()
icon_name = GObject.property(type=str, setter=set_icon)
icon_name = GObject.property(type=str, setter=set_icon_name)
def create_palette(self):
return None