[snappy] snappy: only loop back in last element
- From: Luis de Bethencourt <luisbg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [snappy] snappy: only loop back in last element
- Date: Mon, 20 Aug 2012 13:41:14 +0000 (UTC)
commit cabccea19c44009eb5ffe207a8b4c9ffe1c5a755
Author: Luis de Bethencourt <luis debethencourt com>
Date: Mon Aug 20 14:40:58 2012 +0100
snappy: only loop back in last element
If a list of files to play is provided, only loop the last one or else only the
first file will be played again and again.
src/gst_engine.c | 2 +-
src/user_interface.c | 11 +++++++++++
src/user_interface.h | 1 +
3 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/src/gst_engine.c b/src/gst_engine.c
index a09a82b..9cc9c73 100644
--- a/src/gst_engine.c
+++ b/src/gst_engine.c
@@ -400,7 +400,7 @@ stream_done (GstEngine * engine, UserInterface * ui)
/* When URI is done or looping remove from unfinished list */
remove_uri_unfinished_playback (engine, engine->uri);
- if (engine->loop) {
+ if (engine->loop && (interface_is_it_last (ui))) {
engine_seek (engine, 0, TRUE);
} else {
interface_play_next_or_prev (ui, TRUE);
diff --git a/src/user_interface.c b/src/user_interface.c
index d0e4455..1de4d90 100644
--- a/src/user_interface.c
+++ b/src/user_interface.c
@@ -1024,6 +1024,17 @@ interface_init (UserInterface * ui)
}
gboolean
+interface_is_it_last (UserInterface * ui)
+{
+ GList *element;
+
+ element = g_list_find (ui->uri_list, ui->engine->uri);
+ element = g_list_next (element);
+
+ return (element == NULL);
+}
+
+gboolean
interface_load_uri (UserInterface * ui, gchar * uri)
{
ui->fileuri = uri;
diff --git a/src/user_interface.h b/src/user_interface.h
index 6264141..20d38cd 100644
--- a/src/user_interface.h
+++ b/src/user_interface.h
@@ -118,6 +118,7 @@ struct _UserInterface
// Declaration of non-static functions
void interface_init (UserInterface * ui);
+gboolean interface_is_it_last (UserInterface * ui);
gboolean interface_load_uri (UserInterface * ui, gchar * uri);
void interface_play_next_or_prev (UserInterface * ui, gboolean next);
void interface_start (UserInterface * ui, gchar * uri);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]