From 73e653a8fded62dd081b4285f6639104d99b5ccd Mon Sep 17 00:00:00 2001 From: Tim Waugh Date: Fri, 18 Sep 2009 12:52:16 +0000 Subject: [PATCH] - Avoid showing the publish-printers dialog when not necessary. --- system-config-printer-publish-printers.patch | 31 ++++++++++++++++++++ system-config-printer.spec | 3 ++ 2 files changed, 34 insertions(+) create mode 100644 system-config-printer-publish-printers.patch diff --git a/system-config-printer-publish-printers.patch b/system-config-printer-publish-printers.patch new file mode 100644 index 0000000..fb070ee --- /dev/null +++ b/system-config-printer-publish-printers.patch @@ -0,0 +1,31 @@ +diff -up system-config-printer-1.1.13/system-config-printer.py.publish-printers system-config-printer-1.1.13/system-config-printer.py +--- system-config-printer-1.1.13/system-config-printer.py.publish-printers 2009-09-18 13:44:41.680437056 +0100 ++++ system-config-printer-1.1.13/system-config-printer.py 2009-09-18 13:45:30.704315256 +0100 +@@ -220,7 +220,7 @@ class GUI(GtkGUI, monitor.Watcher): + self.changed = set() # of options + + self.servers = set((self.connect_server,)) +- self.server_is_publishing = False ++ self.server_is_publishing = None # not known + self.devid = devid + self.focus_on_map = focus_on_map + +@@ -3158,6 +3158,18 @@ class GUI(GtkGUI, monitor.Watcher): + self.cups._end_operation () + + if success and share: ++ if self.server_is_publishing == None: ++ # We haven't yet seen a server-is-sharing-printers attribute. ++ # Assuming CUPS 1.4, this means we haven't opened a ++ # properties dialog yet. Fetch the attributes now and ++ # look for it. ++ try: ++ printer.getAttributes () ++ p = printer.other_attributes['server-is-sharing-printers'] ++ self.server_is_publishing = p ++ except (cups.IPPError, KeyError): ++ pass ++ + self.advise_publish () + + # For some reason CUPS doesn't give us a notification about diff --git a/system-config-printer.spec b/system-config-printer.spec index 4e76b48..01c961b 100644 --- a/system-config-printer.spec +++ b/system-config-printer.spec @@ -17,6 +17,7 @@ Source2: http://cyberelk.net/tim/data/pysmbc/pysmbc-%{pysmbc_version}.tar.bz2 Patch1: system-config-printer-data-button-state.patch Patch2: system-config-printer-cancel-traceback.patch +Patch3: system-config-printer-publish-printers.patch BuildRequires: cups-devel >= 1.2 BuildRequires: python-devel >= 2.4 @@ -79,6 +80,7 @@ printers. %setup -q -a 1 -a 2 %patch1 -p1 -b .data-button-state %patch2 -p1 -b .cancel-traceback +%patch3 -p1 -b .publish-printers %build %configure --with-udev-rules --with-polkit-1 @@ -191,6 +193,7 @@ exit 0 %changelog * Fri Sep 18 2009 Tim Waugh 1.1.13-2 +- Avoid showing the publish-printers dialog when not necessary. - Fixed traceback when cancelling change-driver dialog. - Fixed data button state.