All pastes #21555 Raw Edit

kikidonk

public text v1 · immutable
#21555 ·published 2005-08-29 22:59 UTC
rendered paste body
Index: 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 22:56:24 -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,17 @@
 }
 
 static void
+rb_shell_player_entry_changed_cb (RhythmDB *db, RhythmDBEntry *entry,
+				       GSList *changes, RBShellPlayer *player)
+{
+	RhythmDBEntry *playing_entry = rb_shell_player_get_playing_entry (player);
+	if (entry == playing_entry)
+	{
+		rb_shell_player_sync_with_source (player);
+	}
+}
+
+static void
 rb_shell_player_sync_with_source (RBShellPlayer *player)
 {
 	const char *entry_title = NULL;
@@ -1884,7 +1904,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);
@@ -1986,9 +2005,6 @@
 
 		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);
 	}
 }