Commit 4b6d903a authored by Jean-Paul Saman's avatar Jean-Paul Saman

BUGS to solve:

- interface does not exit
- selecting a directory produces segmentation fault in function ReadDirectory()
parent e11f39d7
...@@ -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.8.2.1 2002/09/30 20:37:13 jpsaman Exp $ * $Id: familiar.c,v 1.8.2.2 2002/09/30 22:01:43 jpsaman Exp $
* *
* Authors: Jean-Paul Saman <jpsaman@wxs.nl> * Authors: Jean-Paul Saman <jpsaman@wxs.nl>
* *
...@@ -47,6 +47,11 @@ ...@@ -47,6 +47,11 @@
#include "familiar_support.h" #include "familiar_support.h"
#include "familiar.h" #include "familiar.h"
/*****************************************************************************
* Local variables (mutex-protected).
*****************************************************************************/
static void ** pp_global_data = NULL;
/***************************************************************************** /*****************************************************************************
* g_atexit: kludge to avoid the Gtk+ thread to segfault at exit * g_atexit: kludge to avoid the Gtk+ thread to segfault at exit
***************************************************************************** *****************************************************************************
...@@ -60,6 +65,18 @@ void g_atexit( GVoidFunc func ) ...@@ -60,6 +65,18 @@ void g_atexit( GVoidFunc func )
intf_thread_t *p_intf = p_main->p_intf; intf_thread_t *p_intf = p_main->p_intf;
int i_dummy; int i_dummy;
if( pp_global_data == NULL )
{
atexit( func );
return;
}
p_intf = (intf_thread_t *)*pp_global_data;
if( p_intf == NULL )
{
return;
}
for( i_dummy = 0; for( i_dummy = 0;
i_dummy < MAX_ATEXIT && p_intf->p_sys->pf_callback[i_dummy] != NULL; i_dummy < MAX_ATEXIT && p_intf->p_sys->pf_callback[i_dummy] != NULL;
i_dummy++ ) i_dummy++ )
......
...@@ -13,6 +13,12 @@ ...@@ -13,6 +13,12 @@
<use_widget_names>True</use_widget_names> <use_widget_names>True</use_widget_names>
<output_main_file>False</output_main_file> <output_main_file>False</output_main_file>
<output_build_files>False</output_build_files> <output_build_files>False</output_build_files>
<main_source_file>familiar_interface.c</main_source_file>
<main_header_file>familiar_interface.h</main_header_file>
<handler_source_file>familiar_callbacks.c</handler_source_file>
<handler_header_file>familiar_callbacks.h</handler_header_file>
<support_source_file>familiar_support.c</support_source_file>
<support_header_file>familiar_support.h</support_header_file>
</project> </project>
<widget> <widget>
......
...@@ -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: familiar_callbacks.c,v 1.6.2.1 2002/09/30 20:37:13 jpsaman Exp $ * $Id: familiar_callbacks.c,v 1.6.2.2 2002/09/30 22:01:43 jpsaman Exp $
* *
* Authors: Jean-Paul Saman <jpsaman@wxs.nl> * Authors: Jean-Paul Saman <jpsaman@wxs.nl>
* *
...@@ -135,12 +135,18 @@ void ReadDirectory( GtkCList *clist, char *psz_dir ) ...@@ -135,12 +135,18 @@ void ReadDirectory( GtkCList *clist, char *psz_dir )
{ {
// intf_thread_t *p_intf = GtkGetIntf( clist ); // intf_thread_t *p_intf = GtkGetIntf( clist );
struct dirent **namelist; struct dirent **namelist;
int n,i; int n=-1;
int status=-1;
intf_ErrMsg( "@@@ ReadDirectory - Enter" ); intf_ErrMsg( "@@@ ReadDirectory - Enter" );
g_print( "%s\n",psz_dir ); g_print( "%s\n",psz_dir );
if (psz_dir) if (psz_dir)
chdir(psz_dir); {
status = chdir(psz_dir);
}
if (status<0)
intf_ErrMsg("File is not a directory.");
else
n = scandir(".", &namelist, 0, NULL); n = scandir(".", &namelist, 0, NULL);
if (n<0) if (n<0)
...@@ -148,10 +154,10 @@ void ReadDirectory( GtkCList *clist, char *psz_dir ) ...@@ -148,10 +154,10 @@ void ReadDirectory( GtkCList *clist, char *psz_dir )
else else
{ {
gchar *ppsz_text[2]; gchar *ppsz_text[2];
int i;
gtk_clist_freeze( clist ); gtk_clist_freeze( clist );
gtk_clist_clear( clist ); gtk_clist_clear( clist );
g_print( "dir entries: %d\n",n ); g_print( "dir entries: %d\n",n );
for (i=0; i<n; i++) for (i=0; i<n; i++)
{ {
...@@ -269,7 +275,9 @@ on_toolbar_open_clicked (GtkButton *button, ...@@ -269,7 +275,9 @@ on_toolbar_open_clicked (GtkButton *button,
gtk_widget_show( GTK_WIDGET(p_intf->p_sys->p_notebook) ); gtk_widget_show( GTK_WIDGET(p_intf->p_sys->p_notebook) );
gdk_window_raise( p_intf->p_sys->p_window->window ); gdk_window_raise( p_intf->p_sys->p_window->window );
if (p_intf->p_sys->p_clist) if (p_intf->p_sys->p_clist)
{
ReadDirectory(p_intf->p_sys->p_clist, "."); ReadDirectory(p_intf->p_sys->p_clist, ".");
}
} }
...@@ -463,13 +471,19 @@ on_clistmedia_select_row (GtkCList *clist, ...@@ -463,13 +471,19 @@ on_clistmedia_select_row (GtkCList *clist,
gint ret; gint ret;
struct stat st; struct stat st;
if (clist == NULL)
intf_ErrMsg("clist is unusable.");
ret = gtk_clist_get_text (clist, row, 0, text); ret = gtk_clist_get_text (clist, row, 0, text);
if (ret) if (ret)
{ {
if (lstat((char*)text[0], &st)==0) if (lstat((char*)text[0], &st)==0)
{ {
if (S_ISDIR(st.st_mode)) if (S_ISDIR(st.st_mode))
{
g_print( "read dir %s\n", text[0] );
ReadDirectory(clist, text[0]); ReadDirectory(clist, text[0]);
}
else else
MediaURLOpenChanged(GTK_WIDGET(clist), text[0]); MediaURLOpenChanged(GTK_WIDGET(clist), text[0]);
} }
...@@ -496,6 +510,7 @@ on_familiar_delete_event (GtkWidget *widget, ...@@ -496,6 +510,7 @@ on_familiar_delete_event (GtkWidget *widget,
gpointer user_data) gpointer user_data)
{ {
GtkExit( GTK_WIDGET( widget ), user_data ); GtkExit( GTK_WIDGET( widget ), user_data );
exit (0); //dirty
return TRUE; return TRUE;
} }
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* callbacks.h : familiar plugin for vlc * callbacks.h : familiar plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: familiar_callbacks.h,v 1.7.2.1 2002/09/30 20:37:13 jpsaman Exp $ * $Id: familiar_callbacks.h,v 1.7.2.2 2002/09/30 22:01:43 jpsaman Exp $
* *
* Authors: Jean-Paul Saman <jpsaman@wxs.nl> * Authors: Jean-Paul Saman <jpsaman@wxs.nl>
* *
...@@ -85,3 +85,5 @@ gboolean ...@@ -85,3 +85,5 @@ gboolean
on_familiar_delete_event (GtkWidget *widget, on_familiar_delete_event (GtkWidget *widget,
GdkEvent *event, GdkEvent *event,
gpointer user_data); gpointer user_data);
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