Adapt to changes in the icon API.

This commit is contained in:
Tomeu Vizoso
2007-08-26 20:44:51 +02:00
parent cf7ff39c5a
commit 405dafc908
6 changed files with 19 additions and 18 deletions
+8 -7
View File
@@ -61,8 +61,8 @@ class ComboBox(gtk.ComboBox):
del info
return fname
def append_item(self, action_id, text, icon_name=None):
if not self._icon_renderer and icon_name:
def append_item(self, action_id, text, icon_name=None, file_name=None):
if not self._icon_renderer and (icon_name or file_name):
self._icon_renderer = gtk.CellRendererPixbuf()
settings = self.get_settings()
@@ -77,16 +77,17 @@ class ComboBox(gtk.ComboBox):
self.pack_end(self._text_renderer, True)
self.add_attribute(self._text_renderer, 'text', 1)
if icon_name:
if icon_name or file_name:
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:], size)
pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(icon_name, width, height)
if icon_name:
file_name = self._get_real_name_from_theme(icon_name[6:], size)
pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(file_name, width, height)
else:
pixbuf = None
+1 -1
View File
@@ -150,7 +150,7 @@ class CollapsedEntry(CanvasRoundBox):
self._icon_name = type.icon
if not self._icon_name:
self._icon_name = 'theme:image-missing'
self._icon_name = 'image-missing'
return self._icon_name