* familiar.c : familiar plugin for vlc
*****************************************************************************
* 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>
*
static void intf_Close ( 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
*****************************************************************************/
char *p_args[] = { "" };
char **pp_args = p_args;
int i_args = 1;
- int i_dummy;
+ int i_dummy = 0;
/* Initialize Gtk+ */
gtk_set_locale ();
/* Create some useful widgets that will certainly be used */
// FIXME: magic path
- add_pixmap_directory("/home/jpsaman/vlc/share");
+ add_pixmap_directory("share");
p_intf->p_sys->p_window = create_familiar();
if (p_intf->p_sys->p_window == NULL)
{
<name>Familiar</name>
<program_name>familiar</program_name>
<directory></directory>
- <source_directory>src</source_directory>
- <pixmaps_directory>share</pixmaps_directory>
+ <source_directory></source_directory>
+ <pixmaps_directory>../../share</pixmaps_directory>
<language>C</language>
<gnome_support>False</gnome_support>
<gettext_support>True</gettext_support>
<name>familiar</name>
<width>240</width>
<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>
<name>destroy</name>
- <handler>on_familiar_destroy</handler>
- <last_modification_time>Mon, 22 Jul 2002 18:58:45 GMT</last_modification_time>
+ <handler>gtk_main_quit</handler>
+ <last_modification_time>Tue, 23 Jul 2002 18:17:28 GMT</last_modification_time>
</signal>
<title>vlc (familiar)</title>
<type>GTK_WINDOW_TOPLEVEL</type>
* familiar.h: private Gtk+ interface description
*****************************************************************************
* 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>
*
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
# include <config.h>
#endif
#include "familiar_callbacks.h"
#include "familiar_interface.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
on_xpm_open_button_press_event (GtkWidget *widget,
}
-void
-on_familiar_destroy (GtkObject *object,
+gboolean
+on_familiar_destroy_event (GtkWidget *widget,
+ GdkEvent *event,
gpointer user_data)
{
- gtk_main_quit();
+ GtkExit( GTK_WIDGET( widget ), user_data );
+ return TRUE;
}
+
#include <gtk/gtk.h>
+gboolean GtkExit ( GtkWidget *, gpointer );
+
gboolean
on_xpm_open_button_press_event (GtkWidget *widget,
GdkEventButton *event,
GdkEventButton *event,
gpointer user_data);
-void
-on_familiar_destroy (GtkObject *object,
+gboolean
+on_familiar_destroy_event (GtkWidget *widget,
+ GdkEvent *event,
gpointer user_data);
gtk_widget_show (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_FUNC (on_familiar_destroy),
+ GTK_SIGNAL_FUNC (gtk_main_quit),
NULL);
gtk_signal_connect (GTK_OBJECT (xpm_open), "button_press_event",
GTK_SIGNAL_FUNC (on_xpm_open_button_press_event),
/* If we haven't found the pixmap, try the source directory. */
if (!found_filename)
{
- found_filename = check_file_exists ("../share", filename);
+ found_filename = check_file_exists ("../../share", filename);
}
if (!found_filename)