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

View File

@ -30,27 +30,27 @@ class ObjectTypeRegistry(dbus.service.Object):
self._types = {} self._types = {}
self._add_primitive('Text', _('Text'), 'theme:text-x-generic', self._add_primitive('Text', _('Text'), 'text-x-generic',
['text/plain', 'text/rtf', 'application/pdf', ['text/plain', 'text/rtf', 'application/pdf',
'application/x-pdf', 'text/html', 'application/x-pdf', 'text/html',
'application/vnd.oasis.opendocument.text', 'application/vnd.oasis.opendocument.text',
'application/rtf', 'text/rtf']) 'application/rtf', 'text/rtf'])
self._add_primitive('Image', _('Image'), 'theme:image-x-generic', self._add_primitive('Image', _('Image'), 'image-x-generic',
['image/png', 'image/gif', 'image/jpeg']) ['image/png', 'image/gif', 'image/jpeg'])
self._add_primitive('Audio', _('Audio'), 'theme:audio-x-generic', self._add_primitive('Audio', _('Audio'), 'audio-x-generic',
['audio/ogg']) ['audio/ogg'])
self._add_primitive('Video', _('Video'), 'theme:video-x-generic', self._add_primitive('Video', _('Video'), 'video-x-generic',
['video/ogg', 'application/ogg']) ['video/ogg', 'application/ogg'])
self._add_primitive('Etoys project', _('Etoys project'), self._add_primitive('Etoys project', _('Etoys project'),
'theme:application-x-squeak-project', 'application-x-squeak-project',
['application/x-squeak-project']) ['application/x-squeak-project'])
self._add_primitive('Link', _('Link'), self._add_primitive('Link', _('Link'),
'theme:text-uri-list', 'text-uri-list',
['text/x-moz-url', 'text/uri-list']) ['text/x-moz-url', 'text/uri-list'])
def _add_primitive(self, type_id, name, icon, mime_types): def _add_primitive(self, type_id, name, icon, mime_types):

View File

@ -103,7 +103,7 @@ class HomeActivity(gobject.GObject):
if self._activity_info: if self._activity_info:
return self._activity_info.icon return self._activity_info.icon
else: else:
return 'theme:image-missing' return 'image-missing'
def get_icon_color(self): def get_icon_color(self):
"""Retrieve the appropriate icon colour for this activity """Retrieve the appropriate icon colour for this activity

View File

@ -24,7 +24,7 @@ class OverlayBox(hippo.CanvasBox):
self._shell = shell self._shell = shell
icon = IconButton(icon_name='theme:stock-chat') icon = IconButton(icon_name='stock-chat')
icon.connect('activated', self._overlay_clicked_cb) icon.connect('activated', self._overlay_clicked_cb)
self.append(icon) self.append(icon)

View File

@ -75,9 +75,9 @@ class ActivityToolbar(gtk.Toolbar):
self.share = ToolComboBox(label_text='Share with:') self.share = ToolComboBox(label_text='Share with:')
self.share.combo.connect('changed', self._share_changed_cb) self.share.combo.connect('changed', self._share_changed_cb)
self.share.combo.append_item(None, _('Private'), self.share.combo.append_item(None, _('Private'),
'theme:zoom-home-mini') 'zoom-home-mini')
self.share.combo.append_item(None, _('My Neighborhood'), self.share.combo.append_item(None, _('My Neighborhood'),
'theme:zoom-neighborhood-mini') 'zoom-neighborhood-mini')
self.insert(self.share, -1) self.insert(self.share, -1)
self.share.show() self.share.show()

View File

@ -61,8 +61,8 @@ class ComboBox(gtk.ComboBox):
del info del info
return fname return fname
def append_item(self, action_id, text, icon_name=None): def append_item(self, action_id, text, icon_name=None, file_name=None):
if not self._icon_renderer and icon_name: if not self._icon_renderer and (icon_name or file_name):
self._icon_renderer = gtk.CellRendererPixbuf() self._icon_renderer = gtk.CellRendererPixbuf()
settings = self.get_settings() settings = self.get_settings()
@ -77,16 +77,17 @@ class ComboBox(gtk.ComboBox):
self.pack_end(self._text_renderer, True) self.pack_end(self._text_renderer, True)
self.add_attribute(self._text_renderer, 'text', 1) self.add_attribute(self._text_renderer, 'text', 1)
if icon_name: if icon_name or file_name:
if text: if text:
size = gtk.ICON_SIZE_MENU size = gtk.ICON_SIZE_MENU
else: else:
size = gtk.ICON_SIZE_LARGE_TOOLBAR size = gtk.ICON_SIZE_LARGE_TOOLBAR
width, height = gtk.icon_size_lookup(size) 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) if icon_name:
pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(icon_name, width, height) 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: else:
pixbuf = None pixbuf = None

View File

@ -150,7 +150,7 @@ class CollapsedEntry(CanvasRoundBox):
self._icon_name = type.icon self._icon_name = type.icon
if not self._icon_name: if not self._icon_name:
self._icon_name = 'theme:image-missing' self._icon_name = 'image-missing'
return self._icon_name return self._icon_name