Commit ba3401fa authored by Jean-Paul Saman's avatar Jean-Paul Saman

Interface neatly exits now.

parent 6f67ff83
...@@ -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.4 2002/07/22 21:04:55 jpsaman Exp $ * $Id: familiar.c,v 1.5 2002/07/23 18:39:29 jpsaman Exp $
* *
* Authors: Jean-Paul Saman <jpsaman@wxs.nl> * Authors: Jean-Paul Saman <jpsaman@wxs.nl>
* *
...@@ -95,11 +95,6 @@ static int intf_Open ( intf_thread_t *p_intf ); ...@@ -95,11 +95,6 @@ static int intf_Open ( intf_thread_t *p_intf );
static void intf_Close ( intf_thread_t *p_intf ); static void intf_Close ( intf_thread_t *p_intf );
static void intf_Run ( intf_thread_t *p_intf ); static void intf_Run ( intf_thread_t *p_intf );
/*****************************************************************************
* Local variables (mutex-protected).
*****************************************************************************/
//static void ** pp_global_data = NULL;
/***************************************************************************** /*****************************************************************************
* Building configuration tree * Building configuration tree
*****************************************************************************/ *****************************************************************************/
...@@ -179,7 +174,7 @@ static void intf_Run( intf_thread_t *p_intf ) ...@@ -179,7 +174,7 @@ static void intf_Run( intf_thread_t *p_intf )
char *p_args[] = { "" }; char *p_args[] = { "" };
char **pp_args = p_args; char **pp_args = p_args;
int i_args = 1; int i_args = 1;
int i_dummy; int i_dummy = 0;
/* Initialize Gtk+ */ /* Initialize Gtk+ */
gtk_set_locale (); gtk_set_locale ();
...@@ -193,7 +188,7 @@ static void intf_Run( intf_thread_t *p_intf ) ...@@ -193,7 +188,7 @@ static void intf_Run( intf_thread_t *p_intf )
/* Create some useful widgets that will certainly be used */ /* Create some useful widgets that will certainly be used */
// FIXME: magic path // FIXME: magic path
add_pixmap_directory("/home/jpsaman/vlc/share"); add_pixmap_directory("share");
p_intf->p_sys->p_window = create_familiar(); p_intf->p_sys->p_window = create_familiar();
if (p_intf->p_sys->p_window == NULL) if (p_intf->p_sys->p_window == NULL)
{ {
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
<name>Familiar</name> <name>Familiar</name>
<program_name>familiar</program_name> <program_name>familiar</program_name>
<directory></directory> <directory></directory>
<source_directory>src</source_directory> <source_directory></source_directory>
<pixmaps_directory>share</pixmaps_directory> <pixmaps_directory>../../share</pixmaps_directory>
<language>C</language> <language>C</language>
<gnome_support>False</gnome_support> <gnome_support>False</gnome_support>
<gettext_support>True</gettext_support> <gettext_support>True</gettext_support>
...@@ -23,10 +23,15 @@ ...@@ -23,10 +23,15 @@
<name>familiar</name> <name>familiar</name>
<width>240</width> <width>240</width>
<height>320</height> <height>320</height>
<signal>
<name>destroy_event</name>
<handler>on_familiar_destroy_event</handler>
<last_modification_time>Tue, 23 Jul 2002 18:16:11 GMT</last_modification_time>
</signal>
<signal> <signal>
<name>destroy</name> <name>destroy</name>
<handler>on_familiar_destroy</handler> <handler>gtk_main_quit</handler>
<last_modification_time>Mon, 22 Jul 2002 18:58:45 GMT</last_modification_time> <last_modification_time>Tue, 23 Jul 2002 18:17:28 GMT</last_modification_time>
</signal> </signal>
<title>vlc (familiar)</title> <title>vlc (familiar)</title>
<type>GTK_WINDOW_TOPLEVEL</type> <type>GTK_WINDOW_TOPLEVEL</type>
......
...@@ -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.3 2002/07/22 21:04:55 jpsaman Exp $ * $Id: familiar.h,v 1.4 2002/07/23 18:39:29 jpsaman Exp $
* *
* Authors: Jean-Paul Saman <jpsaman@wxs.nl> * Authors: Jean-Paul Saman <jpsaman@wxs.nl>
* *
...@@ -38,3 +38,9 @@ struct intf_sys_t ...@@ -38,3 +38,9 @@ struct intf_sys_t
void ( *pf_callback[MAX_ATEXIT] ) ( void ); void ( *pf_callback[MAX_ATEXIT] ) ( void );
}; };
/*****************************************************************************
* Useful macro
****************************************************************************/
#define GtkGetIntf( widget ) __GtkGetIntf( GTK_WIDGET( widget ) )
void * __GtkGetIntf( GtkWidget * );
/*****************************************************************************
* familiar_callbacks.c : Callbacks for the Familiar Linux Gtk+ plugin.
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: familiar_callbacks.c,v 1.3 2002/07/23 18:39:29 jpsaman Exp $
*
* Authors: Jean-Paul Saman <jpsaman@wxs.nl>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <sys/types.h> /* off_t */
#include <stdlib.h>
#include <vlc/vlc.h>
#include <vlc/intf.h>
#include <vlc/vout.h>
#include <unistd.h>
#include <string.h>
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include <config.h> # include <config.h>
#endif #endif
...@@ -7,6 +43,59 @@ ...@@ -7,6 +43,59 @@
#include "familiar_callbacks.h" #include "familiar_callbacks.h"
#include "familiar_interface.h" #include "familiar_interface.h"
#include "familiar_support.h" #include "familiar_support.h"
#include "familiar.h"
//#include "netutils.h"
/*****************************************************************************
* Useful function to retrieve p_intf
****************************************************************************/
void * __GtkGetIntf( GtkWidget * widget )
{
void *p_data;
if( GTK_IS_MENU_ITEM( widget ) )
{
/* Look for a GTK_MENU */
while( widget->parent && !GTK_IS_MENU( widget ) )
{
widget = widget->parent;
}
/* Maybe this one has the data */
p_data = gtk_object_get_data( GTK_OBJECT( widget ), "p_intf" );
if( p_data )
{
return p_data;
}
/* Otherwise, the parent widget has it */
widget = gtk_menu_get_attach_widget( GTK_MENU( widget ) );
}
/* We look for the top widget */
widget = gtk_widget_get_toplevel( GTK_WIDGET( widget ) );
p_data = gtk_object_get_data( GTK_OBJECT( widget ), "p_intf" );
return p_data;
}
/*
* Main interface callbacks
*/
gboolean GtkExit( GtkWidget *widget,
gpointer user_data )
{
intf_thread_t *p_intf = GtkGetIntf( widget );
vlc_mutex_lock( &p_intf->change_lock );
p_intf->p_vlc->b_die = VLC_TRUE;
vlc_mutex_unlock( &p_intf->change_lock );
return TRUE;
}
gboolean gboolean
on_xpm_open_button_press_event (GtkWidget *widget, on_xpm_open_button_press_event (GtkWidget *widget,
...@@ -78,10 +167,12 @@ on_xpm_forward_button_press_event (GtkWidget *widget, ...@@ -78,10 +167,12 @@ on_xpm_forward_button_press_event (GtkWidget *widget,
} }
void gboolean
on_familiar_destroy (GtkObject *object, on_familiar_destroy_event (GtkWidget *widget,
GdkEvent *event,
gpointer user_data) gpointer user_data)
{ {
gtk_main_quit(); GtkExit( GTK_WIDGET( widget ), user_data );
return TRUE;
} }
#include <gtk/gtk.h> #include <gtk/gtk.h>
gboolean GtkExit ( GtkWidget *, gpointer );
gboolean gboolean
on_xpm_open_button_press_event (GtkWidget *widget, on_xpm_open_button_press_event (GtkWidget *widget,
GdkEventButton *event, GdkEventButton *event,
...@@ -35,6 +38,7 @@ on_xpm_forward_button_press_event (GtkWidget *widget, ...@@ -35,6 +38,7 @@ on_xpm_forward_button_press_event (GtkWidget *widget,
GdkEventButton *event, GdkEventButton *event,
gpointer user_data); gpointer user_data);
void gboolean
on_familiar_destroy (GtkObject *object, on_familiar_destroy_event (GtkWidget *widget,
GdkEvent *event,
gpointer user_data); gpointer user_data);
...@@ -395,8 +395,11 @@ create_familiar (void) ...@@ -395,8 +395,11 @@ create_familiar (void)
gtk_widget_show (about); gtk_widget_show (about);
gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), 2), about); gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), 2), about);
gtk_signal_connect (GTK_OBJECT (familiar), "destroy_event",
GTK_SIGNAL_FUNC (on_familiar_destroy_event),
NULL);
gtk_signal_connect (GTK_OBJECT (familiar), "destroy", gtk_signal_connect (GTK_OBJECT (familiar), "destroy",
GTK_SIGNAL_FUNC (on_familiar_destroy), GTK_SIGNAL_FUNC (gtk_main_quit),
NULL); NULL);
gtk_signal_connect (GTK_OBJECT (xpm_open), "button_press_event", gtk_signal_connect (GTK_OBJECT (xpm_open), "button_press_event",
GTK_SIGNAL_FUNC (on_xpm_open_button_press_event), GTK_SIGNAL_FUNC (on_xpm_open_button_press_event),
......
...@@ -113,7 +113,7 @@ create_pixmap (GtkWidget *widget, ...@@ -113,7 +113,7 @@ create_pixmap (GtkWidget *widget,
/* If we haven't found the pixmap, try the source directory. */ /* If we haven't found the pixmap, try the source directory. */
if (!found_filename) if (!found_filename)
{ {
found_filename = check_file_exists ("../share", filename); found_filename = check_file_exists ("../../share", filename);
} }
if (!found_filename) if (!found_filename)
......
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