Commit 456c666a authored by Jean-Paul Saman's avatar Jean-Paul Saman

Make distinction between GPE and GTK_NEED_MAIN way of handling interface.

Trying to fix change directory crash while entering keys in combobox.
parent e6eae811
...@@ -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.13 2002/12/15 20:48:40 jpsaman Exp $ * $Id: callbacks.c,v 1.14 2002/12/15 22:45:35 jpsaman Exp $
* *
* Authors: Jean-Paul Saman <jpsaman@wxs.nl> * Authors: Jean-Paul Saman <jpsaman@wxs.nl>
* *
...@@ -125,7 +125,10 @@ void ReadDirectory( GtkCList *clist, char *psz_dir ) ...@@ -125,7 +125,10 @@ void ReadDirectory( GtkCList *clist, char *psz_dir )
struct dirent **namelist; struct dirent **namelist;
int n,status; int n,status;
if ( p_intf->p_sys->b_filelist_update == 0)
{
msg_Err(p_intf, "changing to dir %s\n", psz_dir); msg_Err(p_intf, "changing to dir %s\n", psz_dir);
p_intf->p_sys->b_filelist_update = 1;
if (psz_dir) if (psz_dir)
{ {
status = chdir(psz_dir); status = chdir(psz_dir);
...@@ -156,6 +159,9 @@ void ReadDirectory( GtkCList *clist, char *psz_dir ) ...@@ -156,6 +159,9 @@ void ReadDirectory( GtkCList *clist, char *psz_dir )
gtk_clist_thaw( clist ); gtk_clist_thaw( clist );
free(namelist); free(namelist);
} }
}
p_intf->p_sys->b_filelist_update = 0;
} }
static char* get_file_perm(const char *path) static char* get_file_perm(const char *path)
...@@ -304,7 +310,6 @@ on_toolbar_pause_clicked (GtkButton *button, ...@@ -304,7 +310,6 @@ on_toolbar_pause_clicked (GtkButton *button,
{ {
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 );
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* familiar.c : familiar plugin for vlc * familiar.c : familiar plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: familiar.c,v 1.14 2002/12/14 23:17:56 jpsaman Exp $ * $Id: familiar.c,v 1.15 2002/12/15 22:45:35 jpsaman Exp $
* *
* Authors: Jean-Paul Saman <jpsaman@wxs.nl> * Authors: Jean-Paul Saman <jpsaman@wxs.nl>
* *
...@@ -86,18 +86,20 @@ static int Open( vlc_object_t *p_this ) ...@@ -86,18 +86,20 @@ static int Open( vlc_object_t *p_this )
return VLC_ENOMEM; return VLC_ENOMEM;
} }
#ifdef NEED_GTK_MAIN
p_intf->p_sys->p_gtk_main = module_Need( p_this, "gtk_main", "gtk" ); p_intf->p_sys->p_gtk_main = module_Need( p_this, "gtk_main", "gtk" );
if( p_intf->p_sys->p_gtk_main == NULL ) if( p_intf->p_sys->p_gtk_main == NULL )
{ {
free( p_intf->p_sys ); free( p_intf->p_sys );
return VLC_ENOMOD; return VLC_ENOMOD;
} }
#endif
/* Initialize Gtk+ thread */ /* Initialize Gtk+ thread */
p_intf->p_sys->p_input = NULL; p_intf->p_sys->p_input = NULL;
p_intf->p_sys->b_autoplayfile = 1; p_intf->p_sys->b_autoplayfile = 1;
p_intf->p_sys->b_filelist_update = 0;
p_intf->pf_run = Run; p_intf->pf_run = Run;
return VLC_SUCCESS; return VLC_SUCCESS;
...@@ -115,7 +117,9 @@ static void Close( vlc_object_t *p_this ) ...@@ -115,7 +117,9 @@ static void Close( vlc_object_t *p_this )
vlc_object_release( p_intf->p_sys->p_input ); vlc_object_release( p_intf->p_sys->p_input );
} }
#ifdef NEED_GTK_MAIN
module_Unneed( p_intf, p_intf->p_sys->p_gtk_main ); module_Unneed( p_intf, p_intf->p_sys->p_gtk_main );
#endif
/* Destroy structure */ /* Destroy structure */
free( p_intf->p_sys ); free( p_intf->p_sys );
...@@ -138,10 +142,21 @@ static void Run( intf_thread_t *p_intf ) ...@@ -138,10 +142,21 @@ static void Run( intf_thread_t *p_intf )
if (gpe_application_init(&i_args, &pp_args) == FALSE) if (gpe_application_init(&i_args, &pp_args) == FALSE)
exit (1); exit (1);
#else #else
# ifdef NEED_GTK_MAIN
/* Initialize Gtk+ */ /* Initialize Gtk+ */
gtk_set_locale (); gtk_set_locale ();
gdk_threads_enter(); gdk_threads_enter();
# else
/* gtk_init needs to know the command line. We don't care, so we
* give it an empty one */
char *p_args[] = { "" };
char **pp_args = p_args;
int i_args = 1;
int i_dummy;
gtk_set_locale ();
gtk_init( &i_args, &pp_args );
# endif
#endif #endif
/* Create some useful widgets that will certainly be used */ /* Create some useful widgets that will certainly be used */
...@@ -181,6 +196,7 @@ static void Run( intf_thread_t *p_intf ) ...@@ -181,6 +196,7 @@ static void Run( intf_thread_t *p_intf )
gtk_widget_show( p_intf->p_sys->p_window ); gtk_widget_show( p_intf->p_sys->p_window );
ReadDirectory(p_intf->p_sys->p_clist, "/mnt"); ReadDirectory(p_intf->p_sys->p_clist, "/mnt");
#ifdef NEED_GTK_MAIN
/* Sleep to avoid using all CPU - since some interfaces need to /* Sleep to avoid using all CPU - since some interfaces need to
* access keyboard events, a 100ms delay is a good compromise */ * access keyboard events, a 100ms delay is a good compromise */
while( !p_intf->b_die ) while( !p_intf->b_die )
...@@ -189,11 +205,15 @@ static void Run( intf_thread_t *p_intf ) ...@@ -189,11 +205,15 @@ static void Run( intf_thread_t *p_intf )
msleep( INTF_IDLE_SLEEP ); msleep( INTF_IDLE_SLEEP );
gdk_threads_enter(); gdk_threads_enter();
} }
#endif
gtk_object_destroy( GTK_OBJECT(p_intf->p_sys->p_window) ); gtk_object_destroy( GTK_OBJECT(p_intf->p_sys->p_window) );
#ifdef NEED_GTK_MAIN
gdk_threads_leave(); gdk_threads_leave();
#else
gtk_main_quit(); gtk_main_quit();
#endif
} }
/***************************************************************************** /*****************************************************************************
......
...@@ -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.7 2002/12/15 20:48:40 jpsaman Exp $ * $Id: familiar.h,v 1.8 2002/12/15 22:45:35 jpsaman Exp $
* *
* Authors: Jean-Paul Saman <jpsaman@wxs.nl> * Authors: Jean-Paul Saman <jpsaman@wxs.nl>
* *
...@@ -41,6 +41,7 @@ struct intf_sys_t ...@@ -41,6 +41,7 @@ struct intf_sys_t
GtkCList * p_clist; GtkCList * p_clist;
vlc_bool_t b_autoplayfile; vlc_bool_t b_autoplayfile;
vlc_bool_t b_filelist_update;
/* The input thread */ /* The input thread */
input_thread_t * p_input; input_thread_t * p_input;
}; };
......
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