Fixed some printer name encoding issues (bug #950162).

This commit is contained in:
Tim Waugh 2013-04-11 15:35:38 +01:00
parent bd10e083c9
commit d08669e78b
2 changed files with 134 additions and 0 deletions

View File

@ -0,0 +1,129 @@
diff -up system-config-printer-1.4.0/system-config-printer.py.encoding system-config-printer-1.4.0/system-config-printer.py
--- system-config-printer-1.4.0/system-config-printer.py.encoding 2013-04-11 15:34:21.424342230 +0100
+++ system-config-printer-1.4.0/system-config-printer.py 2013-04-11 15:34:42.001429400 +0100
@@ -460,7 +460,7 @@ class GUI(GtkGUI):
model = self.dests_iconview.get_model ()
iter = model.get_iter_first ()
while iter != None:
- name = unicode (model.get_value (iter, 2))
+ name = model.get_value (iter, 2).decode ('utf-8')
if name == queue:
path = model.get_path (iter)
self.dests_iconview.scroll_to_path (path, True, 0.5, 0.5)
@@ -499,7 +499,7 @@ class GUI(GtkGUI):
def dests_iconview_item_activated (self, iconview, path):
model = iconview.get_model ()
iter = model.get_iter (path)
- name = unicode (model.get_value (iter, 2))
+ name = model.get_value (iter, 2).decode ('utf-8')
object = model.get_value (iter, 0)
self.desensitise_main_window_widgets ()
@@ -538,7 +538,7 @@ class GUI(GtkGUI):
for path in paths:
iter = model.get_iter (path)
object = model.get_value (iter, 0)
- name = unicode (model.get_value (iter, 2))
+ name = model.get_value (iter, 2).decode ('utf-8')
if object.discovered:
any_discovered = True
if object.enabled:
@@ -958,7 +958,7 @@ class GUI(GtkGUI):
# Restore selection of printers.
model = self.dests_iconview.get_model ()
def maybe_select (model, path, iter, UNUSED):
- name = unicode (model.get_value (iter, 2))
+ name = model.get_value (iter, 2).decode ('utf-8')
if name in selected_printers:
self.dests_iconview.select_path (path)
model.foreach (maybe_select, None)
@@ -1286,7 +1286,7 @@ class GUI(GtkGUI):
model = self.dests_iconview.get_model ()
iter = model.get_iter (path)
- name = unicode (model.get_value (iter, 2))
+ name = model.get_value (iter, 2).decode ('utf-8')
if not self.is_rename_possible (name):
return
if not self.rename_confirmed_by_user (name):
@@ -1320,7 +1320,7 @@ class GUI(GtkGUI):
def printer_name_edited (self, cell, path, newname):
model = self.dests_iconview.get_model ()
iter = model.get_iter (path)
- name = unicode (model.get_value (iter, 2))
+ name = model.get_value (iter, 2).decode ('utf-8')
debugprint ("edited: %s -> %s" % (name, newname))
try:
self.rename_printer (name, newname)
@@ -1439,7 +1439,7 @@ class GUI(GtkGUI):
# ..and select the new printer.
def select_new_printer (model, path, iter):
- name = unicode (model.get_value (iter, 2))
+ name = model.get_value (iter, 2).decode ('utf-8')
if name == new_name:
self.dests_iconview.select_path (path)
self.populateList ()
@@ -1463,7 +1463,7 @@ class GUI(GtkGUI):
paths = iconview.get_selected_items ()
model = self.dests_iconview.get_model ()
iter = model.get_iter (paths[0])
- name = unicode (model.get_value (iter, 2))
+ name = model.get_value (iter, 2).decode ('utf-8')
self.entDuplicateName.set_text(name)
self.NewPrinterName.set_transient_for (self.PrintersWindow)
result = self.NewPrinterName.run()
@@ -1513,7 +1513,7 @@ class GUI(GtkGUI):
if n == 1:
itr = model.get_iter (paths[0])
obj = model.get_value (itr, 0)
- name = unicode (model.get_value (itr, 2), 'utf-8')
+ name = model.get_value (itr, 2).decode ('utf-8')
if obj.is_class:
message_format = _("Really delete class '%s'?") % name
else:
@@ -1524,7 +1524,7 @@ class GUI(GtkGUI):
message_format = _("Really delete selected destinations?")
for path in paths:
itr = model.get_iter (path)
- name = unicode (model.get_value (itr, 2), 'utf-8')
+ name = model.get_value (itr, 2).decode ('utf-8')
to_delete.append (name)
dialog = Gtk.MessageDialog(self.PrintersWindow,
@@ -1652,7 +1652,7 @@ class GUI(GtkGUI):
paths = iconview.get_selected_items ()
model = iconview.get_model ()
iter = model.get_iter (paths[0])
- name = unicode (model.get_value (iter, 2))
+ name = model.get_value (iter, 2).decode ('utf-8')
self.set_system_or_user_default_printer (name)
def on_edit_activate (self, *UNUSED):
@@ -1665,7 +1665,7 @@ class GUI(GtkGUI):
model = self.dests_iconview.get_model ()
for path in paths:
iter = model.get_iter (path)
- name = unicode (model.get_value (iter, 2), 'utf-8')
+ name = model.get_value (iter, 2).decode ('utf-8')
class_members.append (name)
if not self.newPrinterGUI.init ("class",
host=self.connect_server,
@@ -1692,7 +1692,7 @@ class GUI(GtkGUI):
model = self.dests_iconview.get_model ()
for path in paths:
iter = model.get_iter (path)
- name = unicode (model.get_value (iter, 2), 'utf-8')
+ name = model.get_value (iter, 2).decode ('utf-8')
specific_dests.append (name)
viewer = jobviewer.JobViewer (None, None, my_jobs=False,
specific_dests=specific_dests,
@@ -1822,7 +1822,7 @@ class GUI(GtkGUI):
model = self.dests_iconview.get_model ()
iter = model.get_iter_first ()
while iter != None:
- queue = unicode (model.get_value (iter, 2))
+ queue = model.get_value (iter, 2).decode ('utf-8')
if queue == name:
path = model.get_path (iter)
self.dests_iconview.scroll_to_path (path, True, 0.5, 0.5)

View File

@ -8,6 +8,7 @@ Group: System Environment/Base
Source0: http://cyberelk.net/tim/data/system-config-printer/1.3/%{name}-%{version}.tar.xz
Patch1: system-config-printer-no-applet-in-gnome.patch
Patch2: system-config-printer-DISPLAY.patch
Patch3: system-config-printer-encoding.patch
BuildRequires: cups-devel >= 1.2
BuildRequires: desktop-file-utils >= 0.2.92
@ -69,6 +70,9 @@ printers.
# Better behaviour when trying to run without valid DISPLAY (bug # #948240).
%patch2 -p1 -b .DISPLAY
# Fixed some printer name encoding issues (bug #950162).
%patch3 -p1 -b .encoding
%build
%configure --with-udev-rules
@ -169,6 +173,7 @@ exit 0
%changelog
* Thu Apr 11 2013 Tim Waugh <twaugh@redhat.com> 1.4.0-2
- Fixed some printer name encoding issues (bug #950162).
- Better behaviour when trying to run without valid DISPLAY (bug # #948240).
* Wed Mar 27 2013 Tim Waugh <twaugh@redhat.com> 1.4.0-1