[snappy] ui: press '<' to play previous uri in the list



commit 900aeb5f5bfd930cd571410a9aef61db9b6156a3
Author: Luis de Bethencourt <luis debethencourt com>
Date:   Fri May 4 12:10:51 2012 +0100

    ui: press '<' to play previous uri in the list

 docs/keyboard_controls |    1 +
 src/user_interface.c   |   27 ++++++++++++++++++++++++++-
 src/user_interface.h   |    1 +
 3 files changed, 28 insertions(+), 1 deletions(-)
---
diff --git a/docs/keyboard_controls b/docs/keyboard_controls
index 7ee2c4a..4021cb8 100644
--- a/docs/keyboard_controls
+++ b/docs/keyboard_controls
@@ -17,6 +17,7 @@ right      - seek 10 seconds foward
 9          - turn volume up
 0          - turn volume down
 
+<          - play previous
 >          - play next
 
 c          - show/hide visual controls
diff --git a/src/user_interface.c b/src/user_interface.c
index 6382b5b..0556430 100644
--- a/src/user_interface.c
+++ b/src/user_interface.c
@@ -267,10 +267,15 @@ event_cb (ClutterStage * stage, ClutterEvent * event, UserInterface * ui)
           break;
         }
 
+        case CLUTTER_less:
+        {
+          interface_play_prev (ui);
+          break;
+        }
+
         case CLUTTER_greater:
         {
           interface_play_next (ui);
-
           break;
         }
 
@@ -1061,6 +1066,26 @@ interface_play_next (UserInterface * ui)
 }
 
 void
+interface_play_prev (UserInterface * ui)
+{
+  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);
+  }
+}
+
+
+void
 interface_start (UserInterface * ui, gchar * uri)
 {
   ClutterColor stage_color = { 0x00, 0x00, 0x00, 0x00 };
diff --git a/src/user_interface.h b/src/user_interface.h
index e8efa2e..cbbf5f9 100644
--- a/src/user_interface.h
+++ b/src/user_interface.h
@@ -118,6 +118,7 @@ struct _UserInterface
 void interface_init (UserInterface * ui);
 gboolean interface_load_uri (UserInterface * ui, gchar * uri);
 void interface_play_next (UserInterface * ui);
+void interface_play_prev (UserInterface * ui);
 void interface_start (UserInterface * ui, gchar * uri);
 gboolean interface_update_controls (UserInterface * ui);
 



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