Code freeze break requests for Totem



Hi,

Thanks to Luis Medinas, we've been notified that the Subtitle
Downloader plugin in Totem was failing to open, and coupled with some
bugs I spotted in the Jamendo plugin, the OpenSubtitles and Jamendo
plugins in Totem are currently fairly broken.

Can we get a code freeze break for the five patches in the following
two bugs please?

https://bugzilla.gnome.org/show_bug.cgi?id=646231
https://bugzilla.gnome.org/show_bug.cgi?id=646245

I've tested them, and they work fine; they're mostly trivial
find-and-replace cleanups to fix changes in GTK+'s GIR since I last
looked at the plugins.

Patches attached for convenience.

(Sorry for all the late breakage in Totem; it's mostly my fault for not
keeping up with all the changes in g-i.)

Thanks,
Philip

From 2d12d7256124e87670047d67b3c43133052f05f7 Mon Sep 17 00:00:00 2001
From: Philip Withnall <philip tecnocode co uk>
Date: Wed, 30 Mar 2011 15:49:43 +0100
Subject: [PATCH 1/3] =?UTF-8?q?Bug=20646231=20=E2=80=94=20Subtitle=20downloader=20plugin=20broken=20on=202.91.93?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Fix another API break in pygobject/GTK+'s GIR. This allows the Subtitle
Downloader dialogue to actually open successfully.

Closes: bgo#646231
---
 src/plugins/opensubtitles/opensubtitles.py |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/plugins/opensubtitles/opensubtitles.py b/src/plugins/opensubtitles/opensubtitles.py
index 791cc67..a5b5c50 100644
--- a/src/plugins/opensubtitles/opensubtitles.py
+++ b/src/plugins/opensubtitles/opensubtitles.py
@@ -364,8 +364,9 @@ class OpenSubtitles(gobject.GObject, Peas.Activatable):
         for lang in LANGUAGES_STR:
             it = languages.append(lang)
             if LANGUAGES[lang[1]] == self.model.lang:
-                parentit = sorted_languages.convert_child_iter_to_iter (it)
-                combobox.set_active_iter(parentit)
+                (success, parentit) = sorted_languages.convert_child_iter_to_iter (it)
+                if success:
+                    combobox.set_active_iter (parentit)
 
         # Set up the results treeview 
         renderer = Gtk.CellRendererText()
-- 
1.7.4.2

From 7b079b7a732dcfaeef4cf1c2fd351b6a0696cb92 Mon Sep 17 00:00:00 2001
From: Philip Withnall <philip tecnocode co uk>
Date: Wed, 30 Mar 2011 17:15:16 +0100
Subject: [PATCH 1/2] jamendo: Fix encoding problems with non-ASCII track names

Ensure that track names are uniformly decoded as UTF-8, and never re-encoded
as ASCII. Attempting to re-encode them as ASCII was causing non-ASCII track
names to (obviously) blow things up.

Helps: bgo#646245
---
 src/plugins/jamendo/jamendo.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/plugins/jamendo/jamendo.py b/src/plugins/jamendo/jamendo.py
index 5619cf3..6b7082f 100644
--- a/src/plugins/jamendo/jamendo.py
+++ b/src/plugins/jamendo/jamendo.py
@@ -287,7 +287,7 @@ class JamendoPlugin(gobject.GObject, Peas.Activatable, PeasGtk.Configurable):
             # track title
             # Translators: this is the title of a track in Python format
             # (first argument is the track number, second is the track title)
-            tt = ('<small>%s</small>' % _(u'%02d. %s')) % \
+            tt = (u'<small>%s</small>' % _(u'%02d. %s')) % \
                 (i+1, self._format_str(track['name']))
             # track duration
             td = self._format_duration(track['duration'])
@@ -603,7 +603,7 @@ class JamendoPlugin(gobject.GObject, Peas.Activatable, PeasGtk.Configurable):
         if not st:
             return ''
         try:
-            return escape(st.encode('utf8'))
+            return escape (unicode (st))
         except:
             return st
 
-- 
1.7.4.2

From 9efd7d0a0686eb38413d3e0f3fde916eed370a5f Mon Sep 17 00:00:00 2001
From: Philip Withnall <philip tecnocode co uk>
Date: Wed, 30 Mar 2011 17:16:27 +0100
Subject: [PATCH 2/2] jamendo: Fix various tree model/view problems due to changes in GTK+'s GIR

This fixes clicking, double-clicking and right-clicking on albums and tracks,
meaning the plugin is actually useful.

Closes: bgo#646245
---
 src/plugins/jamendo/jamendo.py |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/src/plugins/jamendo/jamendo.py b/src/plugins/jamendo/jamendo.py
index 6b7082f..76e28a1 100644
--- a/src/plugins/jamendo/jamendo.py
+++ b/src/plugins/jamendo/jamendo.py
@@ -462,7 +462,8 @@ class JamendoPlugin(gobject.GObject, Peas.Activatable, PeasGtk.Configurable):
             item = self._get_selection()[0] # first item selected
         except:
             return
-        if len(path) == 1:
+
+        if path.get_depth () == 1:
             self.add_album_to_playlist('replace', item)
         else:
             self.add_track_to_playlist('replace', item)
@@ -472,19 +473,19 @@ class JamendoPlugin(gobject.GObject, Peas.Activatable, PeasGtk.Configurable):
         Called when the user clicked on a treeview element.
         """
         try:
-            if evt.button.button == 3:
+            if evt.button == 3:
                 (path, _, _, _) = tv.get_path_at_pos(int(evt.x), int(evt.y))
                 sel  = tv.get_selection()
-                (rows, _) = sel.get_selected_rows()
+                (_, rows) = sel.get_selected_rows()
                 if path not in rows:
                     sel.unselect_all()
                     sel.select_path(path)
                 tv.grab_focus()
-                self.popup.popup_for_device(None, None, None, None, None, evt.button.button, evt.time)
+                self.popup.popup_for_device(None, None, None, None, None, evt.button, evt.time)
                 return True
 
-            (_, event_x, event_y) = evt.get_coords()
-            path, c, x, y = tv.get_path_at_pos(int(event_x), int(event_y))
+            (event_x, event_y) = evt.get_coords()
+            (path, c, x, y) = tv.get_path_at_pos(int(event_x), int(event_y))
             if (path.get_depth() == 1):
                 if tv.row_expanded(path):
                     tv.collapse_row(path)
@@ -494,7 +495,7 @@ class JamendoPlugin(gobject.GObject, Peas.Activatable, PeasGtk.Configurable):
             pass
 
     def on_treeview_selection_changed (self, selection):
-        (rows, _) = selection.get_selected_rows ()
+        (_, rows) = selection.get_selected_rows ()
         self.album_button.set_sensitive (len (rows) > 0)
 
     def on_previous_button_clicked(self, *args):
@@ -565,7 +566,7 @@ class JamendoPlugin(gobject.GObject, Peas.Activatable, PeasGtk.Configurable):
         """
         ret = []
         sel = self.current_treeview.get_selection()
-        (rows, model) = sel.get_selected_rows()
+        (model, rows) = sel.get_selected_rows()
         for row in rows:
             it = model.get_iter(row)
 
@@ -585,7 +586,7 @@ class JamendoPlugin(gobject.GObject, Peas.Activatable, PeasGtk.Configurable):
         Update the state of the previous and next buttons.
         """
         sel = self.current_treeview.get_selection()
-        (rows, model) = sel.get_selected_rows()
+        (model, rows) = sel.get_selected_rows()
         try:
             it = model.get_iter(rows[0])
         except:
-- 
1.7.4.2

From a15871a06bc5cadbd9db929f8612611245ef21cc Mon Sep 17 00:00:00 2001
From: Philip Withnall <philip tecnocode co uk>
Date: Wed, 30 Mar 2011 16:08:20 +0100
Subject: [PATCH 2/3] opensubtitles: Fix the GDK key constants used

Guess what? Another bug caused by GIR changes for GDK!
---
 src/plugins/opensubtitles/opensubtitles.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/plugins/opensubtitles/opensubtitles.py b/src/plugins/opensubtitles/opensubtitles.py
index a5b5c50..3b419ca 100644
--- a/src/plugins/opensubtitles/opensubtitles.py
+++ b/src/plugins/opensubtitles/opensubtitles.py
@@ -604,7 +604,7 @@ class OpenSubtitles(gobject.GObject, Peas.Activatable):
     # Callbacks
 
     def on_window__key_press_event(self, widget, event):
-        if event.keyval == Gdk.Escape:
+        if event.keyval == Gdk.KEY_Escape:
             self.dialog.destroy()
             self.dialog = None
             return True
-- 
1.7.4.2

From 642cc4229832e5c24d1a262eab3a36734eaffecf Mon Sep 17 00:00:00 2001
From: Philip Withnall <philip tecnocode co uk>
Date: Wed, 30 Mar 2011 16:09:21 +0100
Subject: [PATCH 3/3] opensubtitles: Parse the subtitle file as a URI rather than a path

This means the subtitle file can actually be saved, allowing subtitles to be
downloaded and loaded correctly.
---
 src/plugins/opensubtitles/opensubtitles.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/plugins/opensubtitles/opensubtitles.py b/src/plugins/opensubtitles/opensubtitles.py
index 3b419ca..1c4edb8 100644
--- a/src/plugins/opensubtitles/opensubtitles.py
+++ b/src/plugins/opensubtitles/opensubtitles.py
@@ -560,7 +560,7 @@ class OpenSubtitles(gobject.GObject, Peas.Activatable):
 		if fp.query_exists(None):
                     fp.delete(None)
 
-            fp = Gio.file_new_for_path(filename)
+            fp = Gio.file_new_for_uri (filename)
             suburi = fp.get_uri ()
 
             subFile  = fp.replace('', False)
-- 
1.7.4.2

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]