rpms/system-config-printer/F-10 system-config-printer-icon-load-traceback.patch, NONE, 1.1 system-config-printer.spec, 1.246, 1.247

Tim Waugh twaugh at fedoraproject.org
Wed Aug 26 16:54:05 UTC 2009


Author: twaugh

Update of /cvs/pkgs/rpms/system-config-printer/F-10
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv27922

Modified Files:
	system-config-printer.spec 
Added Files:
	system-config-printer-icon-load-traceback.patch 
Log Message:
* Wed Aug 26 2009 Tim Waugh <twaugh at redhat.com> 1.1.12-4
- Handle icon load failure gracefully.


system-config-printer-icon-load-traceback.patch:
 jobviewer.py             |   26 ++++++++++++++------------
 system-config-printer.py |   44 +++++++++++++++++++++++++-------------------
 2 files changed, 39 insertions(+), 31 deletions(-)

--- NEW FILE system-config-printer-icon-load-traceback.patch ---
diff -up system-config-printer-1.1.12/jobviewer.py.icon-load-traceback system-config-printer-1.1.12/jobviewer.py
--- system-config-printer-1.1.12/jobviewer.py.icon-load-traceback	2009-08-25 17:01:27.000000000 +0100
+++ system-config-printer-1.1.12/jobviewer.py	2009-08-26 17:46:06.744314174 +0100
@@ -1033,18 +1033,20 @@ class JobViewer (GtkGUI, monitor.Watcher
                 # Add an emblem to the icon.
                 icon = StateReason.LEVEL_ICON[level]
                 pixbuf = pixbuf.copy ()
-                theme = gtk.icon_theme_get_default ()
-
-                emblem = theme.load_icon (icon, 22, 0)
-                emblem.composite (pixbuf,
-                                  pixbuf.get_width () / 2,
-                                  pixbuf.get_height () / 2,
-                                  emblem.get_width () / 2,
-                                  emblem.get_height () / 2,
-                                  pixbuf.get_width () / 2,
-                                  pixbuf.get_height () / 2,
-                                  0.5, 0.5,
-                                  gtk.gdk.INTERP_BILINEAR, 255)
+                try:
+                    theme = gtk.icon_theme_get_default ()
+                    emblem = theme.load_icon (icon, 22, 0)
+                    emblem.composite (pixbuf,
+                                      pixbuf.get_width () / 2,
+                                      pixbuf.get_height () / 2,
+                                      emblem.get_width () / 2,
+                                      emblem.get_height () / 2,
+                                      pixbuf.get_width () / 2,
+                                      pixbuf.get_height () / 2,
+                                      0.5, 0.5,
+                                      gtk.gdk.INTERP_BILINEAR, 255)
+                except gobject.GError:
+                    debugprint ("No %s icon available" % icon)
 
         return pixbuf
 
diff -up system-config-printer-1.1.12/system-config-printer.py.icon-load-traceback system-config-printer-1.1.12/system-config-printer.py
--- system-config-printer-1.1.12/system-config-printer.py.icon-load-traceback	2009-08-26 17:45:45.471190754 +0100
+++ system-config-printer-1.1.12/system-config-printer.py	2009-08-26 17:46:06.753314108 +0100
@@ -1469,28 +1469,34 @@ class GUI(GtkGUI, monitor.Watcher):
 
                 if def_emblem:
                     (w, h) = gtk.icon_size_lookup (gtk.ICON_SIZE_DIALOG)
-                    default_emblem = theme.load_icon (def_emblem, w/2, 0)
-                    copy = pixbuf.copy ()
-                    default_emblem.composite (copy, 0, 0,
-                                              copy.get_width (),
-                                              copy.get_height (),
-                                              0, 0,
-                                              1.0, 1.0,
-                                              gtk.gdk.INTERP_NEAREST, 255)
-                    pixbuf = copy
+                    try:
+                        default_emblem = theme.load_icon (def_emblem, w/2, 0)
+                        copy = pixbuf.copy ()
+                        default_emblem.composite (copy, 0, 0,
+                                                  copy.get_width (),
+                                                  copy.get_height (),
+                                                  0, 0,
+                                                  1.0, 1.0,
+                                                  gtk.gdk.INTERP_NEAREST, 255)
+                        pixbuf = copy
+                    except gobject.GError:
+                        debugprint ("No %s icon available" % def_emblem)
 
                 if emblem:
                     (w, h) = gtk.icon_size_lookup (gtk.ICON_SIZE_DIALOG)
-                    other_emblem = theme.load_icon (emblem, w/2, 0)
-                    copy = pixbuf.copy ()
-                    other_emblem.composite (copy, 0, 0,
-                                            copy.get_width (),
-                                            copy.get_height (),
-                                            copy.get_width () / 2,
-                                            copy.get_height () / 2,
-                                            1.0, 1.0,
-                                            gtk.gdk.INTERP_NEAREST, 255)
-                    pixbuf = copy
+                    try:
+                        other_emblem = theme.load_icon (emblem, w/2, 0)
+                        copy = pixbuf.copy ()
+                        other_emblem.composite (copy, 0, 0,
+                                                copy.get_width (),
+                                                copy.get_height (),
+                                                copy.get_width () / 2,
+                                                copy.get_height () / 2,
+                                                1.0, 1.0,
+                                                gtk.gdk.INTERP_NEAREST, 255)
+                        pixbuf = copy
+                    except gobject.GError:
+                        debugprint ("No %s icon available" % emblem)
 
                 self.mainlist.append (row=[object, pixbuf, name, tip])
 


Index: system-config-printer.spec
===================================================================
RCS file: /cvs/pkgs/rpms/system-config-printer/F-10/system-config-printer.spec,v
retrieving revision 1.246
retrieving revision 1.247
diff -u -p -r1.246 -r1.247
--- system-config-printer.spec	26 Aug 2009 16:52:14 -0000	1.246
+++ system-config-printer.spec	26 Aug 2009 16:54:05 -0000	1.247
@@ -16,6 +16,7 @@ Source1: http://cyberelk.net/tim/data/py
 Source2: http://cyberelk.net/tim/data/pysmbc/pysmbc-%{pysmbc_version}.tar.bz2
 Patch1: system-config-printer-get_cursor.patch
 Patch2: system-config-printer-statereason-icons.patch
+Patch3: system-config-printer-icon-load-traceback.patch
 
 BuildRequires: cups-devel >= 1.2
 BuildRequires: python-devel >= 2.4
@@ -66,6 +67,7 @@ the configuration tool.
 %setup -q -a 1 -a 2
 %patch1 -p1 -b .get_cursor
 %patch2 -p1 -b .statereason-icons
+%patch3 -p1 -b .icon-load-traceback
 
 %build
 %configure
@@ -168,6 +170,7 @@ exit 0
 
 %changelog
 * Wed Aug 26 2009 Tim Waugh <twaugh at redhat.com> 1.1.12-4
+- Handle icon load failure gracefully.
 - Fixed statereason icon names.
 
 * Wed Aug 26 2009 Tim Waugh <twaugh at redhat.com> 1.1.12-3




More information about the fedora-extras-commits mailing list