]> git.sesse.net Git - vlc/commitdiff
More improvements to the hildon interface and make it compilable on non-maemo platforms
authorGildas Bazin <gbazin@videolan.org>
Tue, 9 Feb 2010 18:13:31 +0000 (18:13 +0000)
committerGildas Bazin <gbazin@videolan.org>
Tue, 9 Feb 2010 18:18:14 +0000 (18:18 +0000)
configure.ac
modules/gui/hildon/maemo.c
modules/gui/hildon/maemo_callbacks.c
modules/gui/hildon/maemo_input.c
modules/gui/hildon/maemo_input.h

index 2d84714f825dd235baba61dd37a88c4c1a5820e3..15020b768249b926b8a8cb24007849077d4abd96 100644 (file)
@@ -3992,7 +3992,13 @@ dnl
 AC_ARG_ENABLE(hildon,
   [  --enable-hildon         Hildon touchscreen UI (default disabled)])
 AS_IF([test "${enable_hildon}" = "yes"], [
-  PKG_CHECK_MODULES(HILDON, [hildon-1 hildon-fm-2], [
+  PKG_CHECK_MODULES(HILDON, [hildon-1], [
+    PKG_CHECK_MODULES(HILDON_FM, hildon-fm-2, [
+      VLC_ADD_CFLAGS([hildon],[${HILDON_FM_CFLAGS} -IHAVE_HILDON_FM])
+      VLC_ADD_LIBS([hildon],[${HILDON_FM_LIBS}])
+    ], [
+      AC_MSG_WARN(hildon-fm-2 not found)
+    ])
     VLC_ADD_CFLAGS([hildon],[${HILDON_CFLAGS}])
     VLC_ADD_LIBS([hildon],[${HILDON_LIBS}])
     VLC_ADD_PLUGIN([hildon])
index 6ae8dbf7cd84a2215cfecb61bfdb3016f90f0991..0c6b47a86aac1efe9c9b14063c5b4567d663926f 100644 (file)
@@ -204,7 +204,6 @@ static void *Thread( void *obj )
     play_button = gtk_button_new();
     gtk_button_set_image( GTK_BUTTON( play_button ),
                    gtk_image_new_from_stock( "vlc-play", GTK_ICON_SIZE_BUTTON ) );
-    gtk_widget_set_size_request( play_button, 60, 60);
     p_intf->p_sys->p_play_button = play_button;
     stop_button = gtk_button_new();
     gtk_button_set_image( GTK_BUTTON( stop_button ),
@@ -222,7 +221,7 @@ static void *Thread( void *obj )
     p_intf->p_sys->p_seekbar = HILDON_SEEKBAR( seekbar );
 
     // We add them to the hbox
-    gtk_box_pack_start( GTK_BOX( bottom_hbox ), play_button, FALSE, FALSE, 5 );
+    gtk_box_pack_start( GTK_BOX( bottom_hbox ), play_button, FALSE, FALSE, 0 );
     gtk_box_pack_start( GTK_BOX( bottom_hbox ), stop_button, FALSE, FALSE, 0 );
     gtk_box_pack_start( GTK_BOX( bottom_hbox ), prev_button, FALSE, FALSE, 0 );
     gtk_box_pack_start( GTK_BOX( bottom_hbox ), next_button, FALSE, FALSE, 0 );
@@ -260,8 +259,7 @@ static void *Thread( void *obj )
 #endif
 
     // Set callback with the vlc core
-    g_timeout_add( INTF_IDLE_SLEEP / 1000, process_events, p_intf );
-    g_timeout_add( 150 /* miliseconds */, should_die, p_intf );
+    g_timeout_add( 1000 /* miliseconds */, should_die, p_intf );
     var_AddCallback( p_intf->p_sys->p_playlist, "item-change",
                      item_changed_cb, p_intf );
     var_AddCallback( p_intf->p_sys->p_playlist, "item-current",
@@ -377,8 +375,8 @@ static gboolean interface_ready( gpointer data )
     p_intf->p_sys->xid =
         GDK_WINDOW_XID( gtk_widget_get_window(p_intf->p_sys->p_video_window) );
 
-    // Look if the playlist is already started
-    item_changed_pl( p_intf );
+    // Refresh playlist
+    post_event( p_intf, EVENT_PLAYLIST_CURRENT );
 
     // Everything is initialised
     vlc_sem_post (&p_intf->p_sys->ready);
index 3e8568939df2d82d27490e3b4f762463ba858e1d..a76e9ee3185903bc25bf2e5364c3831d48166a81 100644 (file)
@@ -30,7 +30,7 @@
 #include <gdk/gdkkeysyms.h>
 #include <vlc_keys.h>
 
-#ifdef HAVE_MAEMO
+#ifdef HAVE_HILDON_FM
 # include <hildon/hildon-file-chooser-dialog.h>
 #endif
 
@@ -162,7 +162,7 @@ void open_cb( GtkMenuItem *menuitem, gpointer user_data )
     GtkWidget *dialog;
     char *psz_filename = NULL;
 
-#ifdef HAVE_MAEMO
+#ifdef HAVE_HILDON_FM
     dialog = hildon_file_chooser_dialog_new( GTK_WINDOW( p_intf->p_sys->p_main_window ),
                                              GTK_FILE_CHOOSER_ACTION_OPEN );
 #else
index a4fa3161ddb9af8650852fee6654793ee06bb665..bd33b1d4fff864bfa1aaa825dad82d18c6538333 100644 (file)
 #include "maemo.h"
 #include "maemo_input.h"
 
+/*****************************************************************************
+ * Local prototypes.
+ *****************************************************************************/
+static void update_position( intf_thread_t *p_intf );
+static void item_changed( intf_thread_t *p_intf );
+static void item_changed_pl( intf_thread_t *p_intf );
+
 static int input_event_cb( vlc_object_t *p_this, const char *psz_var,
                            vlc_value_t oldval, vlc_value_t newval, void *param );
+static int interface_changed_cb( vlc_object_t *p_this, const char *psz_var,
+                                 vlc_value_t oldval, vlc_value_t newval,
+                                 void *param );
+static gboolean process_events( gpointer data );
+
+void set_input( intf_thread_t *p_intf, input_thread_t *p_input );
+void delete_input( intf_thread_t *p_intf );
+
 
 
-gboolean process_events( gpointer data )
+/*****************************************************************************
+ * Functions.
+ *****************************************************************************/
+void post_event( intf_thread_t *p_intf, int i_event )
+{
+    vlc_spin_lock( &p_intf->p_sys->event_lock );
+    p_intf->p_sys->i_event |= i_event;
+    vlc_spin_unlock( &p_intf->p_sys->event_lock );
+    g_idle_add( process_events, p_intf );
+}
+
+static gboolean process_events( gpointer data )
 {
     intf_thread_t *p_intf = (intf_thread_t *)data;
     vlc_spin_lock( &p_intf->p_sys->event_lock );
@@ -43,19 +69,19 @@ gboolean process_events( gpointer data )
     p_intf->p_sys->i_event = 0;
 
     vlc_spin_unlock( &p_intf->p_sys->event_lock );
-    if( i_event )
-    {
-        if( i_event & EVENT_PLAYLIST_CURRENT )
-            item_changed_pl( p_intf );
-        if( i_event & EVENT_ACTIVITY )
-            item_changed_pl( p_intf );
-        if( i_event & EVENT_ITEM_CHANGED )
-            item_changed( p_intf );
-        if( i_event & EVENT_INTF_CHANGED )
-            update_position( p_intf );
-    }
 
-    return TRUE;
+    if( !i_event ) return TRUE;
+
+    if( i_event & EVENT_PLAYLIST_CURRENT )
+        item_changed_pl( p_intf );
+    if( i_event & EVENT_ACTIVITY )
+        item_changed_pl( p_intf );
+    if( i_event & EVENT_ITEM_CHANGED )
+        item_changed( p_intf );
+    if( i_event & EVENT_INTF_CHANGED )
+        update_position( p_intf );
+
+    return FALSE;
 }
 
 void set_input( intf_thread_t *p_intf, input_thread_t *p_input )
@@ -88,7 +114,7 @@ void delete_input( intf_thread_t *p_intf )
     }
 }
 
-void item_changed_pl( intf_thread_t *p_intf )
+static void item_changed_pl( intf_thread_t *p_intf )
 {
     if( p_intf->p_sys->p_input &&
         ( p_intf->p_sys->p_input->b_dead || p_intf->p_sys->p_input->b_die ) )
@@ -107,30 +133,30 @@ void item_changed_pl( intf_thread_t *p_intf )
 int playlist_current_cb( vlc_object_t *p_this, const char *psz_var,
                          vlc_value_t oldval, vlc_value_t newval, void *param )
 {
-    (void)p_this; (void)psz_var; (void)oldval; (void)newval;
     intf_thread_t *p_intf = (intf_thread_t *)param;
-    vlc_spin_lock( &p_intf->p_sys->event_lock );
+    (void)p_this; (void)psz_var; (void)oldval; (void)newval;
 
+    vlc_spin_lock( &p_intf->p_sys->event_lock );
     p_intf->p_sys->i_event |= EVENT_PLAYLIST_CURRENT;
-
     vlc_spin_unlock( &p_intf->p_sys->event_lock );
+    g_idle_add( process_events, p_intf );
     return VLC_SUCCESS;
 }
 
 int activity_cb( vlc_object_t *p_this, const char *psz_var,
                  vlc_value_t oldval, vlc_value_t newval, void *param )
 {
-    (void)p_this; (void)psz_var; (void)oldval; (void)newval;
     intf_thread_t *p_intf = (intf_thread_t *)param;
-    vlc_spin_lock( &p_intf->p_sys->event_lock );
+    (void)p_this; (void)psz_var; (void)oldval; (void)newval;
 
+    vlc_spin_lock( &p_intf->p_sys->event_lock );
     p_intf->p_sys->i_event |= EVENT_ACTIVITY;
-
     vlc_spin_unlock( &p_intf->p_sys->event_lock );
+    g_idle_add( process_events, p_intf );
     return VLC_SUCCESS;
 }
 
-void item_changed( intf_thread_t *p_intf )
+static void item_changed( intf_thread_t *p_intf )
 {
     GtkButton *p_button = GTK_BUTTON( p_intf->p_sys->p_play_button );
     vlc_value_t state;
@@ -154,15 +180,15 @@ int item_changed_cb( vlc_object_t *p_this, const char *psz_var,
 {
     (void)p_this; (void)psz_var; (void)oldval; (void)newval;
     intf_thread_t *p_intf = (intf_thread_t *)param;
-    vlc_spin_lock( &p_intf->p_sys->event_lock );
 
+    vlc_spin_lock( &p_intf->p_sys->event_lock );
     p_intf->p_sys->i_event |= EVENT_ITEM_CHANGED;
-
     vlc_spin_unlock( &p_intf->p_sys->event_lock );
+    g_idle_add( process_events, p_intf );
     return VLC_SUCCESS;
 }
 
-void update_position( intf_thread_t *p_intf )
+static void update_position( intf_thread_t *p_intf )
 {
     if( p_intf->p_sys->p_input )
     {
@@ -173,16 +199,17 @@ void update_position( intf_thread_t *p_intf )
     }
 }
 
-int interface_changed_cb( vlc_object_t *p_this, const char *psz_var,
-                          vlc_value_t oldval, vlc_value_t newval, void *param )
+static int interface_changed_cb( vlc_object_t *p_this, const char *psz_var,
+                                 vlc_value_t oldval, vlc_value_t newval,
+                                 void *param )
 {
-    (void)p_this; (void)psz_var; (void)oldval; (void)newval;
     intf_thread_t *p_intf = (intf_thread_t *)param;
-    vlc_spin_lock( &p_intf->p_sys->event_lock );
+    (void)p_this; (void)psz_var; (void)oldval; (void)newval;
 
+    vlc_spin_lock( &p_intf->p_sys->event_lock );
     p_intf->p_sys->i_event |= EVENT_INTF_CHANGED;
-
     vlc_spin_unlock( &p_intf->p_sys->event_lock );
+    g_idle_add( process_events, p_intf );
     return VLC_SUCCESS;
 }
 
index 75ac69a3e9a38f828aad097cc1be43e2086812ec..2286c698f9cde38942ad35683bfd4b674921852a 100644 (file)
@@ -32,7 +32,7 @@
 #define EVENT_ITEM_CHANGED      (1<<3)
 #define EVENT_INTF_CHANGED      (1<<4)
 
-gboolean process_events( gpointer data );
+void post_event( intf_thread_t *p_intf, int event );
 
 void set_input( intf_thread_t *p_intf, input_thread_t *p_input );
 void delete_input( intf_thread_t *p_intf );
@@ -41,12 +41,6 @@ int playlist_current_cb( vlc_object_t *p_this, const char *psz_var,
                          vlc_value_t oldval, vlc_value_t newval, void *param );
 int activity_cb( vlc_object_t *p_this, const char *psz_var,
                  vlc_value_t oldval, vlc_value_t newval, void *param );
-void item_changed_pl( intf_thread_t *p_intf );
 
 int item_changed_cb( vlc_object_t *p_this, const char *psz_var,
                      vlc_value_t oldval, vlc_value_t newval, void *param );
-void item_changed( intf_thread_t *p_intf );
-
-int interface_changed_cb( vlc_object_t *p_this, const char *psz_var,
-                          vlc_value_t oldval, vlc_value_t newval, void *param );
-void update_position( intf_thread_t *p_intf );