acaff656d7
- 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).
78 lines
3.1 KiB
Diff
78 lines
3.1 KiB
Diff
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 <twaugh@redhat.com>
|
|
+## Copyright (C) 2008, 2009 Red Hat, Inc.
|
|
+## Copyright (C) 2008, 2009 Tim Waugh <twaugh@redhat.com>
|
|
|
|
## 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])
|