[rhythmbox] mpris: fix the playback_state member of the status structure



commit 90b531633b1f859a02013a9d44ed53e5648584f6
Author: Jonathan Matthew <jonathan d14n org>
Date:   Mon Jul 19 20:14:32 2010 +1000

    mpris: fix the playback_state member of the status structure

 plugins/mpris/rb-mpris-plugin.c |   25 ++++++++++++++++++++-----
 1 files changed, 20 insertions(+), 5 deletions(-)
---
diff --git a/plugins/mpris/rb-mpris-plugin.c b/plugins/mpris/rb-mpris-plugin.c
index ef72dd3..102f5a8 100644
--- a/plugins/mpris/rb-mpris-plugin.c
+++ b/plugins/mpris/rb-mpris-plugin.c
@@ -276,14 +276,29 @@ build_track_metadata (RBMprisPlugin *plugin,
 static GVariant *
 get_player_state (RBMprisPlugin *plugin, GError **error)
 {
-	gboolean playing;
+	RhythmDBEntry *entry;
+	int playback_state;
 	gboolean random;
 	gboolean repeat;
 	gboolean loop;
 
-	playing = FALSE;
-	if (rb_shell_player_get_playing (plugin->player, &playing, error) == FALSE) {
-		return NULL;
+	entry = rb_shell_player_get_playing_entry (plugin->player);
+	if (entry != NULL) {
+		gboolean playing;
+
+		rhythmdb_entry_unref (entry);
+		playing = FALSE;
+		if (rb_shell_player_get_playing (plugin->player, &playing, error) == FALSE) {
+			return NULL;
+		}
+
+		if (playing) {
+			playback_state = 0;
+		} else {
+			playback_state = 1;
+		}
+	} else {
+		playback_state = 2;
 	}
 
 	random = FALSE;
@@ -293,7 +308,7 @@ get_player_state (RBMprisPlugin *plugin, GError **error)
 	/* repeat is not supported */
 	repeat = FALSE;
 
-	return g_variant_new ("((iiii))", playing, random, repeat, loop);
+	return g_variant_new ("((iiii))", playback_state, random, repeat, loop);
 }
 
 static void



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