rhythmbox r5698 - in trunk: . shell



Author: jmatthew
Date: Sat May  3 21:57:53 2008
New Revision: 5698
URL: http://svn.gnome.org/viewvc/rhythmbox?rev=5698&view=rev

Log:
2008-05-04  Jonathan Matthew  <jonathan d14n org>

	* shell/rb-play-order-queue.c: (rb_queue_play_order_get_next):
	Rather than returning the entry after the current playing entry,
	return the earliest entry in the query model that isn't already
	playing.  This makes the queue behave a little better when it gets
	shuffled or otherwise played out of order.

	* shell/rb-shell-player.c: (rb_shell_player_entry_activated_cb):
	When an entry in the queue is activated, don't move it to the start of
	the queue; the above change makes this work properly without looking
	weird.


Modified:
   trunk/ChangeLog
   trunk/shell/rb-play-order-queue.c
   trunk/shell/rb-shell-player.c

Modified: trunk/shell/rb-play-order-queue.c
==============================================================================
--- trunk/shell/rb-play-order-queue.c	(original)
+++ trunk/shell/rb-play-order-queue.c	Sat May  3 21:57:53 2008
@@ -90,6 +90,8 @@
 {
 	RhythmDBQueryModel *model;
 	RhythmDBEntry *entry;
+	RhythmDBEntry *first;
+	GtkTreeIter iter;
 
 	g_return_val_if_fail (porder != NULL, NULL);
 	g_return_val_if_fail (RB_IS_QUEUE_PLAY_ORDER (porder), NULL);
@@ -98,17 +100,33 @@
 	if (model == NULL)
 		return NULL;
 
+	/* the play queue should try to play the earliest entry in the
+	 * query model that it can.  so there are three possible cases here:
+	 *
+	 * - we have no current playing entry, so return the first
+	 * - the current playing entry is the first, so return the next
+	 * - the current playing entry is not the first, so return the first
+	 */
+
 	g_object_get (porder, "playing-entry", &entry, NULL);
+
+	if (!gtk_tree_model_get_iter_first (GTK_TREE_MODEL (model), &iter)) {
+		first = NULL;
+	} else {
+		first = rhythmdb_query_model_iter_to_entry (model, &iter);
+	}
+
 	if (entry == NULL) {
-		GtkTreeIter iter;
-		if (!gtk_tree_model_get_iter_first (GTK_TREE_MODEL (model), &iter))
-			return NULL;
-		return rhythmdb_query_model_iter_to_entry (model, &iter);
+		return first;
+	} else if (entry != first) {
+		rhythmdb_entry_unref (entry);
+		return first;
 	} else {
 		RhythmDBEntry *next;
 
 		next = rhythmdb_query_model_get_next_from_entry (model, entry);
 		rhythmdb_entry_unref (entry);
+		rhythmdb_entry_unref (first);
 		return next;
 	}
 }

Modified: trunk/shell/rb-shell-player.c
==============================================================================
--- trunk/shell/rb-shell-player.c	(original)
+++ trunk/shell/rb-shell-player.c	Sat May  3 21:57:53 2008
@@ -2397,8 +2397,6 @@
 				player->priv->source = player->priv->selected_source;
 			}
 
-			/* queue entry activated: move it to the start of the queue */
-			rb_static_playlist_source_move_entry (RB_STATIC_PLAYLIST_SOURCE (player->priv->queue_source), entry, 0);
 			rb_shell_player_set_playing_source (player, RB_SOURCE (player->priv->queue_source));
 
 			was_from_queue = FALSE;



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