From bd10e083c9c47a2ae1c7040f6211d98e6c538804 Mon Sep 17 00:00:00 2001 From: Tim Waugh Date: Apr 11 2013 14:34:16 +0000 Subject: Better behaviour when trying to run without valid DISPLAY (bug # #948240). --- diff --git a/system-config-printer-DISPLAY.patch b/system-config-printer-DISPLAY.patch new file mode 100644 index 0000000..88d9192 --- /dev/null +++ b/system-config-printer-DISPLAY.patch @@ -0,0 +1,56 @@ +diff -up system-config-printer-1.4.0/applet.py.DISPLAY system-config-printer-1.4.0/applet.py +--- system-config-printer-1.4.0/applet.py.DISPLAY 2013-03-27 12:19:07.000000000 +0000 ++++ system-config-printer-1.4.0/applet.py 2013-04-11 15:33:03.102010436 +0100 +@@ -1,6 +1,6 @@ + #!/usr/bin/python + +-## Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 Red Hat, Inc. ++## Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Red Hat, Inc. + ## Author: Tim Waugh + + ## This program is free software; you can redistribute it and/or modify +@@ -41,12 +41,7 @@ except locale.Error, e: + os.environ['LC_ALL'] = 'C' + locale.setlocale (locale.LC_ALL, "") + +-try: +- from gi.repository import Notify +-except RuntimeError, e: +- print "%s:" % DOMAIN, e +- print "This is a graphical application and requires DISPLAY to be set." +- sys.exit (1) ++from gi.repository import Notify + + APPDIR="/usr/share/system-config-printer" + ICON="printer" +diff -up system-config-printer-1.4.0/scp-dbus-service.py.DISPLAY system-config-printer-1.4.0/scp-dbus-service.py +--- system-config-printer-1.4.0/scp-dbus-service.py.DISPLAY 2013-03-27 12:19:08.000000000 +0000 ++++ system-config-printer-1.4.0/scp-dbus-service.py 2013-04-11 15:33:03.102010436 +0100 +@@ -2,7 +2,7 @@ + + ## system-config-printer + +-## Copyright (C) 2010, 2011, 2012 Red Hat, Inc. ++## Copyright (C) 2010, 2011, 2012, 2013 Red Hat, Inc. + ## Authors: + ## Tim Waugh + +@@ -531,6 +531,7 @@ if __name__ == '__main__': + _client_demo () + sys.exit (0) + ++ Gtk.init (sys.argv) + debugprint ("Service running...") + loop = GObject.MainLoop () + g_killtimer = KillTimer (killfunc=loop.quit) +diff -up system-config-printer-1.4.0/system-config-printer.py.DISPLAY system-config-printer-1.4.0/system-config-printer.py +--- system-config-printer-1.4.0/system-config-printer.py.DISPLAY 2013-03-27 12:19:08.000000000 +0000 ++++ system-config-printer-1.4.0/system-config-printer.py 2013-04-11 15:33:03.103010439 +0100 +@@ -31,6 +31,7 @@ from gi.repository import GdkPixbuf + try: + from gi.repository import Gdk + from gi.repository import Gtk ++ Gtk.init (sys.argv) + except RuntimeError, e: + print "system-config-printer:", e + print "This is a graphical application and requires DISPLAY to be set." diff --git a/system-config-printer.spec b/system-config-printer.spec index 7e72883..89ed44b 100644 --- a/system-config-printer.spec +++ b/system-config-printer.spec @@ -1,12 +1,13 @@ Summary: A printer administration tool Name: system-config-printer Version: 1.4.0 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2+ URL: http://cyberelk.net/tim/software/system-config-printer/ Group: System Environment/Base Source0: http://cyberelk.net/tim/data/system-config-printer/1.3/%{name}-%{version}.tar.xz Patch1: system-config-printer-no-applet-in-gnome.patch +Patch2: system-config-printer-DISPLAY.patch BuildRequires: cups-devel >= 1.2 BuildRequires: desktop-file-utils >= 0.2.92 @@ -65,6 +66,9 @@ printers. # Don't start the applet in GNOME. %patch1 -p1 -b .no-applet-in-gnome +# Better behaviour when trying to run without valid DISPLAY (bug # #948240). +%patch2 -p1 -b .DISPLAY + %build %configure --with-udev-rules @@ -164,6 +168,9 @@ touch %buildroot%{_localstatedir}/run/udev-configure-printer/usb-uris exit 0 %changelog +* Thu Apr 11 2013 Tim Waugh 1.4.0-2 +- Better behaviour when trying to run without valid DISPLAY (bug # #948240). + * Wed Mar 27 2013 Tim Waugh 1.4.0-1 - 1.4.0.