diff options
author | Tomeu Vizoso <tomeu@tomeuvizoso.net> | 2008-01-25 18:30:20 (GMT) |
---|---|---|
committer | Tomeu Vizoso <tomeu@tomeuvizoso.net> | 2008-01-25 18:31:19 (GMT) |
commit | 123733084ecc26904993814152d109e0ed55a84c (patch) | |
tree | 37d5bd26145fbae7ada8ff3e437378ac8a289bc8 | |
parent | c7d258c50e6aa7129bf9fa36e24a2a0507c542d9 (diff) |
#6190 Don't crash when an activity has its icon missing.
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | journaltoolbox.py | 14 | ||||
-rw-r--r-- | misc.py | 9 |
3 files changed, 17 insertions, 7 deletions
@@ -1,3 +1,4 @@ +* #6190 Don't crash when an activity has its icon missing. (tomeu) * #6029 Don't fail when the mount point is already occupied. (tomeu) 83 diff --git a/journaltoolbox.py b/journaltoolbox.py index 652cd08..630d245 100644 --- a/journaltoolbox.py +++ b/journaltoolbox.py @@ -18,6 +18,7 @@ from gettext import gettext as _ import logging import time from datetime import datetime, timedelta +import os import gobject import gtk @@ -260,9 +261,16 @@ class SearchToolbar(gtk.Toolbar): if not appended_separator: self._what_search_combo.append_separator() appended_separator = True - self._what_search_combo.append_item(service_name, - activity_info.name, - file_name=activity_info.icon) + + if os.path.exists(activity_info.icon): + self._what_search_combo.append_item(service_name, + activity_info.name, + file_name=activity_info.icon) + else: + self._what_search_combo.append_item(service_name, + activity_info.name, + icon_name='application-octet-stream') + if service_name == current_value: current_value_index = len(self._what_search_combo.get_model()) - 1 @@ -20,6 +20,7 @@ import logging import time import traceback import sys +import os import gtk @@ -61,9 +62,9 @@ def get_icon_name(jobject): except: logging.warning('Could not read bundle:\n' + \ ''.join(traceback.format_exception(*sys.exc_info()))) - return _get_icon_file_name('application-octet-stream') + file_name = _get_icon_file_name('application-octet-stream') - if jobject.metadata['activity']: + if not file_name and jobject.metadata['activity']: service_name = jobject.metadata['activity'] activity_info = activity.get_registry().get_activity(service_name) if activity_info: @@ -75,8 +76,8 @@ def get_icon_name(jobject): if icon_name: file_name = _get_icon_file_name(icon_name) - if not file_name: - return _get_icon_file_name('application-octet-stream') + if not file_name or not os.path.exists(file_name): + file_name = _get_icon_file_name('application-octet-stream') _icon_cache[cache_key] = file_name |