Blame SOURCES/system-config-printer-rename.patch

0a882b
diff -up system-config-printer-1.4.1/system-config-printer.py.rename system-config-printer-1.4.1/system-config-printer.py
0a882b
--- system-config-printer-1.4.1/system-config-printer.py.rename	2013-05-09 12:10:45.000000000 +0100
0a882b
+++ system-config-printer-1.4.1/system-config-printer.py	2013-06-07 16:57:05.066174697 +0100
0a882b
@@ -1296,18 +1296,27 @@ class GUI(GtkGUI):
0a882b
         ids = []
0a882b
         ids.append (cell.connect ('editing-started',
0a882b
                                  self.printer_name_edit_start))
0a882b
-        ids.append (cell.connect ('edited', self.printer_name_edited))
0a882b
         ids.append (cell.connect ('editing-canceled',
0a882b
                                  self.printer_name_edit_cancel))
0a882b
         self.rename_sigids = ids
0a882b
-        self.rename_entry_sigid = None
0a882b
+        self.rename_entry_sigids = []
0a882b
         self.dests_iconview.set_cursor (path, cell, True)
0a882b
 
0a882b
     def printer_name_edit_start (self, cell, editable, path):
0a882b
-        debugprint ("editing-started")
0a882b
+        debugprint ("editing-started with cell=%s, editable=%s" %
0a882b
+                    (repr (cell),
0a882b
+                     repr (editable)))
0a882b
         if isinstance(editable, Gtk.Entry):
0a882b
             id = editable.connect('changed', self.printer_name_editing)
0a882b
-            self.rename_entry_sigid = editable, id
0a882b
+            self.rename_entry_sigids.append ((editable, id))
0a882b
+
0a882b
+            model = self.dests_iconview.get_model ()
0a882b
+            iter = model.get_iter (path)
0a882b
+            name = model.get_value (iter, 2).decode ('utf-8')
0a882b
+            id = editable.connect('editing-done',
0a882b
+                                  self.printer_name_editing_done,
0a882b
+                                  cell, name)
0a882b
+            self.rename_entry_sigids.append ((editable, id))
0a882b
 
0a882b
     def printer_name_editing (self, entry):
0a882b
         newname = origname = unicode (entry.get_text())
0a882b
@@ -1318,11 +1327,10 @@ class GUI(GtkGUI):
0a882b
             debugprint ("removed disallowed character %s" % origname[-1])
0a882b
             entry.set_text(newname)
0a882b
 
0a882b
-    def printer_name_edited (self, cell, path, newname):
0a882b
-        model = self.dests_iconview.get_model ()
0a882b
-        iter = model.get_iter (path)
0a882b
-        name = model.get_value (iter, 2).decode ('utf-8')
0a882b
-        debugprint ("edited: %s -> %s" % (name, newname))
0a882b
+    def printer_name_editing_done (self, entry, cell, name):
0a882b
+        debugprint (repr (cell))
0a882b
+        newname = entry.get_text ().decode ('utf-8')
0a882b
+        debugprint ("edited: %s -> %s" % (repr (name), repr (newname)))
0a882b
         try:
0a882b
             self.rename_printer (name, newname)
0a882b
         finally:
0a882b
@@ -1330,18 +1338,17 @@ class GUI(GtkGUI):
0a882b
             cell.set_property ('editable', False)
0a882b
             for id in self.rename_sigids:
0a882b
                 cell.disconnect (id)
0a882b
-            if self.rename_entry_sigid != None:
0a882b
-                self.rename_entry_sigid[0].disconnect(self.rename_entry_sigid[1])
0a882b
+            for obj, id in self.rename_entry_sigids:
0a882b
+                obj.disconnect (id)
0a882b
 
0a882b
     def printer_name_edit_cancel (self, cell):
0a882b
-        debugprint ("editing-canceled")
0a882b
+        debugprint ("editing-canceled (%s)" % repr (cell))
0a882b
         cell.stop_editing (True)
0a882b
         cell.set_property ('editable', False)
0a882b
         for id in self.rename_sigids:
0a882b
             cell.disconnect (id)
0a882b
-        if self.rename_entry_sigid != None:
0a882b
-            self.rename_entry_sigid[0].disconnect(self.rename_entry_sigid[1])
0a882b
-
0a882b
+        for obj, id in self.rename_entry_sigids:
0a882b
+            obj.disconnect (id)
0a882b
 
0a882b
     def rename_printer (self, old_name, new_name):
0a882b
         if old_name.lower() == new_name.lower():