Commit f10e7d73 authored by Luis de Bethencourt's avatar Luis de Bethencourt

ui: move next and previous uri to same function

parent 900aeb5f
...@@ -366,7 +366,7 @@ void stream_done (GstEngine * engine, UserInterface *ui) ...@@ -366,7 +366,7 @@ void stream_done (GstEngine * engine, UserInterface *ui)
if (engine->loop) { if (engine->loop) {
engine_seek (engine, 0, TRUE); engine_seek (engine, 0, TRUE);
} else { } else {
interface_play_next (ui); interface_play_next_or_prev (ui, TRUE);
} }
} }
......
...@@ -269,13 +269,13 @@ event_cb (ClutterStage * stage, ClutterEvent * event, UserInterface * ui) ...@@ -269,13 +269,13 @@ event_cb (ClutterStage * stage, ClutterEvent * event, UserInterface * ui)
case CLUTTER_less: case CLUTTER_less:
{ {
interface_play_prev (ui); interface_play_next_or_prev (ui, FALSE);
break; break;
} }
case CLUTTER_greater: case CLUTTER_greater:
{ {
interface_play_next (ui); interface_play_next_or_prev (ui, TRUE);
break; break;
} }
...@@ -1049,42 +1049,26 @@ interface_load_uri (UserInterface * ui, gchar * uri) ...@@ -1049,42 +1049,26 @@ interface_load_uri (UserInterface * ui, gchar * uri)
} }
void void
interface_play_next (UserInterface * ui) interface_play_next_or_prev (UserInterface *ui, gboolean next)
{ {
GList * next; GList * element;
gchar * next_uri; gchar * uri;
next = g_list_find (ui->uri_list, ui->engine->uri); element = g_list_find (ui->uri_list, ui->engine->uri);
next = g_list_next (next); if (next)
if (next != NULL) { element = g_list_next (element);
next_uri = next->data; else
element = g_list_previous (element);
engine_open_uri (ui->engine, next_uri); if (element != NULL) {
interface_load_uri (ui, next_uri); uri = element->data;
engine_play (ui->engine);
}
}
void engine_open_uri (ui->engine, uri);
interface_play_prev (UserInterface * ui) interface_load_uri (ui, uri);
{
GList * prev;
gchar * prev_uri;
prev = g_list_find (ui->uri_list, ui->engine->uri);
g_print ("1. prev = %s", prev->data);
prev = g_list_previous (prev);
g_print ("2. prev = %s", prev->data);
if (prev != NULL) {
prev_uri = prev->data;
engine_open_uri (ui->engine, prev_uri);
interface_load_uri (ui, prev_uri);
engine_play (ui->engine); engine_play (ui->engine);
} }
} }
void void
interface_start (UserInterface * ui, gchar * uri) interface_start (UserInterface * ui, gchar * uri)
{ {
......
...@@ -117,8 +117,7 @@ struct _UserInterface ...@@ -117,8 +117,7 @@ struct _UserInterface
// Declaration of non-static functions // Declaration of non-static functions
void interface_init (UserInterface * ui); void interface_init (UserInterface * ui);
gboolean interface_load_uri (UserInterface * ui, gchar * uri); gboolean interface_load_uri (UserInterface * ui, gchar * uri);
void interface_play_next (UserInterface * ui); void interface_play_next_or_prev (UserInterface * ui, gboolean next);
void interface_play_prev (UserInterface * ui);
void interface_start (UserInterface * ui, gchar * uri); void interface_start (UserInterface * ui, gchar * uri);
gboolean interface_update_controls (UserInterface * ui); gboolean interface_update_controls (UserInterface * ui);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment