From 6d7e1dcb4cb520d1f53ad06bf251d1d988e0c851 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Wed, 17 May 2006 00:23:00 -0400 Subject: [PATCH] Do not crash if cannot find icon --- sugar/session/session.py | 2 +- sugar/shell/activity.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/sugar/session/session.py b/sugar/session/session.py index 9b082b70..b58dfd94 100644 --- a/sugar/session/session.py +++ b/sugar/session/session.py @@ -9,7 +9,7 @@ from sugar.shell import shell def start(console): shell.main() - print 'aaaa' + activities = ['sugar/chat/chat', 'sugar/browser/browser'] for activity in activities: diff --git a/sugar/shell/activity.py b/sugar/shell/activity.py index 4678a9c0..d15f1b18 100644 --- a/sugar/shell/activity.py +++ b/sugar/shell/activity.py @@ -105,9 +105,10 @@ class Activity(dbus.service.Object): def activity_set_tab_icon_name(self, icon_name): icon_theme = gtk.icon_theme_get_default() icon_info = icon_theme.lookup_icon(icon_name, gtk.ICON_SIZE_MENU, 0) - pixbuf = icon_info.load_icon() - scaled_pixbuf = pixbuf.scale_simple(16, 16, gtk.gdk.INTERP_BILINEAR) - self.activity_set_icon(scaled_pixbuf) + if icon_info: + pixbuf = icon_info.load_icon() + scaled_pixbuf = pixbuf.scale_simple(16, 16, gtk.gdk.INTERP_BILINEAR) + self.activity_set_icon(scaled_pixbuf) def lost_focus(self): self.activity_on_lost_focus()