Do not crash if cannot find icon

This commit is contained in:
Marco Pesenti Gritti 2006-05-17 00:23:00 -04:00
parent 2ae62db4cc
commit 6d7e1dcb4c
2 changed files with 5 additions and 4 deletions

View File

@ -9,7 +9,7 @@ from sugar.shell import shell
def start(console): def start(console):
shell.main() shell.main()
print 'aaaa'
activities = ['sugar/chat/chat', 'sugar/browser/browser'] activities = ['sugar/chat/chat', 'sugar/browser/browser']
for activity in activities: for activity in activities:

View File

@ -105,9 +105,10 @@ class Activity(dbus.service.Object):
def activity_set_tab_icon_name(self, icon_name): def activity_set_tab_icon_name(self, icon_name):
icon_theme = gtk.icon_theme_get_default() icon_theme = gtk.icon_theme_get_default()
icon_info = icon_theme.lookup_icon(icon_name, gtk.ICON_SIZE_MENU, 0) icon_info = icon_theme.lookup_icon(icon_name, gtk.ICON_SIZE_MENU, 0)
pixbuf = icon_info.load_icon() if icon_info:
scaled_pixbuf = pixbuf.scale_simple(16, 16, gtk.gdk.INTERP_BILINEAR) pixbuf = icon_info.load_icon()
self.activity_set_icon(scaled_pixbuf) scaled_pixbuf = pixbuf.scale_simple(16, 16, gtk.gdk.INTERP_BILINEAR)
self.activity_set_icon(scaled_pixbuf)
def lost_focus(self): def lost_focus(self):
self.activity_on_lost_focus() self.activity_on_lost_focus()