[alacarte] util: Don't fail when loading non-existant icon paths
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [alacarte] util: Don't fail when loading non-existant icon paths
- Date: Wed, 20 Jun 2012 23:01:41 +0000 (UTC)
commit 45083e538491363db9c972a43240c453965f7274
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Tue Jun 19 15:11:20 2012 -0400
util: Don't fail when loading non-existant icon paths
Alacarte/util.py | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/Alacarte/util.py b/Alacarte/util.py
index 93c2372..50d836d 100644
--- a/Alacarte/util.py
+++ b/Alacarte/util.py
@@ -21,6 +21,9 @@ import xml.dom.minidom
from collections import Sequence
from gi.repository import Gtk, GdkPixbuf, GMenu, GLib
+# XXX: look into pygobject error marshalling
+from gi._glib import GError
+
DESKTOP_GROUP = GLib.KEY_FILE_DESKTOP_GROUP
KEY_FILE_FLAGS = GLib.KeyFileFlags.KEEP_COMMENTS | GLib.KeyFileFlags.KEEP_TRANSLATIONS
@@ -148,7 +151,10 @@ def getIcon(item):
info = icon_theme.lookup_by_gicon(gicon, 24, 0)
if info is None:
return None
- pixbuf = info.load_icon()
+ try:
+ pixbuf = info.load_icon()
+ except GError:
+ return None
if pixbuf is None:
return None
if pixbuf.get_width() != 24 or pixbuf.get_height() != 24:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]