Better behaviour when trying to run without valid DISPLAY (bug # #948240).

This commit is contained in:
Tim Waugh 2013-04-11 15:34:16 +01:00
parent 27a6843167
commit bd10e083c9
2 changed files with 64 additions and 1 deletions

View File

@ -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 <twaugh@redhat.com>
## 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 <twaugh@redhat.com>
@@ -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."

View File

@ -1,12 +1,13 @@
Summary: A printer administration tool Summary: A printer administration tool
Name: system-config-printer Name: system-config-printer
Version: 1.4.0 Version: 1.4.0
Release: 1%{?dist} Release: 2%{?dist}
License: GPLv2+ License: GPLv2+
URL: http://cyberelk.net/tim/software/system-config-printer/ URL: http://cyberelk.net/tim/software/system-config-printer/
Group: System Environment/Base Group: System Environment/Base
Source0: http://cyberelk.net/tim/data/system-config-printer/1.3/%{name}-%{version}.tar.xz Source0: http://cyberelk.net/tim/data/system-config-printer/1.3/%{name}-%{version}.tar.xz
Patch1: system-config-printer-no-applet-in-gnome.patch Patch1: system-config-printer-no-applet-in-gnome.patch
Patch2: system-config-printer-DISPLAY.patch
BuildRequires: cups-devel >= 1.2 BuildRequires: cups-devel >= 1.2
BuildRequires: desktop-file-utils >= 0.2.92 BuildRequires: desktop-file-utils >= 0.2.92
@ -65,6 +66,9 @@ printers.
# Don't start the applet in GNOME. # Don't start the applet in GNOME.
%patch1 -p1 -b .no-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 %build
%configure --with-udev-rules %configure --with-udev-rules
@ -164,6 +168,9 @@ touch %buildroot%{_localstatedir}/run/udev-configure-printer/usb-uris
exit 0 exit 0
%changelog %changelog
* Thu Apr 11 2013 Tim Waugh <twaugh@redhat.com> 1.4.0-2
- Better behaviour when trying to run without valid DISPLAY (bug # #948240).
* Wed Mar 27 2013 Tim Waugh <twaugh@redhat.com> 1.4.0-1 * Wed Mar 27 2013 Tim Waugh <twaugh@redhat.com> 1.4.0-1
- 1.4.0. - 1.4.0.