From acaff656d75df3018bbcacb9a9609b92d52c7bd2 Mon Sep 17 00:00:00 2001 From: Tim Waugh Date: Fri, 3 Jul 2009 17:31:46 +0000 Subject: [PATCH] - Use gpk-install-package-name instead of trying to use the D-Bus API. - Spot stopped jobs with CUPS 1.4 as well (trac #177). This, along with the previous fix, addresses bug #509177. - Map gutenprint filenames to the package name. - Fixed sensitivity of class member selection arrows (bug #508653). --- system-config-printer-arrows.patch | 79 ++++++++++++++++++++++++ system-config-printer-gutenprint.patch | 14 +++++ system-config-printer-packagekit.patch | 77 +++++++++++++++++++++++ system-config-printer-stopped-jobs.patch | 15 +++++ system-config-printer.spec | 17 ++++- 5 files changed, 201 insertions(+), 1 deletion(-) create mode 100644 system-config-printer-arrows.patch create mode 100644 system-config-printer-gutenprint.patch create mode 100644 system-config-printer-packagekit.patch create mode 100644 system-config-printer-stopped-jobs.patch diff --git a/system-config-printer-arrows.patch b/system-config-printer-arrows.patch new file mode 100644 index 0000000..d04e80f --- /dev/null +++ b/system-config-printer-arrows.patch @@ -0,0 +1,79 @@ +diff -up system-config-printer-1.1.8/glade/NewPrinterWindow.glade.arrows system-config-printer-1.1.8/glade/NewPrinterWindow.glade +--- system-config-printer-1.1.8/glade/NewPrinterWindow.glade.arrows 2009-06-03 09:20:26.000000000 +0100 ++++ system-config-printer-1.1.8/glade/NewPrinterWindow.glade 2009-07-03 18:18:50.640997051 +0100 +@@ -3662,6 +3662,7 @@ DTR/DSR (Hardware) + False + False + False ++ + + + +@@ -3693,6 +3694,7 @@ DTR/DSR (Hardware) + + + True ++ False + True + True + GTK_RELIEF_NORMAL +@@ -3771,6 +3773,7 @@ DTR/DSR (Hardware) + + + True ++ False + True + True + GTK_RELIEF_NORMAL +@@ -3823,6 +3826,7 @@ DTR/DSR (Hardware) + False + False + False ++ + + + +diff -up system-config-printer-1.1.8/system-config-printer.py.arrows system-config-printer-1.1.8/system-config-printer.py +--- system-config-printer-1.1.8/system-config-printer.py.arrows 2009-07-03 18:18:36.478996538 +0100 ++++ system-config-printer-1.1.8/system-config-printer.py 2009-07-03 18:18:50.643996718 +0100 +@@ -174,7 +174,6 @@ def moveClassMembers(treeview_from, tree + for row in rows: + path = row.get_path() + iter = model_from.get_iter(path) +- + row_data = model_from.get(iter, 0) + model_to.append(row_data) + model_from.remove(iter) +@@ -3547,6 +3546,8 @@ class NewPrinterGUI(GtkGUI): + "entNPTDevice", + "tvNCMembers", + "tvNCNotMembers", ++ "btnNCAddMember", ++ "btnNCDelMember", + "ntbkPPDSource", + "rbtnNPPPD", + "tvNPMakes", +@@ -4089,11 +4090,23 @@ class NewPrinterGUI(GtkGUI): + moveClassMembers(self.tvNCNotMembers, self.tvNCMembers) + self.btnNPApply.set_sensitive( + bool(getCurrentClassMembers(self.tvNCMembers))) ++ button.set_sensitive(False) + + def on_btnNCDelMember_clicked(self, button): + moveClassMembers(self.tvNCMembers, self.tvNCNotMembers) + self.btnNPApply.set_sensitive( + bool(getCurrentClassMembers(self.tvNCMembers))) ++ button.set_sensitive(False) ++ ++ def on_tvNCMembers_cursor_changed(self, widget): ++ selection = widget.get_selection() ++ model_from, rows = selection.get_selected_rows() ++ self.btnNCDelMember.set_sensitive(rows != []) ++ ++ def on_tvNCNotMembers_cursor_changed(self, widget): ++ selection = widget.get_selection() ++ model_from, rows = selection.get_selected_rows() ++ self.btnNCAddMember.set_sensitive(rows != []) + + # Navigation buttons + diff --git a/system-config-printer-gutenprint.patch b/system-config-printer-gutenprint.patch new file mode 100644 index 0000000..f3f35ad --- /dev/null +++ b/system-config-printer-gutenprint.patch @@ -0,0 +1,14 @@ +diff -up system-config-printer-1.1.8/cupshelpers/cupshelpers.py.gutenprint system-config-printer-1.1.8/cupshelpers/cupshelpers.py +--- system-config-printer-1.1.8/cupshelpers/cupshelpers.py.gutenprint 2009-06-17 18:39:51.000000000 +0100 ++++ system-config-printer-1.1.8/cupshelpers/cupshelpers.py 2009-07-03 18:09:03.598995561 +0100 +@@ -736,8 +736,10 @@ def missingPackagesAndExecutables(ppd): + # IJS servers (used by foomatic) + 'hpijs': 'hpijs', + 'ijsgutenprint.5.0': 'gutenprint', ++ 'ijsgutenprint.5.2': 'gutenprint', + # CUPS filters + 'rastertogutenprint.5.0': 'gutenprint-cups', ++ 'rastertogutenprint.5.2': 'gutenprint-cups', + 'commandtoepson': 'gutenprint-cups', + 'commandtocanon': 'gutenprint-cups', + } diff --git a/system-config-printer-packagekit.patch b/system-config-printer-packagekit.patch new file mode 100644 index 0000000..9ba4fc8 --- /dev/null +++ b/system-config-printer-packagekit.patch @@ -0,0 +1,77 @@ +diff -up system-config-printer-1.1.8/installpackage.py.packagekit system-config-printer-1.1.8/installpackage.py +--- system-config-printer-1.1.8/installpackage.py.packagekit 2009-05-12 10:36:36.000000000 +0100 ++++ system-config-printer-1.1.8/installpackage.py 2009-07-03 18:07:09.560995667 +0100 +@@ -2,8 +2,8 @@ + + ## system-config-printer + +-## Copyright (C) 2008 Red Hat, Inc. +-## Copyright (C) 2008 Tim Waugh ++## Copyright (C) 2008, 2009 Red Hat, Inc. ++## Copyright (C) 2008, 2009 Tim Waugh + + ## This program is free software; you can redistribute it and/or modify + ## it under the terms of the GNU General Public License as published by +@@ -19,53 +19,18 @@ + ## along with this program; if not, write to the Free Software + ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +-import dbus +-import xml.etree.ElementTree +-from dbus.mainloop.glib import DBusGMainLoop +-DBusGMainLoop (set_as_default=True) ++import os ++import glib + + class PackageKit: + def __init__ (self): +- bus = dbus.SessionBus () +- obj = bus.get_object ("org.freedesktop.PackageKit", +- "/org/freedesktop/PackageKit") +- +- # Find out which API is required. +- num_args = -1 +- introsp = dbus.Interface (obj, "org.freedesktop.DBus.Introspectable") +- api = introsp.Introspect () +- top = xml.etree.ElementTree.XML (api) +- for interface in top.findall ("interface"): +- if interface.attrib.get ("name") != "org.freedesktop.PackageKit": +- continue +- +- for method in interface.findall ("method"): +- if method.attrib.get ("name") != "InstallPackageName": +- continue ++ for dir in os.environ.get ("PATH", "").split (":"): ++ path = dir + os.path.sep + "gpk-install-package-name" ++ if os.access (path, os.X_OK): ++ self.gpk_install_package_name = path ++ return + +- num_args = len (method.findall ("arg")) +- break +- +- if num_args == -1: +- raise RuntimeError, "Introspection failed for PackageKit" +- +- self.proxy = dbus.Interface (obj, "org.freedesktop.PackageKit") +- self.num_args = num_args ++ raise RuntimeError, "No gpk-install-package-name program available" + + def InstallPackageName (self, xid, timestamp, name): +- proxy = self.proxy +- if self.num_args == 3: +- return proxy.InstallPackageName (xid, timestamp, name, +- reply_handler=self.reply_handler, +- error_handler=self.error_handler) +- else: +- # Old PackageKit interface +- return proxy.InstallPackageName (name, +- reply_handler=self.reply_handler, +- error_handler=self.error_handler) +- +- def reply_handler (self, *args): +- pass +- +- def error_handler (self, *args): +- pass ++ glib.spawn_async ([self.gpk_install_package_name, name]) diff --git a/system-config-printer-stopped-jobs.patch b/system-config-printer-stopped-jobs.patch new file mode 100644 index 0000000..a0e0c1f --- /dev/null +++ b/system-config-printer-stopped-jobs.patch @@ -0,0 +1,15 @@ +diff -up system-config-printer-1.1.8/jobviewer.py.stopped-jobs system-config-printer-1.1.8/jobviewer.py +--- system-config-printer-1.1.8/jobviewer.py.stopped-jobs 2009-06-17 18:39:51.000000000 +0100 ++++ system-config-printer-1.1.8/jobviewer.py 2009-07-03 18:08:28.040995881 +0100 +@@ -1375,7 +1375,10 @@ class JobViewer (GtkGUI, monitor.Watcher + self.notify_completed_job (jobid) + + # Look out for stopped jobs. +- if (self.trayicon and eventname == 'job-stopped' and ++ if (self.trayicon and ++ (eventname == 'job-stopped' or ++ (eventname == 'job-state-changed' and ++ event['job-state'] == cups.IPP_JOB_STOPPED))and + not jobid in self.stopped_job_prompts): + # Why has the job stopped? It might be due to a job error + # of some sort, or it might be that the backend requires diff --git a/system-config-printer.spec b/system-config-printer.spec index 7cf9dc4..6e5ab24 100644 --- a/system-config-printer.spec +++ b/system-config-printer.spec @@ -7,7 +7,7 @@ Summary: A printer administration tool Name: system-config-printer Version: 1.1.8 -Release: 3%{?dist} +Release: 5%{?dist} License: GPLv2+ URL: http://cyberelk.net/tim/software/system-config-printer/ Group: System Environment/Base @@ -21,6 +21,10 @@ Patch4: system-config-printer-remote-location-field.patch Patch5: system-config-printer-nmblookup-failure.patch Patch6: system-config-printer-properties-cancel.patch Patch7: system-config-printer-incorrect-auth.patch +Patch8: system-config-printer-packagekit.patch +Patch9: system-config-printer-stopped-jobs.patch +Patch10: system-config-printer-gutenprint.patch +Patch11: system-config-printer-arrows.patch BuildRequires: cups-devel >= 1.2 BuildRequires: python-devel >= 2.4 @@ -77,6 +81,10 @@ the configuration tool. %patch5 -p1 -b .nmblookup-failure %patch6 -p1 -b .properties-cancel %patch7 -p1 -b .incorrect-auth +%patch8 -p1 -b .packagekit +%patch9 -p1 -b .stopped-jobs +%patch10 -p1 -b .gutenprint +%patch11 -p1 -b .arrows %build %configure @@ -179,6 +187,13 @@ rm -rf %buildroot exit 0 %changelog +* Fri Jul 3 2009 Tim Waugh 1.1.8-5 +- Use gpk-install-package-name instead of trying to use the D-Bus API. +- Spot stopped jobs with CUPS 1.4 as well (trac #177). This, along + with the previous fix, addresses bug #509177. +- Map gutenprint filenames to the package name. +- Fixed sensitivity of class member selection arrows (bug #508653). + * Thu Jun 25 2009 Tim Waugh 1.1.8-3 - Use correct 'location' field for printers added remotely. - Parse nmblookup failures correctly in troubleshooter.