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 @@
* familiar.c : familiar plugin for vlc
*****************************************************************************
* 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>
*
......@@ -47,6 +47,11 @@
#include "familiar_support.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
*****************************************************************************
......@@ -60,6 +65,18 @@ void g_atexit( GVoidFunc func )
intf_thread_t *p_intf = p_main->p_intf;
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;
i_dummy < MAX_ATEXIT && p_intf->p_sys->pf_callback[i_dummy] != NULL;
i_dummy++ )
......
......@@ -13,6 +13,12 @@
<use_widget_names>True</use_widget_names>
<output_main_file>False</output_main_file>
<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>
<widget>
......
......@@ -2,7 +2,7 @@
* callbacks.c : Callbacks for the Familiar Linux Gtk+ plugin.
*****************************************************************************
* 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>
*
......@@ -135,23 +135,29 @@ void ReadDirectory( GtkCList *clist, char *psz_dir )
{
// intf_thread_t *p_intf = GtkGetIntf( clist );
struct dirent **namelist;
int n,i;
int n=-1;
int status=-1;
intf_ErrMsg( "@@@ ReadDirectory - Enter" );
g_print( "%s\n",psz_dir );
if (psz_dir)
chdir(psz_dir);
n = scandir(".", &namelist, 0, NULL);
{
status = chdir(psz_dir);
}
if (status<0)
intf_ErrMsg("File is not a directory.");
else
n = scandir(".", &namelist, 0, NULL);
if (n<0)
perror("scandir");
else
{
gchar *ppsz_text[2];
int i;
gtk_clist_freeze( clist );
gtk_clist_clear( clist );
g_print( "dir entries: %d\n",n );
for (i=0; i<n; i++)
{
......@@ -269,7 +275,9 @@ on_toolbar_open_clicked (GtkButton *button,
gtk_widget_show( GTK_WIDGET(p_intf->p_sys->p_notebook) );
gdk_window_raise( p_intf->p_sys->p_window->window );
if (p_intf->p_sys->p_clist)
{
ReadDirectory(p_intf->p_sys->p_clist, ".");
}
}
......@@ -463,13 +471,19 @@ on_clistmedia_select_row (GtkCList *clist,
gint ret;
struct stat st;
if (clist == NULL)
intf_ErrMsg("clist is unusable.");
ret = gtk_clist_get_text (clist, row, 0, text);
if (ret)
{
if (lstat((char*)text[0], &st)==0)
{
if (S_ISDIR(st.st_mode))
{
g_print( "read dir %s\n", text[0] );
ReadDirectory(clist, text[0]);
}
else
MediaURLOpenChanged(GTK_WIDGET(clist), text[0]);
}
......@@ -496,6 +510,7 @@ on_familiar_delete_event (GtkWidget *widget,
gpointer user_data)
{
GtkExit( GTK_WIDGET( widget ), user_data );
exit (0); //dirty
return TRUE;
}
......@@ -2,7 +2,7 @@
* callbacks.h : familiar plugin for vlc
*****************************************************************************
* 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>
*
......@@ -85,3 +85,5 @@ gboolean
on_familiar_delete_event (GtkWidget *widget,
GdkEvent *event,
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