File system-config-printer-git1.0.x.patch of Package system-config-printer

diff --git a/ChangeLog b/ChangeLog
index 8a93248..c0ebb7f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,97 @@
+2008-10-16  Tim Waugh  <twaugh@redhat.com>
+
+	* system-config-printer.py (GUI.save_printer): Prevent traceback
+	when printer has been deleted.
+	* system-config-printer.py (GUI.populateList): Cancel properties
+	dialog if the printer we're editing has been deleted.
+	Fixes Ubuntu #284444.
+
+2008-10-16  Tim Waugh  <twaugh@redhat.com>
+
+	* system-config-printer.py (GUI.__init__): Set the item width for
+	the icon view, for a nicer appearance.
+
+2008-10-16  Tim Waugh  <twaugh@redhat.com>
+
+	* debug.py (debugprint): Send debug output to stderr to work
+	around the samba bug (#5805) that closes stdout.
+
+2008-10-16  Tim Waugh  <twaugh@redhat.com>
+
+	* pysmb.py (AuthContext.perform_authentication): Fixed the SMB
+	authentication dialog's cancel button (bug #467127).
+
+2008-10-15  Tim Waugh  <twaugh@redhat.com>
+
+	* pysmb.py (AuthContext.perform_authentication): Don't destroy
+	authentication dialog until after we've fetched the details (bug
+	#464003).
+
+2008-10-15  Tim Waugh  <twaugh@redhat.com>
+
+	* pysmb.py: Import gettext.
+
+2008-10-15  Tim Waugh  <twaugh@redhat.com>
+
+	* smburi.py (SMBURI._construct): Don't construct URIs containing
+	"@/".
+
+2008-10-15  Tim Waugh  <twaugh@redhat.com>
+
+	* cupshelpers/ppds.py (PPDs.getInfoFromModel): Restrict URI in
+	debugging output.
+
+2008-10-15  Tim Waugh  <twaugh@redhat.com>
+
+	* pysmb.py (AuthContext.perform_authentication): Show an error
+	dialog if the password was incorrect (bug #465407).
+	* po/POTFILES.in: Translate pysmb.py (no new translatable
+	strings).
+
+2008-10-15  Tim Waugh  <twaugh@redhat.com>
+
+	* system-config-printer.py
+	(NewPrinterGUI.on_btnSMBVerify_clicked): Don't show an error
+	dialog if the SMB authentication dialog is cancelled by the
+	user (bug #465407).
+
+2008-10-15  Tim Waugh  <twaugh@redhat.com>
+
+	* print-applet.desktop.in (NotShowIn): Don't show the applet in
+	KDE, as that provides its own version (bug #466945).
+
+2008-10-10  Tim Waugh  <twaugh@redhat.com>
+
+	* system-config-printer.py
+	(GUI.__init__.UnobtrusiveButton.__init__): Don't use a LinkButton
+	for the 'Problems?' button (bug #465407).
+
+2008-10-10  Tim Waugh  <twaugh@redhat.com>
+
+	* system-config-printer.glade: Don't use a separator for the
+	server settings dialog (bug #465407).
+
+2008-10-10  Tim Waugh  <twaugh@redhat.com>
+
+	* system-config-printer.glade: Don't set non-zero page size for
+	SpinButtons.
+
+2008-10-10  Tim Waugh  <twaugh@redhat.com>
+
+	* errordialogs.py (show_IPP_Error): Don't show an error dialog if
+	an IPP operation's authentication dialog is cancelled by the
+	user (bug #465407).
+	* authconn.py: Show an error dialog if the password was
+	incorrect (bug #465407).
+
+2008-10-09  Tim Waugh  <twaugh@redhat.com>
+
+	* system-config-printer.glade: Renamed server_settings to
+	server_settings_menu_entry to avoid naming collision.
+	* system-config-printer.py (GUI.setConnected): Set Server
+	Settings... menu entry sensitive depending on whether we are
+	connected to a server (Ubuntu #280736).
+
 2008-09-29  Tim Waugh  <twaugh@redhat.com>
 
 	* configure.in: Version 1.0.8.
diff --git a/authconn.py b/authconn.py
index 6244eee..eb2dd23 100644
--- a/authconn.py
+++ b/authconn.py
@@ -202,6 +202,7 @@ class Connection:
             self._forbidden = False
             self._auth_called = False
             self._cancel = False
+            self._dialog_shown = False
             cups.setPasswordCB (self._password_callback)
             debugprint ("Authentication: password callback set")
             return 1
@@ -248,11 +249,26 @@ class Connection:
         # Reset the flag indicating whether we were given an auth callback.
         self._auth_called = False
 
+        # If we're previously prompted, explain why we're prompting again.
+        if self._dialog_shown:
+            d = gtk.MessageDialog (self._parent,
+                                   gtk.DIALOG_MODAL |
+                                   gtk.DIALOG_DESTROY_WITH_PARENT,
+                                   gtk.MESSAGE_ERROR,
+                                   gtk.BUTTONS_CLOSE)
+            d.set_title (_("Not authorized"))
+            d.set_markup ('<span weight="bold" size="larger">' +
+                          _("Not authorized") + '</span>\n\n' +
+                          _("The password may be incorrect."))
+            d.run ()
+            d.destroy ()
+
         # Prompt.
         d = AuthDialog (parent=self._parent)
         d.set_prompt (self._prompt)
         d.set_auth_info ([self._use_user, ''])
         d.field_grab_focus ('password')
+        self._dialog_shown = True
         response = d.run ()
         (self._use_user,
          self._use_password) = d.get_auth_info ()
diff --git a/cupshelpers/ppds.py b/cupshelpers/ppds.py
index 57d1dc0..7873d19 100755
--- a/cupshelpers/ppds.py
+++ b/cupshelpers/ppds.py
@@ -594,7 +594,9 @@ class PPDs:
         _debugprint (str (ppdnamelist))
 
         if not id_matched:
-            print "No ID match for device %s:" % uri
+            sanitised_uri = re.sub (pattern="//[^@]*@/?", repl="//",
+                                    string=str (uri))
+            print "No ID match for device %s:" % sanitised_uri
             print "  <manufacturer>%s</manufacturer>" % mfg
             print "  <model>%s</model>" % mdl
             print "  <description>%s</description>" % description
diff --git a/debug.py b/debug.py
index 4475e9d..79dc510 100644
--- a/debug.py
+++ b/debug.py
@@ -24,7 +24,7 @@ _debug=False
 def debugprint (x):
     if _debug:
         try:
-            print x
+            print >>sys.stderr, x
         except:
             pass
 
diff --git a/errordialogs.py b/errordialogs.py
index 07e404e..2f85dac 100755
--- a/errordialogs.py
+++ b/errordialogs.py
@@ -62,8 +62,8 @@ def show_error_dialog (title, text, parent=None):
 
 def show_IPP_Error(exception, message, parent=None):
     if exception == cups.IPP_NOT_AUTHORIZED:
-        title = _('Not authorized')
-        text = _('The password may be incorrect.')
+        # In this case, the user has canceled an authentication dialog.
+        return
     else:
         title = _("CUPS server error")
         text = (_("There was an error during the CUPS "
diff --git a/print-applet.desktop.in b/print-applet.desktop.in
index 0439a1c..55d563c 100644
--- a/print-applet.desktop.in
+++ b/print-applet.desktop.in
@@ -6,5 +6,5 @@ Exec=system-config-printer-applet
 Terminal=false
 Type=Application
 Icon=printer
-X-KDE-autostart-after=panel
+NotShowIn=KDE
 StartupNotify=false
diff --git a/pysmb.py b/pysmb.py
index 3974ed6..e54623b 100644
--- a/pysmb.py
+++ b/pysmb.py
@@ -27,6 +27,7 @@ except ImportError:
     USE_OLD_CODE=True
 
 import errno
+from gettext import gettext as _
 import gobject
 import gtk
 import os
@@ -43,6 +44,7 @@ class AuthContext:
         self.use_user = user
         self.use_password = passwd
         self.use_workgroup = workgroup
+        self.dialog_shown = False
         self.parent = parent
 
     def perform_authentication (self):
@@ -69,6 +71,19 @@ class AuthContext:
 
         self.auth_called = False
 
+        if self.dialog_shown:
+            d = gtk.MessageDialog (self.parent,
+                                   gtk.DIALOG_MODAL |
+                                   gtk.DIALOG_DESTROY_WITH_PARENT,
+                                   gtk.MESSAGE_ERROR,
+                                   gtk.BUTTONS_CLOSE)
+            d.set_title (_("Not authorized"))
+            d.set_markup ('<span weight="bold" size="larger">' +
+                          _("Not authorized") + '</span>\n\n' +
+                          _("The password may be incorrect."))
+            d.run ()
+            d.destroy ()
+
         # After that, prompt
         d = gtk.Dialog ("Authentication", self.parent,
                         gtk.DIALOG_MODAL | gtk.DIALOG_NO_SEPARATOR,
@@ -109,6 +124,7 @@ class AuthContext:
         vbox.pack_start (table, False, False, 0)
         hbox.pack_start (vbox, False, False, 0)
         d.vbox.pack_start (hbox)
+        self.dialog_shown = True
         d.show_all ()
 
         if self.use_user == 'guest':
@@ -117,15 +133,16 @@ class AuthContext:
         username_entry.set_text (self.use_user)
         domain_entry.set_text (self.use_workgroup)
         response = d.run ()
-        d.destroy ()
 
         if response == gtk.RESPONSE_CANCEL:
             self.cancel = True
+            d.destroy ()
             return -1
 
         self.use_user = username_entry.get_text ()
         self.use_password = password_entry.get_text ()
         self.use_workgroup = domain_entry.get_text ()
+        d.destroy ()
         return 1
 
     def initial_authentication (self):
diff --git a/smburi.py b/smburi.py
index 14362c9..bc0c4af 100644
--- a/smburi.py
+++ b/smburi.py
@@ -47,7 +47,7 @@ class SMBURI:
         uri = "%s%s%s" % (urllib.quote (user),
                           uri_password,
                           urllib.quote (group))
-        if len (uri) > 0:
+        if len (group) > 0:
             uri += '/'
         uri += urllib.quote (host)
         if len (share) > 0:
diff --git a/system-config-printer.glade b/system-config-printer.glade
index 9723013..fe386f8 100644
--- a/system-config-printer.glade
+++ b/system-config-printer.glade
@@ -67,7 +67,7 @@
 		  </child>
 
 		  <child>
-		    <widget class="GtkImageMenuItem" id="server_settings">
+		    <widget class="GtkImageMenuItem" id="server_settings_menu_entry">
 		      <property name="visible">True</property>
 		      <property name="tooltip" translatable="yes">Adjust server settings</property>
 		      <property name="label" translatable="yes">_Settings...</property>
@@ -6095,7 +6095,7 @@ Till Kamppeter &lt;till.kamppeter@gmail.com&gt;</property>
   <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
   <property name="focus_on_map">True</property>
   <property name="urgency_hint">False</property>
-  <property name="has_separator">True</property>
+  <property name="has_separator">False</property>
 
   <child internal-child="vbox">
     <widget class="GtkVBox" id="dialog-vbox10">
@@ -8533,7 +8533,7 @@ Bottom to top, right to left</property>
 						      <property name="update_policy">GTK_UPDATE_ALWAYS</property>
 						      <property name="snap_to_ticks">False</property>
 						      <property name="wrap">False</property>
-						      <property name="adjustment">100 10 1000 1 10 10</property>
+						      <property name="adjustment">100 10 1000 1 0 0</property>
 						      <signal name="changed" handler="on_job_option_changed" last_modification_time="Fri, 23 Feb 2007 14:12:21 GMT"/>
 						    </widget>
 						    <packing>
@@ -8710,7 +8710,7 @@ Bind (bottom)</property>
 						  <property name="update_policy">GTK_UPDATE_ALWAYS</property>
 						  <property name="snap_to_ticks">False</property>
 						  <property name="wrap">False</property>
-						  <property name="adjustment">50 0 100 1 10 10</property>
+						  <property name="adjustment">50 0 100 1 0 0</property>
 						  <signal name="changed" handler="on_job_option_changed" last_modification_time="Fri, 23 Feb 2007 14:12:21 GMT"/>
 						</widget>
 						<packing>
@@ -9012,7 +9012,7 @@ Reverse portrait (180°)</property>
 					  <property name="update_policy">GTK_UPDATE_ALWAYS</property>
 					  <property name="snap_to_ticks">False</property>
 					  <property name="wrap">False</property>
-					  <property name="adjustment">1 1 1000 1 10 10</property>
+					  <property name="adjustment">1 1 1000 1 0 0</property>
 					  <signal name="changed" handler="on_job_option_changed" last_modification_time="Thu, 22 Feb 2007 12:15:06 GMT"/>
 					</widget>
 					<packing>
@@ -9250,7 +9250,7 @@ Reverse portrait (180°)</property>
 					      <property name="update_policy">GTK_UPDATE_ALWAYS</property>
 					      <property name="snap_to_ticks">False</property>
 					      <property name="wrap">False</property>
-					      <property name="adjustment">100 10 1000 1 10 10</property>
+					      <property name="adjustment">100 10 1000 1 0 0</property>
 					      <signal name="changed" handler="on_job_option_changed" last_modification_time="Mon, 26 Feb 2007 13:56:24 GMT"/>
 					    </widget>
 					    <packing>
@@ -9378,7 +9378,7 @@ Reverse portrait (180°)</property>
 						      <property name="update_policy">GTK_UPDATE_ALWAYS</property>
 						      <property name="snap_to_ticks">False</property>
 						      <property name="wrap">False</property>
-						      <property name="adjustment">100 10 1000 1 10 10</property>
+						      <property name="adjustment">100 10 1000 1 0 0</property>
 						      <signal name="changed" handler="on_job_option_changed" last_modification_time="Mon, 26 Feb 2007 13:56:24 GMT"/>
 						    </widget>
 						    <packing>
@@ -9487,7 +9487,7 @@ Reverse portrait (180°)</property>
 						      <property name="update_policy">GTK_UPDATE_ALWAYS</property>
 						      <property name="snap_to_ticks">False</property>
 						      <property name="wrap">False</property>
-						      <property name="adjustment">0 -180 180 1 10 10</property>
+						      <property name="adjustment">0 -180 180 1 0 0</property>
 						      <signal name="changed" handler="on_job_option_changed" last_modification_time="Mon, 26 Feb 2007 13:56:24 GMT"/>
 						    </widget>
 						    <packing>
@@ -9563,7 +9563,7 @@ Reverse portrait (180°)</property>
 						  <property name="update_policy">GTK_UPDATE_ALWAYS</property>
 						  <property name="snap_to_ticks">False</property>
 						  <property name="wrap">False</property>
-						  <property name="adjustment">1000 1 10000 10 100 10</property>
+						  <property name="adjustment">1000 1 10000 10 0 0</property>
 						  <signal name="changed" handler="on_job_option_changed" last_modification_time="Mon, 26 Feb 2007 13:56:24 GMT"/>
 						</widget>
 						<packing>
@@ -9826,7 +9826,7 @@ Reverse portrait (180°)</property>
 						  <property name="update_policy">GTK_UPDATE_ALWAYS</property>
 						  <property name="snap_to_ticks">False</property>
 						  <property name="wrap">False</property>
-						  <property name="adjustment">18 0 100 1 10 10</property>
+						  <property name="adjustment">18 0 100 1 0 0</property>
 						  <signal name="changed" handler="on_job_option_changed" last_modification_time="Mon, 26 Feb 2007 15:57:14 GMT"/>
 						</widget>
 						<packing>
@@ -9889,7 +9889,7 @@ Reverse portrait (180°)</property>
 					      <property name="update_policy">GTK_UPDATE_ALWAYS</property>
 					      <property name="snap_to_ticks">False</property>
 					      <property name="wrap">False</property>
-					      <property name="adjustment">10 1 100 0.10000000149 1 1</property>
+					      <property name="adjustment">10 1 100 0.10000000149 0 0</property>
 					      <signal name="changed" handler="on_job_option_changed" last_modification_time="Mon, 26 Feb 2007 15:54:31 GMT"/>
 					    </widget>
 					    <packing>
@@ -9950,7 +9950,7 @@ Reverse portrait (180°)</property>
 					      <property name="update_policy">GTK_UPDATE_ALWAYS</property>
 					      <property name="snap_to_ticks">False</property>
 					      <property name="wrap">False</property>
-					      <property name="adjustment">6 1 100 0.10000000149 1 1</property>
+					      <property name="adjustment">6 1 100 0.10000000149 0 0</property>
 					      <signal name="changed" handler="on_job_option_changed" last_modification_time="Mon, 26 Feb 2007 15:55:39 GMT"/>
 					    </widget>
 					    <packing>
@@ -10040,7 +10040,7 @@ Reverse portrait (180°)</property>
 					      <property name="update_policy">GTK_UPDATE_ALWAYS</property>
 					      <property name="snap_to_ticks">False</property>
 					      <property name="wrap">False</property>
-					      <property name="adjustment">18 0 100 1 10 10</property>
+					      <property name="adjustment">18 0 100 1 0 0</property>
 					      <signal name="changed" handler="on_job_option_changed" last_modification_time="Mon, 26 Feb 2007 15:56:41 GMT"/>
 					    </widget>
 					    <packing>
@@ -10234,7 +10234,7 @@ Reverse portrait (180°)</property>
 						  <property name="update_policy">GTK_UPDATE_ALWAYS</property>
 						  <property name="snap_to_ticks">False</property>
 						  <property name="wrap">False</property>
-						  <property name="adjustment">1 1 4 1 1 1</property>
+						  <property name="adjustment">1 1 4 1 0 0</property>
 						  <signal name="changed" handler="on_job_option_changed" last_modification_time="Mon, 26 Feb 2007 16:03:08 GMT"/>
 						</widget>
 						<packing>
@@ -10369,7 +10369,7 @@ Reverse portrait (180°)</property>
 					      <property name="update_policy">GTK_UPDATE_ALWAYS</property>
 					      <property name="snap_to_ticks">False</property>
 					      <property name="wrap">False</property>
-					      <property name="adjustment">36 0 100 1 10 10</property>
+					      <property name="adjustment">36 0 100 1 0 0</property>
 					      <signal name="changed" handler="on_job_option_changed" last_modification_time="Mon, 26 Feb 2007 15:58:06 GMT"/>
 					    </widget>
 					    <packing>
@@ -10459,7 +10459,7 @@ Reverse portrait (180°)</property>
 					      <property name="update_policy">GTK_UPDATE_ALWAYS</property>
 					      <property name="snap_to_ticks">False</property>
 					      <property name="wrap">False</property>
-					      <property name="adjustment">36 0 100 1 10 10</property>
+					      <property name="adjustment">36 0 100 1 0 0</property>
 					      <signal name="changed" handler="on_job_option_changed" last_modification_time="Mon, 26 Feb 2007 16:01:04 GMT"/>
 					    </widget>
 					    <packing>
diff --git a/system-config-printer.py b/system-config-printer.py
index 295b999..9b5830e 100755
--- a/system-config-printer.py
+++ b/system-config-printer.py
@@ -209,7 +209,7 @@ class GUI(GtkGUI, monitor.Watcher):
                         "btnPrinterPropertiesApply",
                         "btnPrinterPropertiesClose",
                         "ServerSettingsDialog",
-                        "server_settings",
+                        "server_settings_menu_entry",
                         "statusbarMain",
                         "new_printer", "new_class",
                         "rename", "copy", "delete",
@@ -338,9 +338,20 @@ class GUI(GtkGUI, monitor.Watcher):
         self.AboutDialog.set_icon_name('printer')
 
         # Set up "Problems?" link button
-        problems = gtk.LinkButton ('', label=_("Problems?"))
+        class UnobtrusiveButton(gtk.Button):
+            def __init__ (self, **args):
+                gtk.Button.__init__ (self, **args)
+                self.set_relief (gtk.RELIEF_NONE)
+                label = self.get_child ()
+                text = label.get_text ()
+                label.set_use_markup (True)
+                label.set_markup ('<span size="small" ' +
+                                  'underline="single" ' +
+                                  'color="#0000ee">%s</span>' % text)
+
+        problems = UnobtrusiveButton (label=_("Problems?"))
         self.hboxServerBrowse.pack_end (problems, False, False, 0)
-        problems.connect ('clicked', self.on_problems_linkbutton_clicked)
+        problems.connect ('clicked', self.on_problems_button_clicked)
         problems.show ()
 
         self.static_tabs = 3
@@ -363,6 +374,7 @@ class GUI(GtkGUI, monitor.Watcher):
                                       gobject.TYPE_STRING)   # Tooltip
         
         self.dests_iconview.set_model(self.mainlist)
+        self.dests_iconview.set_item_width (145)
         self.dests_iconview.set_pixbuf_column (1)
         self.dests_iconview.set_text_column (2)
         self.dests_iconview.set_tooltip_column (3)
@@ -796,7 +808,8 @@ class GUI(GtkGUI, monitor.Watcher):
                        self.chkServerBrowse, self.chkServerShare,
                        self.chkServerRemoteAdmin,
                        self.chkServerAllowCancelAll,
-                       self.chkServerLogDebug):
+                       self.chkServerLogDebug,
+                       self.server_settings_menu_entry):
             widget.set_sensitive(connected)
 
         sharing = self.chkServerShare.get_active ()
@@ -978,6 +991,11 @@ class GUI(GtkGUI, monitor.Watcher):
                 self.dests_iconview.select_path (path)
         model.foreach (maybe_select)
 
+        if (self.printer != None and
+            self.printer.name not in self.printers.keys ()):
+            # The printer we're editing has been deleted.
+            self.PrinterPropertiesDialog.response (gtk.RESPONSE_CANCEL)
+
     # Connect to Server
 
     def on_connect_servername_changed(self, widget):
@@ -1539,6 +1557,10 @@ class GUI(GtkGUI, monitor.Watcher):
                 self.printers.update (this_printer)
             except cups.IPPError, (e, s):
                 show_IPP_Error(e, s, self.PrinterPropertiesDialog)
+            except KeyError:
+                # The printer was deleted in the mean time and the
+                # user made no changes.
+                self.populateList ()
 
         return False
 
@@ -2487,7 +2509,7 @@ class GUI(GtkGUI, monitor.Watcher):
             nonfatalException()
 
     ### The "Problems?" clickable label
-    def on_problems_linkbutton_clicked (self, *args):
+    def on_problems_button_clicked (self, *args):
         if not self.__dict__.has_key ('troubleshooter'):
             self.troubleshooter = troubleshoot.run (self.on_troubleshoot_quit,
                                                     parent=self.ServerSettingsDialog)
@@ -4233,8 +4255,10 @@ class NewPrinterGUI(GtkGUI):
                                                          group = group,
                                                          user = user,
                                                          passwd = passwd)
+            canceled = False
         else:
             accessible = False
+            canceled = False
             self.busy ()
             try:
                 debug = 0
@@ -4264,6 +4288,9 @@ class NewPrinterGUI(GtkGUI):
                             accessible = True
                         except Exception, e:
                             smbc_auth.failed (e)
+
+                    if not accessible:
+                        canceled = True
             except RuntimeError, (e, s):
                 debugprint ("Error accessing share: %s" % repr ((e, s)))
                 reason = s
@@ -4277,11 +4304,12 @@ class NewPrinterGUI(GtkGUI):
                               parent=self.NewPrinterWindow)
             return
 
-        text = _("This print share is not accessible.")
-        if reason:
-            text = reason
-        show_error_dialog (_("Print Share Inaccessible"), text,
-                           parent=self.NewPrinterWindow)
+        if not canceled:
+            text = _("This print share is not accessible.")
+            if reason:
+                text = reason
+            show_error_dialog (_("Print Share Inaccessible"), text,
+                               parent=self.NewPrinterWindow)
 
     ### IPP Browsing
     def update_IPP_URI_label(self):
openSUSE Build Service is sponsored by