Commit 32ef13cf authored by Stéphane Borel's avatar Stéphane Borel

*Bugfixes, cleanings in gtk.

parent 9530fc9f
......@@ -10,7 +10,7 @@
* -dvd_udf to find files
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: input_dvd.c,v 1.58 2001/05/15 01:01:44 stef Exp $
* $Id: input_dvd.c,v 1.59 2001/05/15 14:49:47 stef Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......@@ -1043,7 +1043,7 @@ static int DVDRead( input_thread_t * p_input,
p_input->stream.p_selected_area->i_tell = i_off -
p_input->stream.p_selected_area->i_start;
p_input->stream.p_selected_area->i_part = p_dvd->i_chapter;
intf_WarnMsg( 2, "chapter %d", p_dvd->i_chapter);
/* the synchro has to be reinitialized when we change cell */
p_input->stream.pp_programs[0]->i_synchro_state = SYNCHRO_REINIT;
......
......@@ -2,7 +2,7 @@
* gtk_callbacks.c : Callbacks for the Gtk+ plugin.
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: gtk_callbacks.c,v 1.17 2001/05/15 01:01:44 stef Exp $
* $Id: gtk_callbacks.c,v 1.18 2001/05/15 14:49:48 stef Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Stphane Borel <stef@via.ecp.fr>
......@@ -66,10 +66,9 @@
* Main interface callbacks
*/
gboolean
GtkExit (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data)
gboolean GtkExit( GtkWidget *widget,
GdkEventButton *event,
gpointer user_data )
{
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), (char*)user_data );
......@@ -80,10 +79,9 @@ GtkExit (GtkWidget *widget,
return TRUE;
}
gboolean
GtkWindowDelete (GtkWidget *widget,
GdkEvent *event,
gpointer user_data)
gboolean GtkWindowDelete( GtkWidget *widget,
GdkEvent *event,
gpointer user_data )
{
GtkExit( GTK_WIDGET( widget ), NULL, user_data );
......@@ -91,10 +89,9 @@ GtkWindowDelete (GtkWidget *widget,
}
gboolean
GtkWindowToggle (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data)
gboolean GtkWindowToggle( GtkWidget *widget,
GdkEventButton *event,
gpointer user_data )
{
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), (char*)user_data );
......@@ -111,36 +108,38 @@ GtkWindowToggle (GtkWidget *widget,
return TRUE;
}
gboolean
GtkFullscreen (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data)
gboolean GtkFullscreen( GtkWidget *widget,
GdkEventButton *event,
gpointer user_data)
{
if( p_vout_bank->i_count )
{
vlc_mutex_lock( &p_vout_bank->pp_vout[0]->change_lock );
if( p_vout_bank->pp_vout[0]->b_fullscreen ==
!GTK_CHECK_MENU_ITEM( widget )->active )
p_vout_bank->pp_vout[0]->i_changes |= VOUT_FULLSCREEN_CHANGE;
p_vout_bank->pp_vout[0]->i_changes |= VOUT_FULLSCREEN_CHANGE;
vlc_mutex_unlock( &p_vout_bank->pp_vout[0]->change_lock );
}
return TRUE;
return TRUE;
}
else
{
return FALSE;
}
}
void
GtkWindowDrag (GtkWidget *widget,
GdkDragContext *drag_context,
gint x,
gint y,
GtkSelectionData *data,
guint info,
guint time,
gpointer user_data)
void GtkWindowDrag( GtkWidget *widget,
GdkDragContext *drag_context,
gint x,
gint y,
GtkSelectionData *data,
guint info,
guint time,
gpointer user_data)
{
intf_thread_t * p_intf = GetIntf( GTK_WIDGET(widget), "intf_window" );
int end = p_main->p_playlist->i_size;
GtkDropDataReceived( p_intf, data, info, PLAYLIST_END);
GtkDropDataReceived( p_intf, data, info, PLAYLIST_END );
if( p_intf->p_input != NULL )
{
......@@ -149,15 +148,16 @@ GtkWindowDrag (GtkWidget *widget,
}
intf_PlaylistJumpto( p_main->p_playlist, end-1 );
p_main->p_playlist->b_stopped = 0;
}
/****************************************************************************
* Slider management
****************************************************************************/
gboolean
GtkSliderRelease (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data)
gboolean GtkSliderRelease( GtkWidget *widget,
GdkEventButton *event,
gpointer user_data )
{
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), "intf_window" );
......@@ -169,10 +169,9 @@ GtkSliderRelease (GtkWidget *widget,
}
gboolean
GtkSliderPress (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data)
gboolean GtkSliderPress( GtkWidget *widget,
GdkEventButton *event,
gpointer user_data)
{
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), "intf_window" );
......@@ -184,9 +183,11 @@ GtkSliderPress (GtkWidget *widget,
}
void
GtkTitlePrev (GtkButton *button,
gpointer user_data)
/****************************************************************************
* DVD specific items
****************************************************************************/
void GtkTitlePrev( GtkButton * button, gpointer user_data )
{
intf_thread_t * p_intf;
input_area_t * p_area;
......@@ -208,15 +209,13 @@ GtkTitlePrev (GtkButton *button,
}
void
GtkTitleNext (GtkButton *button,
gpointer user_data)
void GtkTitleNext( 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" );
p_intf = GetIntf( GTK_WIDGET(button), (char*)user_data );
i_id = p_intf->p_input->stream.p_selected_area->i_id + 1;
if( i_id < p_intf->p_input->stream.i_area_nb )
......@@ -232,9 +231,7 @@ GtkTitleNext (GtkButton *button,
}
void
GtkChapterPrev (GtkButton *button,
gpointer user_data)
void GtkChapterPrev( GtkButton * button, gpointer user_data )
{
intf_thread_t * p_intf;
input_area_t * p_area;
......@@ -254,9 +251,7 @@ GtkChapterPrev (GtkButton *button,
}
void
GtkChapterNext (GtkButton *button,
gpointer user_data)
void GtkChapterNext( GtkButton * button, gpointer user_data )
{
intf_thread_t * p_intf;
input_area_t * p_area;
......@@ -378,94 +373,42 @@ GtkJumpCancel (GtkButton *button,
}
void
GtkFileOpenActivate (GtkMenuItem *menuitem,
gpointer user_data)
{
GtkFileOpenShow( GTK_WIDGET( menuitem ), NULL, user_data );
}
void
GtkDiscOpenActivate (GtkMenuItem *menuitem,
gpointer user_data)
{
GtkDiscOpenShow( GTK_WIDGET( menuitem ), NULL, user_data );
}
void
GtkNetworkOpenActivate (GtkMenuItem *menuitem,
gpointer user_data)
{
GtkNetworkOpenShow( GTK_WIDGET( menuitem ), NULL, user_data );
}
void
GtkExitActivate (GtkMenuItem *menuitem,
gpointer user_data)
/****************************************************************************
* Callbacks for menuitems
****************************************************************************/
void GtkExitActivate( GtkMenuItem * menuitem, gpointer user_data )
{
GtkExit( GTK_WIDGET( menuitem ), NULL, user_data );
}
void
GtkWindowToggleActivate (GtkMenuItem *menuitem,
gpointer user_data)
{
GtkWindowToggle( GTK_WIDGET( menuitem ), NULL, user_data );
}
void
GtkFullscreenActivate (GtkMenuItem *menuitem,
gpointer user_data)
void GtkFullscreenActivate( GtkMenuItem * menuitem, gpointer user_data )
{
GtkFullscreen( GTK_WIDGET( menuitem ), NULL, user_data );
}
void
GtkPlaylistActivate (GtkMenuItem *menuitem,
gpointer user_data)
void GtkWindowToggleActivate( GtkMenuItem * menuitem, gpointer user_data )
{
GtkPlaylistShow( GTK_WIDGET( menuitem ), NULL, user_data );
GtkWindowToggle( GTK_WIDGET( menuitem ), NULL, user_data );
}
void
GtkModulesActivate (GtkMenuItem *menuitem,
gpointer user_data)
void GtkAboutActivate( GtkMenuItem * menuitem, gpointer user_data )
{
GtkAboutShow( GTK_WIDGET( menuitem ), NULL, user_data );
}
void
GtkPreferencesActivate (GtkMenuItem *menuitem,
gpointer user_data)
void GtkJumpActivate( GtkMenuItem * menuitem, gpointer user_data )
{
GtkPreferencesShow( GTK_WIDGET( menuitem ), NULL, user_data );
GtkJumpShow( GTK_WIDGET( menuitem ), NULL, user_data );
}
void
GtkAboutActivate (GtkMenuItem *menuitem,
GtkPlaylistDestroy (GtkObject *object,
gpointer user_data)
{
GtkAboutShow( GTK_WIDGET( menuitem ), NULL, user_data );
}
void
GtkJumpActivate (GtkMenuItem *menuitem,
gpointer user_data)
{
GtkJumpShow( GTK_WIDGET( menuitem ), NULL, user_data );
}
......@@ -8,294 +8,32 @@
/* General glade callbacks */
gboolean
GtkExit (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data);
gboolean
GtkWindowToggle (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data);
gboolean
GtkSliderRelease (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data);
gboolean
GtkSliderPress (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data);
void
GtkTitlePrev (GtkButton *button,
gpointer user_data);
void
GtkTitleNext (GtkButton *button,
gpointer user_data);
void
GtkChapterPrev (GtkButton *button,
gpointer user_data);
void
GtkChapterNext (GtkButton *button,
gpointer user_data);
gboolean
GtkFullscreen (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data);
gboolean
GtkAboutShow (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data);
void GtkAboutOk( GtkButton * button, gpointer user_data);
void
GtkWindowDrag (GtkWidget *widget,
GdkDragContext *drag_context,
gint x,
gint y,
GtkSelectionData *data,
guint info,
guint time,
gpointer user_data);
gboolean
GtkWindowDelete (GtkWidget *widget,
GdkEvent *event,
gpointer user_data);
gboolean
GtkJumpShow (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data);
void
GtkJumpOk (GtkButton *button,
gpointer user_data);
void
GtkJumpCancel (GtkButton *button,
gpointer user_data);
gboolean
GtkDiscOpenShow (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data);
gboolean
GtkFileOpenShow (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data);
gboolean
GtkNetworkOpenShow (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data);
void
on_menubar_open_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_menubar_open_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_menubar_disc_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_menubar_network_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_menubar_exit_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_menubar_interface_hide_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_menubar_fullscreen_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_menubar_playlist_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_menubar_modules_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_menubar_preferences_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_menubar_about_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_popup_play_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_popup_pause_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_popup_stop_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_popup_back_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_popup_slow_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_popup_fast_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_popup_interface_toggle_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_popup_fullscreen_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_popup_next_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_popup_prev_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_popup_jump_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_popup_file_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_popup_disc_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_popup_network_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_popup_about_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_popup_playlist_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_popup_preferences_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_popup_exit_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
GtkPreferencesOk (GtkButton *button,
gpointer user_data);
void
GtkPreferencesApply (GtkButton *button,
gpointer user_data);
void
GtkPreferencesCancel (GtkButton *button,
gpointer user_data);
void
GtkFileOpenActivate (GtkMenuItem *menuitem,
gpointer user_data);
void
GtkDiscOpenActivate (GtkMenuItem *menuitem,
gpointer user_data);
void
GtkNetworkOpenActivate (GtkMenuItem *menuitem,
gpointer user_data);
void
GtkExitActivate (GtkMenuItem *menuitem,
gpointer user_data);
void
GtkWindowToggleActivate (GtkMenuItem *menuitem,
gpointer user_data);
void
GtkFullscreenActivate (GtkMenuItem *menuitem,
gpointer user_data);
void
GtkPlaylistActivate (GtkMenuItem *menuitem,
gpointer user_data);
void
GtkModulesActivate (GtkMenuItem *menuitem,
gpointer user_data);
void
GtkPreferencesActivate (GtkMenuItem *menuitem,
gpointer user_data);
void
GtkAboutActivate (GtkMenuItem *menuitem,
gpointer user_data);
void
GtkNextActivate (GtkMenuItem *menuitem,
gpointer user_data);
void
GtkPrevActivate (GtkMenuItem *menuitem,
gpointer user_data);
void
GtkJumpActivate (GtkMenuItem *menuitem,
gpointer user_data);
void
GtkDiscOpenActivate (GtkMenuItem *menuitem,
gpointer user_data);
void
GtkFileOpenActivate (GtkMenuItem *menuitem,
gpointer user_data);
void
GtkNetworkOpenActivate (GtkMenuItem *menuitem,
gpointer user_data);
void
GtkPlaylistAddUrl (GtkMenuItem *menuitem,
/* main window callbacks: specific prototypes are in headers listed before */
gboolean GtkExit ( GtkWidget *, GdkEventButton *, gpointer );
gboolean GtkWindowToggle ( GtkWidget *, GdkEventButton *, gpointer );
gboolean GtkFullscreen ( GtkWidget *, GdkEventButton *, gpointer );
gboolean GtkSliderRelease ( GtkWidget *, GdkEventButton *, gpointer );
gboolean GtkSliderPress ( GtkWidget *, GdkEventButton *, gpointer );
gboolean GtkWindowDelete ( GtkWidget * widget, GdkEvent *, gpointer );
gboolean GtkJumpShow ( GtkWidget *, GdkEventButton *, gpointer );
gboolean GtkAboutShow ( GtkWidget *, GdkEventButton *, gpointer );
void GtkTitlePrev ( GtkButton * button, gpointer );
void GtkTitleNext ( GtkButton * button, gpointer );
void GtkChapterPrev ( GtkButton *, gpointer );
void GtkChapterNext ( GtkButton * button, gpointer );
void GtkAboutOk ( GtkButton *, gpointer );
void GtkWindowDrag ( GtkWidget *, GdkDragContext *,
gint, gint, GtkSelectionData *,
guint , guint, gpointer );
void GtkJumpOk ( GtkButton * button, gpointer );
void GtkJumpCancel ( GtkButton * button, gpointer user_data );
void GtkExitActivate ( GtkMenuItem *, gpointer );
void GtkWindowToggleActivate( GtkMenuItem *, gpointer );
void GtkFullscreenActivate ( GtkMenuItem *, gpointer );
void GtkAboutActivate ( GtkMenuItem *, gpointer );
void GtkJumpActivate ( GtkMenuItem *, gpointer );
void
GtkPlaylistDestroy (GtkObject *object,
gpointer user_data);
......@@ -2,7 +2,7 @@
* gtk_control.c : functions to handle stream control buttons.
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: gtk_control.c,v 1.1 2001/05/15 01:01:44 stef Exp $
* $Id: gtk_control.c,v 1.2 2001/05/15 14:49:48 stef Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Stphane Borel <stef@via.ecp.fr>
......@@ -83,12 +83,12 @@ gboolean GtkControlStop( GtkWidget *widget,
p_intf->p_input->b_eof = 1;
/* update playlist */
// vlc_mutex_lock( &p_main->p_playlist->change_lock );
vlc_mutex_lock( &p_main->p_playlist->change_lock );
p_main->p_playlist->i_index--;
p_main->p_playlist->b_stopped = 1;
// vlc_mutex_unlock( &p_main->p_playlist->change_lock );
vlc_mutex_unlock( &p_main->p_playlist->change_lock );
}
......@@ -109,23 +109,28 @@ gboolean GtkControlPlay( GtkWidget *widget,
}
else
{
// vlc_mutex_lock( &p_main->p_playlist->change_lock );
vlc_mutex_lock( &p_main->p_playlist->change_lock );
if( p_main->p_playlist->b_stopped )
{
if( p_main->p_playlist->i_size )
{
vlc_mutex_unlock( &p_main->p_playlist->change_lock );
intf_PlaylistJumpto( p_main->p_playlist,
p_main->p_playlist->i_index );
p_main->p_playlist->b_stopped = 0;
}
else
{
vlc_mutex_unlock( &p_main->p_playlist->change_lock );
GtkFileOpenShow( widget, event, user_data );
}
}
else
{
vlc_mutex_unlock( &p_main->p_playlist->change_lock );
}
// vlc_mutex_unlock( &p_main->p_playlist->change_lock );
}
return TRUE;
......@@ -141,7 +146,10 @@ gboolean GtkControlPause( GtkWidget *widget,
if( p_intf->p_input != NULL )
{
input_SetStatus( p_intf->p_input, INPUT_STATUS_PAUSE );
vlc_mutex_lock( &p_main->p_playlist->change_lock );
p_main->p_playlist->b_stopped = 0;
vlc_mutex_unlock( &p_main->p_playlist->change_lock );
}
return TRUE;
......@@ -157,7 +165,10 @@ gboolean GtkControlSlow( GtkWidget *widget,
if( p_intf->p_input != NULL )
{
input_SetStatus( p_intf->p_input, INPUT_STATUS_SLOWER );
vlc_mutex_lock( &p_main->p_playlist->change_lock );
p_main->p_playlist->b_stopped = 0;
vlc_mutex_unlock( &p_main->p_playlist->change_lock );
}
return TRUE;
......@@ -173,7 +184,10 @@ gboolean GtkControlFast( GtkWidget *widget,
if( p_intf->p_input != NULL )
{
input_SetStatus( p_intf->p_input, INPUT_STATUS_FASTER );
vlc_mutex_lock( &p_main->p_playlist->change_lock );
p_main->p_playlist->b_stopped = 0;
vlc_mutex_unlock( &p_main->p_playlist->change_lock );
}
return TRUE;
......
......@@ -958,7 +958,7 @@ create_intf_popup (void)
gtk_container_add (GTK_CONTAINER (intf_popup), separator6);
gtk_widget_set_sensitive (separator6, FALSE);
popup_interface_toggle = gtk_check_menu_item_new_with_label ("");
popup_interface_toggle = gtk_menu_item_new_with_label ("");
tmp_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (popup_interface_toggle)->child),
_("Toggle _Interface"));
gtk_widget_add_accelerator (popup_interface_toggle, "activate_item", intf_popup_accels,
......@@ -968,10 +968,8 @@ create_intf_popup (void)
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (popup_interface_toggle);
gtk_container_add (GTK_CONTAINER (intf_popup), popup_interface_toggle);