totem r6213 - in branches/gnome-2-26: . src



Author: hadess
Date: Wed Apr  1 14:18:18 2009
New Revision: 6213
URL: http://svn.gnome.org/viewvc/totem?rev=6213&view=rev

Log:
2009-04-01  Bastien Nocera  <hadess hadess net>

	* src/totem-playlist.c (ensure_shuffled): Patch from
	Pascal Sachs <psachs student ethz ch> to make sure all the items
	are played when a playlist is shuffled but not in repeat mode
	(Closes: #561949)



Modified:
   branches/gnome-2-26/ChangeLog
   branches/gnome-2-26/src/totem-playlist.c

Modified: branches/gnome-2-26/src/totem-playlist.c
==============================================================================
--- branches/gnome-2-26/src/totem-playlist.c	(original)
+++ branches/gnome-2-26/src/totem-playlist.c	Wed Apr  1 14:18:18 2009
@@ -1383,7 +1383,7 @@
 {
 	RandomData data;
 	GArray *array;
-	int i, current;
+	int i, current, current_new;
 	int *indices;
 
 	if (shuffle == FALSE || PL_LEN != playlist->priv->shuffle_len)
@@ -1402,6 +1402,8 @@
 	} else {
 		current = -1;
 	}
+	
+	current_new = -1;
 
 	playlist->priv->shuffled = g_new (int, PL_LEN);
 	playlist->priv->shuffle_len = PL_LEN;
@@ -1426,7 +1428,13 @@
 
 		if (playlist->priv->current != NULL
 				&& playlist->priv->shuffled[i] == current)
-			playlist->priv->current_shuffled = i;
+			current_new = i;
+	}
+
+	if (current_new > -1) {
+		playlist->priv->shuffled[current_new] = playlist->priv->shuffled[0];
+		playlist->priv->shuffled[0] = current;
+		playlist->priv->current_shuffled = 0;
 	}
 
 	g_array_free (array, TRUE);



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