+
+/*****************************************************************************
+ * Interface callbacks
+ *****************************************************************************
+ * The following callbacks are related to the main interface window.
+ *****************************************************************************/
+void
+on_intf_window_destroy (GtkObject *object,
+ gpointer user_data)
+{
+ intf_thread_t *p_intf = GetIntf( GTK_WIDGET(object), "intf_window" );
+
+ vlc_mutex_lock( &p_intf->change_lock );
+ p_intf->b_die = 1;
+ vlc_mutex_unlock( &p_intf->change_lock );
+}
+
+
+gboolean
+on_slider_button_press_event (GtkWidget *widget,
+ GdkEventButton *event,
+ gpointer user_data)
+{
+ intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), "intf_window" );
+
+ vlc_mutex_lock( &p_intf->change_lock );
+ p_intf->p_sys->b_slider_free = 0;
+ vlc_mutex_unlock( &p_intf->change_lock );
+
+ return FALSE;
+}
+
+
+gboolean
+on_slider_button_release_event (GtkWidget *widget,
+ GdkEventButton *event,
+ gpointer user_data)
+{
+ intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), "intf_window" );
+
+ vlc_mutex_lock( &p_intf->change_lock );
+ p_intf->p_sys->b_slider_free = 1;
+ vlc_mutex_unlock( &p_intf->change_lock );
+
+ return FALSE;
+}
+
+
+void
+on_intf_window_drag_data_received (GtkWidget *widget,
+ GdkDragContext *drag_context,
+ gint x,
+ gint y,
+ GtkSelectionData *data,
+ guint info,
+ guint time,
+ gpointer user_data)
+{
+ char *psz_text = data->data;
+ int i_len = strlen( psz_text );
+
+ switch( info )
+ {
+ case DROP_ACCEPT_TEXT_PLAIN: /* FIXME: handle multiple files */
+
+ if( i_len < 1 )
+ {
+ return;
+ }
+
+ /* get rid of ' ' at the end */
+ *( psz_text + i_len - 1 ) = 0;
+
+ intf_WarnMsg( 1, "intf: dropped text/uri-list data `%s'", psz_text );
+ intf_PlaylistAdd( p_main->p_playlist, PLAYLIST_END, psz_text );
+
+ break;
+
+ case DROP_ACCEPT_TEXT_URI_LIST: /* FIXME: handle multiple files */
+
+ if( i_len < 2 )
+ {
+ return;
+ }
+
+ /* get rid of \r\n at the end */
+ *( psz_text + i_len - 2 ) = 0;
+
+ intf_WarnMsg( 1, "intf: dropped text/uri-list data `%s'", psz_text );
+ intf_PlaylistAdd( p_main->p_playlist, PLAYLIST_END, psz_text );
+ break;
+
+ default:
+
+ intf_ErrMsg( "intf error: unknown dropped type");
+ break;
+ }
+}
+
+
+void
+on_button_title_prev_clicked (GtkButton *button,
+ gpointer user_data)
+{
+ intf_thread_t * p_intf;
+ input_area_t * p_area;
+ int i_id;
+
+ p_intf = GetIntf( GTK_WIDGET(button), "intf_window" );
+ i_id = p_intf->p_input->stream.p_selected_area->i_id - 1;
+
+ if( i_id >= 0 )
+ {
+ p_area = p_intf->p_input->stream.pp_areas[i_id];
+ p_intf->p_input->pf_set_area( p_intf->p_input, (input_area_t*)p_area );
+
+ input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
+
+ p_intf->p_sys->b_title_update = 1;
+ }
+}
+
+
+void
+on_button_title_next_clicked (GtkButton *button,
+ gpointer user_data)
+{
+ intf_thread_t * p_intf;
+ input_area_t * p_area;
+ int i_id;
+
+ p_intf = GetIntf( GTK_WIDGET(button), "intf_window" );
+ i_id = p_intf->p_input->stream.p_selected_area->i_id + 1;
+
+ if( i_id < p_intf->p_input->stream.i_area_nb )
+ {
+ p_area = p_intf->p_input->stream.pp_areas[i_id];
+ p_intf->p_input->pf_set_area( p_intf->p_input, (input_area_t*)p_area );
+
+ input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
+
+ p_intf->p_sys->b_title_update = 1;
+ }
+}
+
+
+void
+on_button_chapter_prev_clicked (GtkButton *button,
+ gpointer user_data)
+{
+ intf_thread_t * p_intf;
+ input_area_t * p_area;
+
+ p_intf = GetIntf( GTK_WIDGET(button), "intf_window" );
+ p_area = p_intf->p_input->stream.p_selected_area;
+
+ if( p_area->i_part > 0 )
+ {
+ p_area->i_part--;
+ p_intf->p_input->pf_set_area( p_intf->p_input, (input_area_t*)p_area );
+
+ input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
+
+ p_intf->p_sys->b_chapter_update = 1;
+ }
+}
+
+
+void
+on_button_chapter_next_clicked (GtkButton *button,
+ gpointer user_data)
+{
+ intf_thread_t * p_intf;
+ input_area_t * p_area;
+
+ p_intf = GetIntf( GTK_WIDGET(button), "intf_window" );
+ p_area = p_intf->p_input->stream.p_selected_area;
+
+ if( p_area->i_part < p_area->i_part_nb )
+ {
+ p_area->i_part++;
+ p_intf->p_input->pf_set_area( p_intf->p_input, (input_area_t*)p_area );
+
+ input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
+
+ p_intf->p_sys->b_chapter_update = 1;
+ }
+}
+
+