- Avoid showing the publish-printers dialog when not necessary.

This commit is contained in:
Tim Waugh 2009-09-18 12:52:16 +00:00
parent 802889fcc9
commit 73e653a8fd
2 changed files with 34 additions and 0 deletions

View File

@ -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

View File

@ -17,6 +17,7 @@ Source2: http://cyberelk.net/tim/data/pysmbc/pysmbc-%{pysmbc_version}.tar.bz2
Patch1: system-config-printer-data-button-state.patch Patch1: system-config-printer-data-button-state.patch
Patch2: system-config-printer-cancel-traceback.patch Patch2: system-config-printer-cancel-traceback.patch
Patch3: system-config-printer-publish-printers.patch
BuildRequires: cups-devel >= 1.2 BuildRequires: cups-devel >= 1.2
BuildRequires: python-devel >= 2.4 BuildRequires: python-devel >= 2.4
@ -79,6 +80,7 @@ printers.
%setup -q -a 1 -a 2 %setup -q -a 1 -a 2
%patch1 -p1 -b .data-button-state %patch1 -p1 -b .data-button-state
%patch2 -p1 -b .cancel-traceback %patch2 -p1 -b .cancel-traceback
%patch3 -p1 -b .publish-printers
%build %build
%configure --with-udev-rules --with-polkit-1 %configure --with-udev-rules --with-polkit-1
@ -191,6 +193,7 @@ exit 0
%changelog %changelog
* Fri Sep 18 2009 Tim Waugh <twaugh@redhat.com> 1.1.13-2 * Fri Sep 18 2009 Tim Waugh <twaugh@redhat.com> 1.1.13-2
- Avoid showing the publish-printers dialog when not necessary.
- Fixed traceback when cancelling change-driver dialog. - Fixed traceback when cancelling change-driver dialog.
- Fixed data button state. - Fixed data button state.