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 ),
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 );
#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",
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);
#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 );
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 )
}
}
-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 ) )
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;
{
(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 )
{
}
}
-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;
}
#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 );
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 );