Commit 6846b211 authored by Jean-Paul Saman's avatar Jean-Paul Saman

Fix crash on directory change.

parent d5f52eba
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* callbacks.c : Callbacks for the Familiar Linux Gtk+ plugin. * callbacks.c : Callbacks for the Familiar Linux Gtk+ plugin.
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2000, 2001 VideoLAN
* $Id: callbacks.c,v 1.12 2002/12/12 12:24:23 sam Exp $ * $Id: callbacks.c,v 1.13 2002/12/15 20:48:40 jpsaman Exp $
* *
* Authors: Jean-Paul Saman <jpsaman@wxs.nl> * Authors: Jean-Paul Saman <jpsaman@wxs.nl>
* *
...@@ -56,7 +56,7 @@ static char* get_file_perm(const char *path); ...@@ -56,7 +56,7 @@ static char* get_file_perm(const char *path);
/***************************************************************************** /*****************************************************************************
* Useful function to retrieve p_intf * Useful function to retrieve p_intf
****************************************************************************/ ****************************************************************************/
void * __GtkGetIntf( GtkWidget * widget ) void * E_(__GtkGetIntf)( GtkWidget * widget )
{ {
void *p_data; void *p_data;
...@@ -121,11 +121,11 @@ static void MediaURLOpenChanged( GtkWidget *widget, gchar *psz_url ) ...@@ -121,11 +121,11 @@ static void MediaURLOpenChanged( GtkWidget *widget, gchar *psz_url )
****************************************************************/ ****************************************************************/
void ReadDirectory( GtkCList *clist, char *psz_dir ) void ReadDirectory( GtkCList *clist, char *psz_dir )
{ {
intf_thread_t *p_intf = GtkGetIntf( clist ); intf_thread_t *p_intf = GtkGetIntf( GTK_WIDGET(clist) );
struct dirent **namelist; struct dirent **namelist;
int n,status; int n,status;
msg_Err(p_intf, "changing to dir %s\n", psz_dir); msg_Err(p_intf, "changing to dir %s\n", psz_dir);
if (psz_dir) if (psz_dir)
{ {
status = chdir(psz_dir); status = chdir(psz_dir);
...@@ -251,7 +251,7 @@ void ...@@ -251,7 +251,7 @@ void
on_toolbar_open_clicked (GtkButton *button, on_toolbar_open_clicked (GtkButton *button,
gpointer user_data) gpointer user_data)
{ {
intf_thread_t *p_intf = GtkGetIntf( button ); intf_thread_t *p_intf = GtkGetIntf( GTK_WIDGET( button ) );
if (p_intf->p_sys->p_notebook) if (p_intf->p_sys->p_notebook)
{ {
...@@ -270,7 +270,7 @@ void ...@@ -270,7 +270,7 @@ void
on_toolbar_preferences_clicked (GtkButton *button, on_toolbar_preferences_clicked (GtkButton *button,
gpointer user_data) gpointer user_data)
{ {
intf_thread_t *p_intf = GtkGetIntf( button ); intf_thread_t *p_intf = GtkGetIntf( GTK_WIDGET( button ) );
if (p_intf->p_sys->p_notebook) if (p_intf->p_sys->p_notebook)
{ {
...@@ -285,7 +285,7 @@ void ...@@ -285,7 +285,7 @@ void
on_toolbar_rewind_clicked (GtkButton *button, on_toolbar_rewind_clicked (GtkButton *button,
gpointer user_data) gpointer user_data)
{ {
intf_thread_t * p_intf = GtkGetIntf( button ); intf_thread_t * p_intf = GtkGetIntf( GTK_WIDGET(button) );
if( p_intf->p_sys->p_input ) if( p_intf->p_sys->p_input )
{ {
...@@ -298,12 +298,13 @@ void ...@@ -298,12 +298,13 @@ void
on_toolbar_pause_clicked (GtkButton *button, on_toolbar_pause_clicked (GtkButton *button,
gpointer user_data) gpointer user_data)
{ {
intf_thread_t * p_intf = GtkGetIntf( button ); intf_thread_t * p_intf = GtkGetIntf( GTK_WIDGET( button ) );
if( p_intf->p_sys->p_input ) if( p_intf->p_sys->p_input )
{ {
input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PAUSE ); input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PAUSE );
} }
intf_thread_t * p_intf = GtkGetIntf( widget );
} }
...@@ -311,32 +312,30 @@ void ...@@ -311,32 +312,30 @@ void
on_toolbar_play_clicked (GtkButton *button, on_toolbar_play_clicked (GtkButton *button,
gpointer user_data) gpointer user_data)
{ {
intf_thread_t * p_intf = GtkGetIntf( button ); intf_thread_t * p_intf = GtkGetIntf( GTK_WIDGET( button ) );
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
FIND_ANYWHERE );
if( p_playlist != NULL ) if( p_playlist == NULL )
{ {
input_SetStatus( p_playlist, INPUT_STATUS_PLAY ); /* Display open page */
gdk_window_lower( p_intf->p_sys->p_window->window ); on_toolbar_open_clicked(button,user_data);
} }
else
{ /* If the playlist is empty, open a file requester instead */
/* If the playlist is empty, open a file requester instead */ vlc_mutex_lock( &p_playlist->object_lock );
vlc_mutex_lock( &p_playlist->object_lock ); if( p_playlist->i_size )
if( p_playlist->i_size ) {
{ vlc_mutex_unlock( &p_playlist->object_lock );
vlc_mutex_unlock( &p_playlist->object_lock ); playlist_Play( p_playlist );
playlist_Play( p_playlist ); vlc_object_release( p_playlist );
vlc_object_release( p_playlist ); gdk_window_lower( p_intf->p_sys->p_window->window );
gdk_window_lower( p_intf->p_sys->p_window->window ); }
} else
else {
{ vlc_mutex_unlock( &p_playlist->object_lock );
vlc_mutex_unlock( &p_playlist->object_lock ); vlc_object_release( p_playlist );
vlc_object_release( p_playlist ); /* Display open page */
/* Display open page */ on_toolbar_open_clicked(button,user_data);
on_toolbar_open_clicked(button,user_data);
}
} }
} }
...@@ -345,7 +344,7 @@ void ...@@ -345,7 +344,7 @@ void
on_toolbar_stop_clicked (GtkButton *button, on_toolbar_stop_clicked (GtkButton *button,
gpointer user_data) gpointer user_data)
{ {
intf_thread_t * p_intf = GtkGetIntf( button ); intf_thread_t * p_intf = GtkGetIntf( GTK_WIDGET( button ) );
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE ); FIND_ANYWHERE );
if( p_playlist) if( p_playlist)
...@@ -361,7 +360,7 @@ void ...@@ -361,7 +360,7 @@ void
on_toolbar_forward_clicked (GtkButton *button, on_toolbar_forward_clicked (GtkButton *button,
gpointer user_data) gpointer user_data)
{ {
intf_thread_t * p_intf = GtkGetIntf( button ); intf_thread_t * p_intf = GtkGetIntf( GTK_WIDGET( button ));
if( p_intf->p_sys->p_input ) if( p_intf->p_sys->p_input )
{ {
...@@ -374,7 +373,7 @@ void ...@@ -374,7 +373,7 @@ void
on_toolbar_about_clicked (GtkButton *button, on_toolbar_about_clicked (GtkButton *button,
gpointer user_data) gpointer user_data)
{ {
intf_thread_t *p_intf = GtkGetIntf( button ); intf_thread_t *p_intf = GtkGetIntf( GTK_WIDGET(button) );
// Toggle notebook // Toggle notebook
if (p_intf->p_sys->p_notebook) if (p_intf->p_sys->p_notebook)
...@@ -390,7 +389,7 @@ void ...@@ -390,7 +389,7 @@ void
on_comboURL_entry_changed (GtkEditable *editable, on_comboURL_entry_changed (GtkEditable *editable,
gpointer user_data) gpointer user_data)
{ {
intf_thread_t * p_intf = GtkGetIntf( editable ); intf_thread_t * p_intf = GtkGetIntf( GTK_WIDGET( editable ) );
gchar * psz_url; gchar * psz_url;
struct stat st; struct stat st;
...@@ -453,7 +452,7 @@ on_clistmedia_select_row (GtkCList *clist, ...@@ -453,7 +452,7 @@ on_clistmedia_select_row (GtkCList *clist,
GdkEvent *event, GdkEvent *event,
gpointer user_data) gpointer user_data)
{ {
intf_thread_t * p_intf = GtkGetIntf( clist ); intf_thread_t * p_intf = GtkGetIntf( GTK_WIDGET( clist ) );
gchar *text[2]; gchar *text[2];
gint ret; gint ret;
struct stat st; struct stat st;
...@@ -480,12 +479,6 @@ void ...@@ -480,12 +479,6 @@ void
on_cbautoplay_toggled (GtkToggleButton *togglebutton, on_cbautoplay_toggled (GtkToggleButton *togglebutton,
gpointer user_data) gpointer user_data)
{ {
// intf_thread_t * p_intf = GtkGetIntf( togglebutton );
//
// if (p_intf->p_sys->b_autoplayfile == 1)
// p_intf->p_sys->b_autoplayfile = 0;
// else
// p_intf->p_sys->b_autoplayfile = 1;
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* familiar.h: private Gtk+ interface description * familiar.h: private Gtk+ interface description
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: familiar.h,v 1.6 2002/09/15 19:32:03 jpsaman Exp $ * $Id: familiar.h,v 1.7 2002/12/15 20:48:40 jpsaman Exp $
* *
* Authors: Jean-Paul Saman <jpsaman@wxs.nl> * Authors: Jean-Paul Saman <jpsaman@wxs.nl>
* *
...@@ -48,6 +48,5 @@ struct intf_sys_t ...@@ -48,6 +48,5 @@ struct intf_sys_t
/***************************************************************************** /*****************************************************************************
* Useful macro * Useful macro
****************************************************************************/ ****************************************************************************/
#define GtkGetIntf( widget ) __GtkGetIntf( GTK_WIDGET( widget ) ) #define GtkGetIntf( widget ) E_(__GtkGetIntf)( GTK_WIDGET( widget ) )
void * __GtkGetIntf( GtkWidget * ); void * E_(__GtkGetIntf)( GtkWidget * );
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