Hello community, here is the log from the commit of package system-config-printer checked in at Fri Oct 24 15:32:55 CEST 2008. -------- --- GNOME/system-config-printer/system-config-printer.changes 2008-10-17 19:22:45.000000000 +0200 +++ /mounts/work_src_done/STABLE/system-config-printer/system-config-printer.changes 2008-10-24 00:17:34.000000000 +0200 @@ -1,0 +2,8 @@ +Fri Oct 24 00:11:17 CEST 2008 - vuntz@novell.com + +- Add system-config-printer-cups-autoconfig-notifications.patch. + We display notifications for printers automatically configured + by cups-autoconfig. This is the missing piece for dropping + gnome-volume-manager. + +------------------------------------------------------------------- calling whatdependson for head-i586 New: ---- system-config-printer-cups-autoconfig-notifications.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ system-config-printer.spec ++++++ --- /var/tmp/diff_new_pack.l21117/_old 2008-10-24 15:32:49.000000000 +0200 +++ /var/tmp/diff_new_pack.l21117/_new 2008-10-24 15:32:49.000000000 +0200 @@ -22,7 +22,7 @@ License: GPL v2 or later Group: Hardware/Printing Version: 1.0.8 -Release: 1 +Release: 2 %define pycups_version 1.9.42 %define pysmbc_version 1.0.5 %define cups_pk_helper_version 0.0.1 @@ -40,11 +40,14 @@ Patch2: system-config-printer-git1.0.x-po.patch Patch10: system-config-printer-install-python.patch Patch11: system-config-printer-python-prefix.patch +# PATCH-FIX-UPSTREAM system-config-printer-remove-redhat-base.patch vuntz@novell.com -- remove Red Hat specific things. Sent upstream, and applied to the master branch. Patch12: system-config-printer-remove-redhat-base.patch # PATCH-FIX-OPENSUSE system-config-printer-icon-brp-friendly.patch vuntz@novell.com -- brp checks don't like the printer icon name, so we have to use something else Patch13: system-config-printer-icon-brp-friendly.patch # PATCH-FEATURE-OPENSUSE system-config-printer-policykit.patch vuntz@novell.com -- Make s-c-p PolicyKit-aware Patch15: system-config-printer-policykit.patch +# PATCH-FIX-OPENSUSE system-config-printer-cups-autoconfig-notifications.patch vuntz@novell.com -- Integration with cups-autoconfig. This will be removed after 11.1, since we'll move to hal-cups-utils. +Patch16: system-config-printer-cups-autoconfig-notifications.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build # For cups-pk-helper: BuildRequires: PolicyKit-devel @@ -99,6 +102,7 @@ %patch12 -p1 %patch13 -p1 %patch15 -p1 +%patch16 -p1 %build autoreconf -f -i @@ -171,6 +175,11 @@ %files lang -f %{name}.lang %changelog +* Fri Oct 24 2008 vuntz@novell.com +- Add system-config-printer-cups-autoconfig-notifications.patch. + We display notifications for printers automatically configured + by cups-autoconfig. This is the missing piece for dropping + gnome-volume-manager. * Fri Oct 17 2008 vuntz@novell.com - Update to version 1.0.8: + Handle IPP_FORBIDDEN. ++++++ system-config-printer-cups-autoconfig-notifications.patch ++++++ diff --git a/applet.py b/applet.py index 8cb90ab..1b27654 100644 --- a/applet.py +++ b/applet.py @@ -220,6 +220,101 @@ class NewPrinterNotification(dbus.service.Object): return False +#### +#### Integration with cups-autoconfig +#### +#### Based on code from http://redclay.altervista.org/wiki/doku.php?id=projects:hal-automount + +class NewPrinterNotificationCupsAutoconfig: + + def __init__ (self, bus): + self.bus = bus + self.bus.add_signal_receiver(self.device_added, + 'DeviceAdded', + 'org.freedesktop.Hal.Manager', + 'org.freedesktop.Hal', + '/org/freedesktop/Hal/Manager') + + def udi_to_device (self, udi): + device_obj = self.bus.get_object('org.freedesktop.Hal', udi) + return dbus.Interface (device_obj, 'org.freedesktop.Hal.Device') + + def device_added (self, udi): + try: + properties = self.udi_to_device(udi).GetAllProperties() + capabilities = properties.get('info.capabilities') + if not capabilities: + return + + for capability in capabilities: + if capability == u'printer': + self.printer_added (udi, properties) + break + + except Exception, e: + print >> sys.stderr, "Error in cups-autoconfig integration: %s" % e + + def printer_added (self, udi, properties): + if properties.get('printer.configured_existing'): + return + + if properties.get('printer.configured'): + title = _("Printer added") + name = properties.get('printer.display_name') + text = _("`%s' is ready for printing.") % name + + n = pynotify.Notification (title, text, 'printer') + n.set_urgency (pynotify.URGENCY_NORMAL) + n.add_action ("configure", _("Configure"), + lambda x, y: self.configure (x, y, name)) + + else: + title = _("Printer plugged") + text = _("The printer could not be automatically configured.") % name + + n = pynotify.Notification (title, text, 'printer') + n.set_urgency (pynotify.URGENCY_NORMAL) + n.add_action ("configure", _("Configure"), + lambda x, y: self.launch (x, y)) + + n.show () + + def configure (self, notification, action, name): + self.run_config_tool (["--configure-printer", name]) + + def launch (self, notification, action): + self.run_config_tool ([]) + + def run_config_tool (self, argv): + import os + pid = os.fork () + if pid == 0: + # Child. + cmd = "/usr/bin/system-config-printer" + argv.insert (0, cmd) + os.execvp (cmd, argv) + sys.exit (1) + elif pid == -1: + print "Error forking process" + else: + gobject.timeout_add (60 * 1000, self.collect_exit_code, pid) + + def collect_exit_code (self, pid): + # We do this with timers instead of signals because we already + # have gobject imported, but don't (yet) import signal; + # let's try not to inflate the process size. + import os + try: + print "Waiting for child %d" % pid + (pid, status) = os.waitpid (pid, os.WNOHANG) + if pid == 0: + # Run this timer again. + return True + except OSError: + pass + + return False + PROGRAM_NAME="system-config-printer-applet" def show_help (): print "usage: %s [--no-tray-icon]" % PROGRAM_NAME @@ -303,6 +398,17 @@ if __name__ == '__main__': except: pass + try: + NewPrinterNotificationCupsAutoconfig(bus) + service_running = True + except: + try: + print >> sys.stderr, \ + "%s: failed to start NewPrinterNotificationCupsAutoconfig service" % \ + PROGRAM_NAME + except: + pass + if trayicon and get_debugging () == False: # Start off just waiting for print jobs. def any_jobs (): ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org