Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/sugar/graphics
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@localhost.localdomain>2007-07-23 11:15:02 (GMT)
committer Marco Pesenti Gritti <marco@localhost.localdomain>2007-07-23 11:15:02 (GMT)
commitaee3330be4857737c3afd2c5c462118c95df6fdb (patch)
treede0f24dbc67ea1ab60390c041a8026df6075e3d9 /sugar/graphics
parent4da2bafa84f4a9853c6bc3da5598644f5b9bf8fb (diff)
Make combobox icons bigger when there is no text
Diffstat (limited to 'sugar/graphics')
-rw-r--r--sugar/graphics/combobox.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/sugar/graphics/combobox.py b/sugar/graphics/combobox.py
index b3a6e5f..02900d7 100644
--- a/sugar/graphics/combobox.py
+++ b/sugar/graphics/combobox.py
@@ -53,9 +53,9 @@ class ComboBox(gtk.ComboBox):
else:
return gtk.ComboBox.do_get_property(self, pspec)
- def _get_real_name_from_theme(self, name):
+ def _get_real_name_from_theme(self, name, size):
icon_theme = gtk.icon_theme_get_default()
- width, height = gtk.icon_size_lookup(gtk.ICON_SIZE_MENU)
+ width, height = gtk.icon_size_lookup(size)
info = icon_theme.lookup_icon(name, width, height)
if not info:
raise ValueError("Icon '" + name + "' not found.")
@@ -76,9 +76,14 @@ class ComboBox(gtk.ComboBox):
self.add_attribute(self._text_renderer, 'text', 1)
if icon_name:
- width, height = gtk.icon_size_lookup(gtk.ICON_SIZE_MENU)
+ if text:
+ size = gtk.ICON_SIZE_MENU
+ else:
+ size = gtk.ICON_SIZE_LARGE_TOOLBAR
+
+ width, height = gtk.icon_size_lookup(size)
if icon_name[0:6] == "theme:":
- icon_name = self._get_real_name_from_theme(icon_name[6:])
+ icon_name = self._get_real_name_from_theme(icon_name[6:], size)
pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(icon_name, width, height)
else:
pixbuf = None