rendered paste bodyIndex: shell/rb-shell-player.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/shell/rb-shell-player.c,v
retrieving revision 1.166
diff -u -r1.166 rb-shell-player.c
--- shell/rb-shell-player.c 29 Aug 2005 22:00:38 -0000 1.166
+++ shell/rb-shell-player.c 29 Aug 2005 23:10:55 -0000
@@ -113,7 +113,11 @@
PlayButtonState state);
static void rb_shell_player_sync_with_source (RBShellPlayer *player);
static void rb_shell_player_sync_with_selected_source (RBShellPlayer *player);
-
+static void rb_shell_player_entry_changed_cb (RhythmDB *db,
+ RhythmDBEntry *entry,
+ GSList *changes,
+ RBShellPlayer *player);
+
static void rb_shell_player_playing_entry_deleted_cb (RBEntryView *view,
RhythmDBEntry *entry,
RBShellPlayer *playa);
@@ -197,7 +201,6 @@
char *song;
gboolean have_url;
- gboolean have_artist_album;
char *url;
gboolean have_previous_entry;
@@ -716,7 +719,7 @@
g_signal_connect (player, "notify::playing",
G_CALLBACK (reemit_playing_signal), NULL);
-
+
#ifdef HAVE_MMKEYS
/* Enable Multimedia Keys */
rb_shell_player_init_mmkeys (player);
@@ -825,6 +828,12 @@
break;
case PROP_DB:
player->priv->db = g_value_get_object (value);
+
+ /* Listen for changed entries to update metadata display */
+ g_signal_connect_object (G_OBJECT (player->priv->db),
+ "entry_changed",
+ G_CALLBACK (rb_shell_player_entry_changed_cb),
+ player, 0);
break;
case PROP_ACTION_GROUP:
player->priv->actiongroup = g_value_get_object (value);
@@ -1689,6 +1698,34 @@
}
static void
+rb_shell_player_entry_changed_cb (RhythmDB *db, RhythmDBEntry *entry,
+ GSList *changes, RBShellPlayer *player)
+{
+ GSList *t;
+ RhythmDBEntry *playing_entry = rb_shell_player_get_playing_entry (player);
+
+ /* We try to update only if the changed entry is currently playing */
+ if (entry != playing_entry) {
+ return;
+ }
+
+ /* We update only if the artist, title or album has changed */
+ for (t = changes; t; t = t->next)
+ {
+ switch (t->data->prop)
+ {
+ case RHYTHMDB_PROP_TITLE:
+ case RHYTHMDB_PROP_ARTIST:
+ case RHYTHMDB_PROP_ALBUM:
+ rb_shell_player_sync_with_source (player);
+ return;
+ default:
+ break;
+ }
+ }
+}
+
+static void
rb_shell_player_sync_with_source (RBShellPlayer *player)
{
const char *entry_title = NULL;
@@ -1884,7 +1921,6 @@
player->priv->song = NULL;
player->priv->url = NULL;
player->priv->have_url = FALSE;
- player->priv->have_artist_album = FALSE;
if (source == NULL)
rb_shell_player_stop (player);
@@ -1985,9 +2021,6 @@
rb_debug ("no playing source, new source is %p", player->priv->selected_source);
player->priv->have_url = rb_source_have_url (player->priv->selected_source);
-
- player->priv->have_artist_album
- = rb_source_have_artist_album (player->priv->selected_source);
rb_shell_player_sync_with_source (player);
}
Index: sources/rb-iradio-source.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/sources/rb-iradio-source.c,v
retrieving revision 1.81
diff -u -r1.81 rb-iradio-source.c
--- sources/rb-iradio-source.c 29 Aug 2005 22:00:35 -0000 1.81
+++ sources/rb-iradio-source.c 29 Aug 2005 23:10:55 -0000
@@ -215,7 +215,6 @@
source_class->impl_song_properties = impl_song_properties;
source_class->impl_can_pause = (RBSourceFeatureFunc) rb_false_function;
source_class->impl_handle_eos = impl_handle_eos;
- source_class->impl_have_artist_album = (RBSourceFeatureFunc) rb_false_function;
source_class->impl_have_url = (RBSourceFeatureFunc) rb_true_function;
source_class->impl_show_popup = impl_show_popup;
source_class->impl_can_copy = (RBSourceFeatureFunc) rb_false_function;
Index: sources/rb-library-source.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/sources/rb-library-source.c,v
retrieving revision 1.110
diff -u -r1.110 rb-library-source.c
--- sources/rb-library-source.c 28 Aug 2005 20:00:59 -0000 1.110
+++ sources/rb-library-source.c 29 Aug 2005 23:10:59 -0000
@@ -119,8 +119,6 @@
static void impl_reset_filters (RBSource *source);
static GtkWidget *impl_get_config_widget (RBSource *source);
static void impl_song_properties (RBSource *source);
-static const char * impl_get_artist (RBSource *player);
-static const char * impl_get_album (RBSource *player);
static gboolean impl_receive_drag (RBSource *source, GtkSelectionData *data);
static gboolean impl_show_popup (RBSource *source);
static void rb_library_source_do_query (RBLibrarySource *source, RBLibraryQueryType qtype);
@@ -276,9 +274,6 @@
source_class->impl_can_copy = (RBSourceFeatureFunc) rb_true_function;
source_class->impl_can_delete = (RBSourceFeatureFunc) rb_true_function;
source_class->impl_delete = impl_delete;
- source_class->impl_have_artist_album = (RBSourceFeatureFunc) rb_true_function;
- source_class->impl_get_artist = impl_get_artist;
- source_class->impl_get_album = impl_get_album;
source_class->impl_have_url = (RBSourceFeatureFunc) rb_false_function;
source_class->impl_receive_drag = impl_receive_drag;
source_class->impl_show_popup = impl_show_popup;
@@ -1079,44 +1074,6 @@
rb_library_source_preferences_sync (source);
return source->priv->config_widget;
}
-
-static const char *
-impl_get_artist (RBSource *asource)
-{
- RBLibrarySource *source = RB_LIBRARY_SOURCE (asource);
- RhythmDBEntry *entry;
-
- g_free (source->priv->artist);
-
- entry = rb_entry_view_get_playing_entry (source->priv->songs);
-
- if (entry != NULL) {
- source->priv->artist = g_strdup (rb_refstring_get (entry->artist));
- } else {
- source->priv->artist = NULL;
- }
-
- return source->priv->artist;
-}
-
-static const char *
-impl_get_album (RBSource *asource)
-{
- RBLibrarySource *source = RB_LIBRARY_SOURCE (asource);
- RhythmDBEntry *entry;
-
- g_free (source->priv->artist);
-
- entry = rb_entry_view_get_playing_entry (source->priv->songs);
-
- if (entry != NULL) {
- source->priv->album = g_strdup (rb_refstring_get (entry->album));
- } else {
- source->priv->album = NULL;
- }
- return source->priv->album;
-}
-
static void
rb_library_source_preferences_sync (RBLibrarySource *source)
Index: sources/rb-playlist-source.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/sources/rb-playlist-source.c,v
retrieving revision 1.71
diff -u -r1.71 rb-playlist-source.c
--- sources/rb-playlist-source.c 27 Aug 2005 12:12:13 -0000 1.71
+++ sources/rb-playlist-source.c 29 Aug 2005 23:11:00 -0000
@@ -206,7 +206,6 @@
source_class->impl_delete = impl_delete;
source_class->impl_song_properties = impl_song_properties;
source_class->impl_can_pause = (RBSourceFeatureFunc) rb_true_function;
- source_class->impl_have_artist_album = (RBSourceFeatureFunc) rb_true_function;
source_class->impl_have_url = (RBSourceFeatureFunc) rb_false_function;
source_class->impl_receive_drag = impl_receive_drag;
source_class->impl_show_popup = impl_show_popup;