[rhythmbox] 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] replace entry equality checks with entry location equality checks (bug #634957)
- Date: Mon, 21 Mar 2011 23:43:13 +0000 (UTC)
commit cd43cb2146d6e2d1ef386c96b5a816afcf9f191b
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 8ff0603..f36a682 100644
--- a/plugins/artdisplay/artdisplay/__init__.py
+++ b/plugins/artdisplay/artdisplay/__init__.py
@@ -426,9 +426,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 ()
@@ -439,7 +439,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:
@@ -452,7 +453,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():
@@ -470,7 +470,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
@@ -538,11 +538,11 @@ class ArtDisplayPlugin (RB.Plugin):
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 92cd4a7..5a91567 100644
--- a/plugins/context/context/LyricsTab.py
+++ b/plugins/context/context/LyricsTab.py
@@ -143,7 +143,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 966ba74..7b1e582 100644
--- a/plugins/im-status/im-status/__init__.py
+++ b/plugins/im-status/im-status/__init__.py
@@ -120,7 +120,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 3a4c550..3fc14d5 100644
--- a/plugins/rb/__init__.py
+++ b/plugins/rb/__init__.py
@@ -35,6 +35,8 @@ import thread
from gi.repository import RB
from gi.repository import GConf
+import rhythmdb
+
# rb classes
from Loader import Loader
from Loader import ChunkLoader
@@ -61,6 +63,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)
def get_gconf_string_list(key):
gconf = GConf.Client().get_default()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]