Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Silbe <silbe@activitycentral.com>2011-10-16 14:40:42 (GMT)
committer Sascha Silbe <silbe@activitycentral.com>2011-10-18 15:41:58 (GMT)
commit48108c9a5f46fb8a479e07872f8f2e166ac6e4de (patch)
treed1eabbcb809b86a8ed8412697332f461bc626ae8
parent612842c407920f1ca8324658e3e856d5e5b0a822 (diff)
Journal: don't fail to load if an activity icon is broken (fixes SL#3200)
If the activity-provided icon could not be loaded, the Journal previously died on start-up, rendering Sugar effectively unusable. Now we fall back to the standard icon (in the "What" filter combo box). SL#3203 has been filed to remind us to audit the code for similar breakages. Signed-off-by: Sascha Silbe <silbe@activitycentral.com> Acked-by: Simon Schampijer <simon@laptop.org>
-rw-r--r--src/jarabe/journal/journaltoolbox.py31
1 files changed, 23 insertions, 8 deletions
diff --git a/src/jarabe/journal/journaltoolbox.py b/src/jarabe/journal/journaltoolbox.py
index cdf6a77..2aa4153 100644
--- a/src/jarabe/journal/journaltoolbox.py
+++ b/src/jarabe/journal/journaltoolbox.py
@@ -24,6 +24,7 @@ import time
import gobject
import gio
+import glib
import gtk
from sugar.graphics.palette import Palette
@@ -319,19 +320,33 @@ class SearchToolbar(gtk.Toolbar):
for service_name in model.get_unique_values('activity'):
activity_info = registry.get_bundle(service_name)
- if not activity_info is None:
- if os.path.exists(activity_info.get_icon()):
+ if activity_info is None:
+ continue
+
+ if service_name == current_value:
+ combo_model = self._what_search_combo.get_model()
+ current_value_index = len(combo_model)
+
+ # try activity-provided icon
+ if os.path.exists(activity_info.get_icon()):
+ try:
self._what_search_combo.append_item(service_name,
activity_info.get_name(),
file_name=activity_info.get_icon())
+ except glib.GError, exception:
+ logging.warning('Falling back to default icon for'
+ ' "what" filter because %r (%r) has an'
+ ' invalid icon: %s',
+ activity_info.get_name(),
+ str(service_name), exception)
else:
- self._what_search_combo.append_item(service_name,
- activity_info.get_name(),
- icon_name='application-octet-stream')
+ continue
+
+ # fall back to generic icon
+ self._what_search_combo.append_item(service_name,
+ activity_info.get_name(),
+ icon_name='application-octet-stream')
- if service_name == current_value:
- current_value_index = \
- len(self._what_search_combo.get_model()) - 1
finally:
self._what_search_combo.handler_unblock(
self._what_combo_changed_sid)