Commit 6f0b8197 authored by gbazin's avatar gbazin

More improvements to the hildon interface and make it compilable on non-maemo platforms

parent caa08dce
......@@ -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])
......
......@@ -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);
......
......@@ -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
......
......@@ -30,11 +30,37 @@
#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;
}
......
......@@ -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 );
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