- Fixed race when fetching device list (bug #521110).

This commit is contained in:
Tim Waugh 2009-09-22 09:30:05 +00:00
parent 7199e92748
commit d183d67e88
2 changed files with 57 additions and 1 deletions

View File

@ -0,0 +1,51 @@
diff -up system-config-printer-1.1.13/system-config-printer.py.fetchdevices system-config-printer-1.1.13/system-config-printer.py
--- system-config-printer-1.1.13/system-config-printer.py.fetchdevices 2009-09-22 10:08:54.062669053 +0100
+++ system-config-printer-1.1.13/system-config-printer.py 2009-09-22 10:10:12.138669093 +0100
@@ -3855,9 +3855,7 @@ class NewPrinterGUI(GtkGUI):
self.fillDeviceTab()
self.rbtnNPFoomatic.set_active (True)
self.on_rbtnNPFoomatic_toggled(self.rbtnNPFoomatic)
- # Start fetching information from CUPS in the background
self.new_printer_PPDs_loaded = False
- self.queryPPDs ()
elif self.dialog_mode == "class":
self.NewPrinterWindow.set_title(_("New Class"))
@@ -4648,16 +4646,18 @@ class NewPrinterGUI(GtkGUI):
debugprint ("fetchDevices")
have_polkit_1 = self.mainapp.cups._use_pk and config.WITH_POLKIT_1
- if not have_polkit_1:
- if network:
- return {}
-
- network = True
-
network_schemes = ["dnssd", "snmp"]
try:
- c = authconn.Connection (host=self.mainapp.connect_server,
- parent=parent, lock=True)
+ try:
+ c = self.fetchDevices_conn
+ except AttributeError:
+ c = authconn.Connection (host=self.mainapp.connect_server,
+ parent=parent, lock=True)
+ if not have_polkit_1:
+ # Use this connection for future calls so that the
+ # username/password is cached.
+ self.fetchDevices_conn = c
+
debugprint ("in get_devices: connected")
c._begin_operation (_("fetching device list"))
try:
@@ -5049,6 +5049,10 @@ class NewPrinterGUI(GtkGUI):
kwargs={"network": True},
callback=self.got_devices,
context=context)
+ else:
+ # Now we've fetched both local and network devices, start
+ # querying the available PPDs.
+ gobject.timeout_add (1, self.queryPPDs)
devices = result
if current_uri:

View File

@ -7,7 +7,7 @@
Summary: A printer administration tool Summary: A printer administration tool
Name: system-config-printer Name: system-config-printer
Version: 1.1.13 Version: 1.1.13
Release: 2%{?dist} Release: 3%{?dist}
License: GPLv2+ License: GPLv2+
URL: http://cyberelk.net/tim/software/system-config-printer/ URL: http://cyberelk.net/tim/software/system-config-printer/
Group: System Environment/Base Group: System Environment/Base
@ -19,6 +19,7 @@ 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 Patch3: system-config-printer-publish-printers.patch
Patch4: system-config-printer-iconify.patch Patch4: system-config-printer-iconify.patch
Patch5: system-config-printer-fetchdevices.patch
BuildRequires: cups-devel >= 1.2 BuildRequires: cups-devel >= 1.2
BuildRequires: python-devel >= 2.4 BuildRequires: python-devel >= 2.4
@ -83,6 +84,7 @@ printers.
%patch2 -p1 -b .cancel-traceback %patch2 -p1 -b .cancel-traceback
%patch3 -p1 -b .publish-printers %patch3 -p1 -b .publish-printers
%patch4 -p1 -b .iconify %patch4 -p1 -b .iconify
%patch5 -p1 -b .fetchdevices
%build %build
%configure --with-udev-rules --with-polkit-1 %configure --with-udev-rules --with-polkit-1
@ -194,6 +196,9 @@ rm -rf %buildroot
exit 0 exit 0
%changelog %changelog
* Tue Sep 22 2009 Tim Waugh <twaugh@redhat.com> 1.1.13-3
- Fixed race when fetching device list (bug #521110).
* 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
- Iconify jobs window into status icon. - Iconify jobs window into status icon.
- Avoid showing the publish-printers dialog when not necessary. - Avoid showing the publish-printers dialog when not necessary.