[alacarte] Use GLib.Error for catching errors



commit 2f2e0b0bac463f545f409c67f1a15f5bf672529f
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed Jan 16 10:55:43 2013 -0500

    Use GLib.Error for catching errors
    
    While gi._glib.GError works on my machine, it seems it's on track
    to be removed, or doesn't work on some PyGObject builds.

 Alacarte/ItemEditor.py |   10 ++++------
 Alacarte/util.py       |    5 +----
 2 files changed, 5 insertions(+), 10 deletions(-)
---
diff --git a/Alacarte/ItemEditor.py b/Alacarte/ItemEditor.py
index 83d6601..f9d709a 100644
--- a/Alacarte/ItemEditor.py
+++ b/Alacarte/ItemEditor.py
@@ -23,8 +23,6 @@ gi.require_version('Gtk', '3.0')
 from gi.repository import GLib, Gtk
 from Alacarte import config, util
 
-from gi._glib import GError
-
 _ = gettext.gettext
 
 EXTENSIONS = (".png", ".xpm", ".svg")
@@ -119,7 +117,7 @@ class ItemEditor(object):
     def set_text(self, ctl, name):
         try:
             val = self.keyfile.get_string(DESKTOP_GROUP, name)
-        except GError:
+        except GLib.GError:
             pass
         else:
             self.builder.get_object(ctl).set_text(val)
@@ -127,7 +125,7 @@ class ItemEditor(object):
     def set_check(self, ctl, name):
         try:
             val = self.keyfile.get_boolean(DESKTOP_GROUP, name)
-        except GError:
+        except GLib.GError:
             pass
         else:
             self.builder.get_object(ctl).set_active(val)
@@ -135,7 +133,7 @@ class ItemEditor(object):
     def set_icon(self, ctl, name):
         try:
             val = self.keyfile.get_string(DESKTOP_GROUP, name)
-        except GError:
+        except GLib.GError:
             pass
         else:
             set_icon_string(self.builder.get_object(ctl), val)
@@ -144,7 +142,7 @@ class ItemEditor(object):
         self.keyfile = GLib.KeyFile()
         try:
             self.keyfile.load_from_file(self.item_path, util.KEY_FILE_FLAGS)
-        except GError:
+        except GLib.GError:
             pass
 
     def save(self):
diff --git a/Alacarte/util.py b/Alacarte/util.py
index 2dbf963..2c35ca0 100644
--- a/Alacarte/util.py
+++ b/Alacarte/util.py
@@ -24,9 +24,6 @@ import gi
 gi.require_version('Gtk', '3.0')
 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
 
@@ -156,7 +153,7 @@ def getIcon(item):
         return None
     try:
         pixbuf = info.load_icon()
-    except GError:
+    except GLib.GError:
         return None
     if pixbuf is None:
         return None



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]