[rhythmbox/v0.13.x] replace entry equality checks with entry location equality checks (bug #634957)
- From: Jonathan Matthew <jmatthew src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rhythmbox/v0.13.x] replace entry equality checks with entry location equality checks (bug #634957)
- Date: Mon, 21 Mar 2011 23:43:17 +0000 (UTC)
commit ebd3709a45a072d87c2f5f103c444e1abdb1fc28
Author: Jonathan Matthew <jonathan d14n org>
Date: Mon Mar 21 21:20:06 2011 +1000
replace entry equality checks with entry location equality checks (bug #634957)
It appears that at some point we switched from doing a pointer
comparison when no specific compare method existed to just returning
False. As a result, we need to compare entry locations instead.
This broke lyrics display in the context pane plugin and cover art in
the mpris plugin, among other things.
plugins/artdisplay/artdisplay/__init__.py | 14 +++++++-------
plugins/context/context/LyricsTab.py | 2 +-
plugins/im-status/im-status/__init__.py | 3 ++-
plugins/rb/__init__.py | 8 ++++++++
4 files changed, 18 insertions(+), 9 deletions(-)
---
diff --git a/plugins/artdisplay/artdisplay/__init__.py b/plugins/artdisplay/artdisplay/__init__.py
index 6faa748..f0d016d 100644
--- a/plugins/artdisplay/artdisplay/__init__.py
+++ b/plugins/artdisplay/artdisplay/__init__.py
@@ -408,9 +408,9 @@ class ArtDisplayPlugin (rb.Plugin):
self.set_entry(entry)
def set_entry (self, entry):
- if entry == self.current_entry:
- return
db = self.shell.get_property ("db")
+ if rb.entry_equal(db, entry, self.current_entry):
+ return
self.art_widget.set (entry, None, None, None, None, True)
self.art_container.show_all ()
@@ -421,7 +421,8 @@ class ArtDisplayPlugin (rb.Plugin):
def on_get_pixbuf_completed(self, entry, pixbuf, uri, tooltip_image, tooltip_text):
# Set the pixbuf for the entry returned from the art db
- if entry == self.current_entry:
+ db = self.shell.get_property ("db")
+ if rb.entry_equal(db, entry, self.current_entry):
self.current_pixbuf = pixbuf
if tooltip_image is None:
@@ -434,7 +435,6 @@ class ArtDisplayPlugin (rb.Plugin):
self.art_widget.set (entry, pixbuf, uri, pb, tooltip_text, False)
if pixbuf:
- db = self.shell.get_property ("db")
# This might be from a playing-changed signal,
# in which case consumers won't be ready yet.
def idle_emit_art():
@@ -452,7 +452,7 @@ class ArtDisplayPlugin (rb.Plugin):
a[0] = pixbuf
self.on_get_pixbuf_completed(entry, pixbuf, uri, tooltip_image, tooltip_text)
- playing = (entry == self.current_entry)
+ playing = rb.entry_equal(db, entry, self.current_entry)
self.art_db.get_pixbuf(db, entry, playing, callback)
# If callback was called synchronously we can return a pixmap
@@ -505,11 +505,11 @@ class ArtDisplayPlugin (rb.Plugin):
l.get_url (uri, loader_cb)
def cover_art_uri_request (self, db, entry):
- if entry == self.current_entry:
+ if rb.entry_equal(db, entry, self.current_entry):
return self.art_widget.current_uri
def cover_art_uri_gather (self, db, entry, metadata):
- if entry == self.current_entry and self.art_widget.current_uri:
+ if rb.entry_equal(db, entry, self.current_entry) and self.art_widget.current_uri:
metadata ['rb:coverArt-uri'] = self.art_widget.current_uri
def on_set_pixbuf (self, widget, entry, pixbuf):
diff --git a/plugins/context/context/LyricsTab.py b/plugins/context/context/LyricsTab.py
index 758aae7..527f201 100644
--- a/plugins/context/context/LyricsTab.py
+++ b/plugins/context/context/LyricsTab.py
@@ -140,7 +140,7 @@ class LyricsDataSource (gobject.GObject):
self.db.connect ('entry-extra-metadata-notify::rb:lyrics', self.lyrics_notify)
def lyrics_notify (self, db, entry, field, metadata):
- if entry == self.entry:
+ if rb.entry_equal(db, entry, self.entry):
self.emit ('lyrics-ready', self.entry, metadata)
def fetch_lyrics (self, entry):
diff --git a/plugins/im-status/im-status/__init__.py b/plugins/im-status/im-status/__init__.py
index c2b6251..468473b 100644
--- a/plugins/im-status/im-status/__init__.py
+++ b/plugins/im-status/im-status/__init__.py
@@ -118,7 +118,8 @@ class IMStatusPlugin (rb.Plugin):
self.set_status ()
def set_entry (self, entry):
- if entry == self.current_entry:
+ db = self.shell.get_property ("db")
+ if rb.entry_equal(db, entry, self.current_entry):
return
if self.current_entry == None:
diff --git a/plugins/rb/__init__.py b/plugins/rb/__init__.py
index 5f616c6..fdafd2d 100644
--- a/plugins/rb/__init__.py
+++ b/plugins/rb/__init__.py
@@ -32,6 +32,8 @@ import os
import gtk
+import rhythmdb
+
# rb classes
from Loader import Loader
from Loader import ChunkLoader
@@ -64,6 +66,12 @@ def append_plugin_source_path(theme, iconpath):
icondir = plugindir + iconpath
theme.append_search_path(icondir)
+def entry_equal(db, a, b):
+ if (a is None and b is None):
+ return True
+ if (a is None or b is None):
+ return False
+ return db.entry_get(a, rhythmdb.PROP_LOCATION) == db.entry_get(b, rhythmdb.PROP_LOCATION)
class _rbdebugfile:
def __init__(self, fn):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]