[Xfce4-commits] [apps/parole] 01/02: Fix bug 12010.
noreply at xfce.org
noreply at xfce.org
Fri May 26 03:38:42 CEST 2017
This is an automated email from the git hooks/post-receive script.
b l u e s a b r e p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository apps/parole.
commit 7197bd375f2bd59b253696662f4211abe2b70e91
Author: Julien Sopik <jsopik81-xfce-dev at yahoo.fr>
Date: Fri Sep 2 17:46:01 2016 +0200
Fix bug 12010.
Add a control on a new variable, n_shuffled_items, to insure that
(almost) all items are played only once when Shuffle mode is enabled.
TODO:
Restore the Repeat mode when both Shuffle and Repeat modes are enabled.
Signed-off-by: Sean Davis <smd.seandavis at gmail.com>
---
src/parole-medialist.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/src/parole-medialist.c b/src/parole-medialist.c
index cb5b586..3e26d08 100644
--- a/src/parole-medialist.c
+++ b/src/parole-medialist.c
@@ -181,6 +181,10 @@ struct ParoleMediaListPrivate
GtkWidget *shuffle_button;
char *history[3];
+ /*
+ * n_shuffled_items stores the number of already shuffled items in the list.
+ */
+ guint n_shuffled_items;
};
enum
@@ -1863,11 +1867,26 @@ GtkTreeRowReference *parole_media_list_get_row_random (ParoleMediaList *list)
return NULL;
}
+ if (nch == list->priv->n_shuffled_items)
+ {
+ /* Stop playing since (almost) every items in the list have been chosen */
+ list->priv->n_shuffled_items = 0;
+ return NULL;
+ }
+
current_path = gtk_tree_path_to_string(gtk_tree_row_reference_get_path(parole_media_list_get_selected_row(list)));
path_str = g_strdup(current_path);
if (!list->priv->history[0])
+ {
list->priv->history[0] = g_strdup(path_str);
+ }
+
+ if (list->priv->n_shuffled_items == 0)
+ {
+ list->priv->n_shuffled_items = 1;
+ }
+
while (g_strcmp0(list->priv->history[0], path_str) == 0 || g_strcmp0(list->priv->history[1], path_str) == 0 || g_strcmp0(list->priv->history[2], path_str) == 0 || g_strcmp0(current_path, path_str) == 0)
{
@@ -1887,6 +1906,7 @@ GtkTreeRowReference *parole_media_list_get_row_random (ParoleMediaList *list)
if ( gtk_tree_model_get_iter (GTK_TREE_MODEL (list->priv->store), &iter, path))
{
row = gtk_tree_row_reference_new (GTK_TREE_MODEL (list->priv->store), path);
+ list->priv->n_shuffled_items += 1;
}
gtk_tree_path_free (path);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list