* callbacks.c : Callbacks for the Familiar Linux Gtk+ plugin.
*****************************************************************************
* 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>
*
struct dirent **namelist;
int n,status;
- msg_Err(p_intf, "changing to dir %s\n", psz_dir);
- if (psz_dir)
+ if ( p_intf->p_sys->b_filelist_update == 0)
{
- status = chdir(psz_dir);
- if (status<0)
- msg_Err( p_intf, "file is not a directory" );
- }
- n = scandir(".", &namelist, 0, alphasort);
-
- if (n<0)
- perror("scandir");
- else
- {
- gchar *ppsz_text[2];
- int i;
+ msg_Err(p_intf, "changing to dir %s\n", psz_dir);
+ p_intf->p_sys->b_filelist_update = 1;
+ if (psz_dir)
+ {
+ status = chdir(psz_dir);
+ if (status<0)
+ msg_Err( p_intf, "file is not a directory" );
+ }
+ n = scandir(".", &namelist, 0, alphasort);
- gtk_clist_freeze( clist );
- gtk_clist_clear( clist );
- for (i=0; i<n; i++)
+ if (n<0)
+ perror("scandir");
+ else
{
- /* This is a list of strings. */
- ppsz_text[0] = namelist[i]->d_name;
- ppsz_text[1] = get_file_perm(namelist[i]->d_name);
- if (strcmp(ppsz_text[1],"") == 0)
- msg_Err( p_intf->p_sys->p_input, "File system error unknown filetype encountered.");
- gtk_clist_insert( clist, i, ppsz_text );
- free(namelist[i]);
+ gchar *ppsz_text[2];
+ int i;
+
+ gtk_clist_freeze( clist );
+ gtk_clist_clear( clist );
+ for (i=0; i<n; i++)
+ {
+ /* This is a list of strings. */
+ ppsz_text[0] = namelist[i]->d_name;
+ ppsz_text[1] = get_file_perm(namelist[i]->d_name);
+ if (strcmp(ppsz_text[1],"") == 0)
+ msg_Err( p_intf->p_sys->p_input, "File system error unknown filetype encountered.");
+ gtk_clist_insert( clist, i, ppsz_text );
+ free(namelist[i]);
+ }
+ gtk_clist_thaw( clist );
+ free(namelist);
}
- gtk_clist_thaw( clist );
- free(namelist);
}
+ p_intf->p_sys->b_filelist_update = 0;
+
}
static char* get_file_perm(const char *path)
{
input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PAUSE );
}
- intf_thread_t * p_intf = GtkGetIntf( widget );
}
* familiar.c : familiar plugin for vlc
*****************************************************************************
* 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>
*
return VLC_ENOMEM;
}
+#ifdef NEED_GTK_MAIN
p_intf->p_sys->p_gtk_main = module_Need( p_this, "gtk_main", "gtk" );
if( p_intf->p_sys->p_gtk_main == NULL )
{
free( p_intf->p_sys );
return VLC_ENOMOD;
}
+#endif
/* Initialize Gtk+ thread */
p_intf->p_sys->p_input = NULL;
p_intf->p_sys->b_autoplayfile = 1;
-
+ p_intf->p_sys->b_filelist_update = 0;
p_intf->pf_run = Run;
return VLC_SUCCESS;
vlc_object_release( p_intf->p_sys->p_input );
}
+#ifdef NEED_GTK_MAIN
module_Unneed( p_intf, p_intf->p_sys->p_gtk_main );
+#endif
/* Destroy structure */
free( p_intf->p_sys );
char **pp_args = p_args;
int i_args = 1;
- /* Initialize GPE interface */
- if (gpe_application_init(&i_args, &pp_args) == FALSE)
+ /* Initialize GPE interface */
+ if (gpe_application_init(&i_args, &pp_args) == FALSE)
exit (1);
#else
- /* Initialize Gtk+ */
- gtk_set_locale ();
+# ifdef NEED_GTK_MAIN
+ /* Initialize Gtk+ */
+ gtk_set_locale ();
+ 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;
- gdk_threads_enter();
+ gtk_set_locale ();
+ gtk_init( &i_args, &pp_args );
+# endif
#endif
/* Create some useful widgets that will certainly be used */
gtk_widget_show( p_intf->p_sys->p_window );
ReadDirectory(p_intf->p_sys->p_clist, "/mnt");
+#ifdef NEED_GTK_MAIN
/* Sleep to avoid using all CPU - since some interfaces need to
* access keyboard events, a 100ms delay is a good compromise */
while( !p_intf->b_die )
msleep( INTF_IDLE_SLEEP );
gdk_threads_enter();
}
+#endif
gtk_object_destroy( GTK_OBJECT(p_intf->p_sys->p_window) );
+#ifdef NEED_GTK_MAIN
gdk_threads_leave();
+#else
gtk_main_quit();
+#endif
}
/*****************************************************************************
* familiar.h: private Gtk+ interface description
*****************************************************************************
* 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>
*
GtkCList * p_clist;
vlc_bool_t b_autoplayfile;
+ vlc_bool_t b_filelist_update;
/* The input thread */
input_thread_t * p_input;
};