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

Familiar Linux Gtk+ based interface backported from vlc-0.5.0 cvs. This is not...

Familiar Linux Gtk+ based interface backported from vlc-0.5.0 cvs. This is not a working version, it segfaults open selecting a directory.
parent c36ab258
familiar_SOURCES = familiar.c familiar_interface.c familiar_support.c familiar_callbacks.c
/*****************************************************************************
* 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 $
*
* 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 <stdlib.h> /* malloc(), free() */
#include <errno.h> /* ENOMEM */
#include <string.h> /* strerror() */
#include <stdio.h>
#include <videolan/vlc.h>
#include <gtk/gtk.h>
#include "stream_control.h"
#include "input_ext-intf.h"
#include "interface.h"
#include "intf_playlist.h"
#include "video.h"
#include "video_output.h"
#include "familiar_callbacks.h"
#include "familiar_interface.h"
#include "familiar_support.h"
#include "familiar.h"
/*****************************************************************************
* g_atexit: kludge to avoid the Gtk+ thread to segfault at exit
*****************************************************************************
* gtk_init() makes several calls to g_atexit() which calls atexit() to
* register tidying callbacks to be called at program exit. Since the Gtk+
* plugin is likely to be unloaded at program exit, we have to export this
* symbol to intercept the g_atexit() calls. Talk about crude hack.
*****************************************************************************/
void g_atexit( GVoidFunc func )
{
intf_thread_t *p_intf = p_main->p_intf;
int i_dummy;
for( i_dummy = 0;
i_dummy < MAX_ATEXIT && p_intf->p_sys->pf_callback[i_dummy] != NULL;
i_dummy++ )
{
;
}
if( i_dummy >= MAX_ATEXIT - 1 )
{
intf_ErrMsg( "too many atexit() callbacks to register" );
return;
}
p_intf->p_sys->pf_callback[i_dummy] = func;
p_intf->p_sys->pf_callback[i_dummy + 1] = NULL;
}
/*****************************************************************************
* Local prototypes.
*****************************************************************************/
static void intf_getfunctions ( function_list_t * p_function_list );
static int Open ( intf_thread_t *p_intf );
static void Close ( intf_thread_t *p_intf );
static void Run ( intf_thread_t * );
/*****************************************************************************
* Module descriptor
*****************************************************************************/
MODULE_CONFIG_START
ADD_CATEGORY_HINT( N_("Miscellaneous"), NULL )
MODULE_CONFIG_STOP
MODULE_INIT_START
SET_DESCRIPTION( _("Familiar Linux Gtk+ interface module") )
#ifndef WIN32
if( getenv( "DISPLAY" ) == NULL )
{
ADD_CAPABILITY( INTF, 10 )
}
else
#endif
{
ADD_CAPABILITY( INTF, 70 )
}
MODULE_INIT_STOP
MODULE_ACTIVATE_START
intf_getfunctions( &p_module->p_functions->intf );
MODULE_ACTIVATE_STOP
MODULE_DEACTIVATE_START
MODULE_DEACTIVATE_STOP
/*****************************************************************************
* Functions exported as capabilities. They are declared as static so that
* we don't pollute the namespace too much.
*****************************************************************************/
static void intf_getfunctions( function_list_t * p_function_list )
{
p_function_list->functions.intf.pf_open = Open;
p_function_list->functions.intf.pf_close = Close;
p_function_list->functions.intf.pf_run = Run;
}
/*****************************************************************************
* Open: initialize and create window
*****************************************************************************/
static int Open( intf_thread_t *p_intf )
{
/* Allocate instance and initialize some members */
p_intf->p_sys = malloc( sizeof( intf_sys_t ) );
if( p_intf->p_sys == NULL )
{
intf_ErrMsg( "out of memory" );
return (1);
}
/* Initialize Gtk+ thread */
p_intf->p_sys->b_autoplayfile = 1;
/* Initialize Gtk+ thread */
p_intf->p_sys->p_input = NULL;
p_intf->pf_run = Run;
return (0);
}
/*****************************************************************************
* Close: destroy interface window
*****************************************************************************/
static void Close( intf_thread_t *p_intf )
{
if( p_intf->p_sys->p_input )
{
// vlc_object_release( p_intf->p_sys->p_input );
}
/* Destroy structure */
free( p_intf->p_sys );
}
/*****************************************************************************
* Run: Gtk+ thread
*****************************************************************************
* this part of the interface is in a separate thread so that we can call
* gtk_main() from within it without annoying the rest of the program.
*****************************************************************************/
static void Run( intf_thread_t *p_intf )
{
/* 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 = 0;
/* Initialize Gtk+ */
gtk_set_locale ();
/* gtk_init will register stuff with g_atexit, so we need to take
* the global lock if we want to be able to intercept the calls */
gtk_init( &i_args, &pp_args );
/* Create some useful widgets that will certainly be used */
// FIXME: magic path
add_pixmap_directory("share");
p_intf->p_sys->p_window = create_familiar();
if (p_intf->p_sys->p_window == NULL)
{
intf_ErrMsg( "unable to create familiar interface" );
}
/* Set the title of the main window */
gtk_window_set_title( GTK_WINDOW(p_intf->p_sys->p_window),
VOUT_TITLE " (Familiar Linux interface)");
p_intf->p_sys->p_notebook = GTK_NOTEBOOK( gtk_object_get_data(
GTK_OBJECT( p_intf->p_sys->p_window ), "notebook" ) );
// gtk_widget_hide( GTK_WIDGET(p_intf->p_sys->p_notebook) );
p_intf->p_sys->p_progess = GTK_PROGRESS_BAR( gtk_object_get_data(
GTK_OBJECT( p_intf->p_sys->p_window ), "progress" ) );
gtk_widget_hide( GTK_WIDGET(p_intf->p_sys->p_progess) );
p_intf->p_sys->p_clist = GTK_CLIST( gtk_object_get_data(
GTK_OBJECT( p_intf->p_sys->p_window ), "clistmedia" ) );
gtk_clist_set_column_visibility (GTK_CLIST (p_intf->p_sys->p_clist), 2, FALSE);
gtk_clist_set_column_visibility (GTK_CLIST (p_intf->p_sys->p_clist), 3, FALSE);
gtk_clist_set_column_visibility (GTK_CLIST (p_intf->p_sys->p_clist), 4, FALSE);
gtk_clist_column_titles_show (GTK_CLIST (p_intf->p_sys->p_clist));
/* Store p_intf to keep an eye on it */
gtk_object_set_data( GTK_OBJECT(p_intf->p_sys->p_window),
"p_intf", p_intf );
/* Show the control window */
gtk_widget_show( p_intf->p_sys->p_window );
ReadDirectory(p_intf->p_sys->p_clist, ".");
/* Sleep to avoid using all CPU - since some interfaces needs to access
* keyboard events, a 100ms delay is a good compromise */
// i_dummy = gtk_timeout_add( INTF_IDLE_SLEEP / 1000, GtkManage, p_intf );
/* Enter Gtk mode */
gtk_main();
intf_ErrMsg( "@@@ Run exiting interface" );
/* Remove the timeout */
gtk_timeout_remove( i_dummy );
gtk_object_destroy( GTK_OBJECT(p_intf->p_sys->p_window) );
/* Launch stored callbacks */
for( i_dummy = 0;
i_dummy < MAX_ATEXIT && p_intf->p_sys->pf_callback[i_dummy] != NULL;
i_dummy++ )
{
p_intf->p_sys->pf_callback[i_dummy]();
}
}
<?xml version="1.0"?>
<GTK-Interface>
<project>
<name>Familiar</name>
<program_name>familiar</program_name>
<directory></directory>
<source_directory></source_directory>
<pixmaps_directory>../../share</pixmaps_directory>
<language>C</language>
<gnome_support>False</gnome_support>
<gettext_support>True</gettext_support>
<use_widget_names>True</use_widget_names>
<output_main_file>False</output_main_file>
<output_build_files>False</output_build_files>
</project>
<widget>
<class>GtkWindow</class>
<name>familiar</name>
<width>240</width>
<height>320</height>
<signal>
<name>delete_event</name>
<handler>on_familiar_delete_event</handler>
<last_modification_time>Wed, 21 Aug 2002 19:12:40 GMT</last_modification_time>
</signal>
<title>vlc (familiar)</title>
<type>GTK_WINDOW_TOPLEVEL</type>
<position>GTK_WIN_POS_NONE</position>
<modal>False</modal>
<allow_shrink>True</allow_shrink>
<allow_grow>True</allow_grow>
<auto_shrink>True</auto_shrink>
<widget>
<class>GtkVBox</class>
<name>vbox</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<widget>
<class>GtkToolbar</class>
<name>toolbar</name>
<width>112</width>
<height>16</height>
<orientation>GTK_ORIENTATION_HORIZONTAL</orientation>
<type>GTK_TOOLBAR_ICONS</type>
<space_size>5</space_size>
<space_style>GTK_TOOLBAR_SPACE_EMPTY</space_style>
<relief>GTK_RELIEF_NORMAL</relief>
<tooltips>True</tooltips>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkButton</class>
<child_name>Toolbar:button</child_name>
<name>toolbar_open</name>
<tooltip>Open file</tooltip>
<signal>
<name>clicked</name>
<handler>on_toolbar_open_clicked</handler>
<last_modification_time>Wed, 24 Jul 2002 18:28:31 GMT</last_modification_time>
</signal>
<label>Open</label>
<icon>familiar-openb16x16.xpm</icon>
</widget>
<widget>
<class>GtkButton</class>
<child_name>Toolbar:button</child_name>
<name>toolbar_preferences</name>
<tooltip>Preferences</tooltip>
<signal>
<name>clicked</name>
<handler>on_toolbar_preferences_clicked</handler>
<last_modification_time>Wed, 24 Jul 2002 18:29:05 GMT</last_modification_time>
</signal>
<label>Preferences</label>
<icon>familiar-preferencesb16x16.xpm</icon>
</widget>
<widget>
<class>GtkButton</class>
<child_name>Toolbar:button</child_name>
<name>toolbar_rewind</name>
<tooltip>Rewind stream</tooltip>
<signal>
<name>clicked</name>
<handler>on_toolbar_rewind_clicked</handler>
<last_modification_time>Wed, 24 Jul 2002 18:28:45 GMT</last_modification_time>
</signal>
<label>Rewind</label>
<icon>familiar-rewindb16x16.xpm</icon>
<child>
<new_group>True</new_group>
</child>
</widget>
<widget>
<class>GtkButton</class>
<child_name>Toolbar:button</child_name>
<name>toolbar_pause</name>
<tooltip>Pause stream</tooltip>
<signal>
<name>clicked</name>
<handler>on_toolbar_pause_clicked</handler>
<last_modification_time>Wed, 24 Jul 2002 18:28:58 GMT</last_modification_time>
</signal>
<label>Pause</label>
<icon>familiar-pauseb16x16.xpm</icon>
</widget>
<widget>
<class>GtkButton</class>
<child_name>Toolbar:button</child_name>
<name>toolbar_play</name>
<tooltip>Play stream</tooltip>
<signal>
<name>clicked</name>
<handler>on_toolbar_play_clicked</handler>
<last_modification_time>Wed, 24 Jul 2002 18:29:12 GMT</last_modification_time>
</signal>
<label>Play</label>
<icon>familiar-playb16x16.xpm</icon>
</widget>
<widget>
<class>GtkButton</class>
<child_name>Toolbar:button</child_name>
<name>toolbar_stop</name>
<tooltip>Stop stream</tooltip>
<signal>
<name>clicked</name>
<handler>on_toolbar_stop_clicked</handler>
<last_modification_time>Wed, 24 Jul 2002 18:29:18 GMT</last_modification_time>
</signal>
<label>Stop</label>
<icon>familiar-stopb16x16.xpm</icon>
</widget>
<widget>
<class>GtkButton</class>
<child_name>Toolbar:button</child_name>
<name>toolbar_forward</name>
<tooltip>Forward stream</tooltip>
<signal>
<name>clicked</name>
<handler>on_toolbar_forward_clicked</handler>
<last_modification_time>Wed, 24 Jul 2002 18:29:25 GMT</last_modification_time>
</signal>
<label>Forward</label>
<icon>familiar-forwardb16x16.xpm</icon>
</widget>
<widget>
<class>GtkButton</class>
<child_name>Toolbar:button</child_name>
<name>toolbar_about</name>
<tooltip>About</tooltip>
<signal>
<name>clicked</name>
<handler>on_toolbar_about_clicked</handler>
<last_modification_time>Wed, 24 Jul 2002 18:29:31 GMT</last_modification_time>
</signal>
<label>About</label>
<icon>vlc16x16.xpm</icon>
<child>
<new_group>True</new_group>
</child>
</widget>
</widget>
<widget>
<class>GtkProgressBar</class>
<name>progress</name>
<value>0</value>
<lower>0</lower>
<upper>100</upper>
<bar_style>GTK_PROGRESS_CONTINUOUS</bar_style>
<orientation>GTK_PROGRESS_LEFT_TO_RIGHT</orientation>
<activity_mode>True</activity_mode>
<show_text>False</show_text>
<format>%P %%</format>
<text_xalign>0.5</text_xalign>
<text_yalign>0.5</text_yalign>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkNotebook</class>
<name>notebook</name>
<can_focus>True</can_focus>
<show_tabs>True</show_tabs>
<show_border>True</show_border>
<tab_pos>GTK_POS_TOP</tab_pos>
<scrollable>False</scrollable>
<tab_hborder>2</tab_hborder>
<tab_vborder>2</tab_vborder>
<popup_enable>False</popup_enable>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkFixed</class>
<name>fixedMedia</name>
<widget>
<class>GtkLabel</class>
<name>labelUrl</name>
<x>4</x>
<y>8</y>
<width>38</width>
<height>18</height>
<label>URL:</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
</widget>
<widget>
<class>GtkCombo</class>
<name>comboURL</name>
<x>40</x>
<y>4</y>
<width>185</width>
<height>24</height>
<value_in_list>False</value_in_list>
<ok_if_empty>True</ok_if_empty>
<case_sensitive>False</case_sensitive>
<use_arrows>True</use_arrows>
<use_arrows_always>False</use_arrows_always>
<items>file://
ftp://
http://
udp://:1234
udpstream://@:1234
</items>
<widget>
<class>GtkEntry</class>
<child_name>GtkCombo:entry</child_name>
<name>comboURL-entry</name>
<can_focus>True</can_focus>
<signal>
<name>changed</name>
<handler>on_comboURL-entry_changed</handler>
<last_modification_time>Thu, 01 Aug 2002 19:37:06 GMT</last_modification_time>
</signal>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text>file://</text>
</widget>
</widget>
<widget>
<class>GtkScrolledWindow</class>
<name>scrolledwindow1</name>
<x>0</x>
<y>32</y>
<width>240</width>
<height>208</height>
<hscrollbar_policy>GTK_POLICY_ALWAYS</hscrollbar_policy>
<vscrollbar_policy>GTK_POLICY_ALWAYS</vscrollbar_policy>
<hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
<vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
<widget>
<class>GtkCList</class>
<name>clistmedia</name>
<can_focus>True</can_focus>
<signal>
<name>select_row</name>
<handler>on_clistmedia_select_row</handler>
<last_modification_time>Sun, 18 Aug 2002 19:40:44 GMT</last_modification_time>
</signal>
<signal>
<name>click_column</name>
<handler>on_clistmedia_click_column</handler>
<last_modification_time>Sun, 18 Aug 2002 19:41:06 GMT</last_modification_time>
</signal>
<columns>5</columns>
<column_widths>123,80,80,80,80</column_widths>
<selection_mode>GTK_SELECTION_SINGLE</selection_mode>
<show_titles>True</show_titles>
<shadow_type>GTK_SHADOW_IN</shadow_type>
<widget>
<class>GtkLabel</class>
<child_name>CList:title</child_name>
<name>labelname</name>
<label>Name</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
</widget>
<widget>
<class>GtkLabel</class>
<child_name>CList:title</child_name>
<name>labeltype</name>
<label>Type</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
</widget>
<widget>
<class>GtkLabel</class>
<child_name>CList:title</child_name>
<name>labelsize</name>
<label>Size</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
</widget>
<widget>
<class>GtkLabel</class>
<child_name>CList:title</child_name>
<name>labeluid</name>
<label>User</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
</widget>
<widget>
<class>GtkLabel</class>
<child_name>CList:title</child_name>
<name>labelgid</name>
<label>Group</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
</widget>
</widget>
</widget>
</widget>
<widget>
<class>GtkLabel</class>
<child_name>Notebook:tab</child_name>
<name>media</name>
<label>Media</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
</widget>
<widget>
<class>GtkFixed</class>
<name>fixedPreferences</name>
<widget>
<class>GtkButton</class>
<name>buttonSave</name>
<x>8</x>
<y>216</y>
<width>54</width>
<height>24</height>
<can_focus>True</can_focus>
<label>Save</label>
<relief>GTK_RELIEF_NORMAL</relief>
</widget>
<widget>
<class>GtkButton</class>
<name>buttonApply</name>
<x>64</x>
<y>216</y>
<width>54</width>
<height>24</height>
<can_focus>True</can_focus>
<label>Apply</label>
<relief>GTK_RELIEF_NORMAL</relief>
</widget>
<widget>
<class>GtkButton</class>
<name>buttonCancel</name>
<x>176</x>
<y>216</y>
<width>54</width>
<height>24</height>
<can_focus>True</can_focus>
<label>Cancel</label>
<relief>GTK_RELIEF_NORMAL</relief>
</widget>
<widget>
<class>GtkCheckButton</class>
<name>cbautoplay</name>
<x>8</x>
<y>8</y>
<width>216</width>
<height>24</height>
<can_focus>True</can_focus>
<signal>
<name>toggled</name>
<handler>on_cbautoplay_toggled</handler>
<last_modification_time>Sun, 18 Aug 2002 20:00:52 GMT</last_modification_time>
</signal>
<label>Automatically play file.</label>
<active>True</active>
<draw_indicator>True</draw_indicator>
</widget>
</widget>
<widget>
<class>GtkLabel</class>
<child_name>Notebook:tab</child_name>
<name>preferences</name>
<label>Preference</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
</widget>
<widget>
<class>GtkFixed</class>
<name>fixedAbout</name>
<widget>
<class>GtkPixmap</class>
<name>logo</name>
<x>8</x>
<y>0</y>
<width>50</width>
<height>50</height>
<filename>vlc32x32.xpm</filename>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<build_insensitive>True</build_insensitive>
</widget>
<widget>
<class>GtkLabel</class>
<name>labelVlc</name>
<x>64</x>
<y>8</y>
<width>120</width>
<height>40</height>
<label>VideoLAN Client
for familiar Linux</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>True</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
</widget>
<widget>
<class>GtkLabel</class>
<name>labelCopyright</name>
<x>16</x>
<y>56</y>
<width>200</width>
<height>18</height>
<label>(c) 2002, the VideoLAN Team</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
</widget>
<widget>
<class>GtkLabel</class>
<name>labelAuthors</name>
<x>16</x>
<y>80</y>
<width>200</width>
<height>40</height>
<label>Authors: The VideoLAN Team, http://www.videolan.org</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>True</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
</widget>
<widget>
<class>GtkLabel</class>
<name>labelAbout</name>
<x>16</x>
<y>128</y>
<width>200</width>
<height>70</height>
<label>The VideoLAN Client is a MPEG, MPEG 2, MP3, DivX player, that accepts input from local or network sources.</label>
<justify>GTK_JUSTIFY_LEFT</justify>
<wrap>True</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
</widget>
</widget>
<widget>
<class>GtkLabel</class>
<child_name>Notebook:tab</child_name>
<name>about</name>
<label>About</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
</widget>
</widget>
</widget>
</widget>
</GTK-Interface>
/*****************************************************************************
* familiar.h: private Gtk+ interface description
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: familiar.h,v 1.6.2.1 2002/09/30 20:37:13 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.
*****************************************************************************/
#define MAX_ATEXIT 10
/*****************************************************************************
* intf_sys_t: description and status of Gtk+ interface
*****************************************************************************/
typedef struct intf_sys_s
{
/* windows and widgets */
GtkWidget * p_window; /* main window */
GtkNotebook * p_notebook;
GtkProgressBar * p_progess;
GtkCList * p_clist;
boolean_t b_autoplayfile;
/* The input thread */
input_thread_t * p_input;
/* XXX: Ugly kludge, see gtk.c */
void ( *pf_callback[MAX_ATEXIT] ) ( void );
} intf_sys_t;
/*****************************************************************************
* Useful macro
****************************************************************************/
#define GtkGetIntf( widget ) __GtkGetIntf( GTK_WIDGET( widget ) )
void * __GtkGetIntf( GtkWidget * );
/*****************************************************************************
* 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 $
*
* 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 <stdio.h>
#include <string.h>
#include <dirent.h>
#include <sys/stat.h>
#include <unistd.h>
#include <videolan/vlc.h>
#include "stream_control.h"
#include "input_ext-intf.h"
#include "interface.h"
#include "intf_playlist.h"
#include "video.h"
#include "video_output.h"
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <gtk/gtk.h>
#include "familiar_callbacks.h"
#include "familiar_interface.h"
#include "familiar_support.h"
#include "familiar.h"
/*#include "netutils.h"*/
static void MediaURLOpenChanged( GtkWidget *widget, gchar *psz_url );
static char* get_file_perm(const char *path);
/*****************************************************************************
* 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;
}
/*****************************************************************************
* Helper functions for URL changes in Media and Preferences notebook pages.
****************************************************************************/
static void MediaURLOpenChanged( GtkWidget *widget, gchar *psz_url )
{
intf_thread_t *p_intf = GtkGetIntf( widget );
g_print( "%s\n",psz_url );
intf_ErrMsg( "@@@ MediaURLOpenChanged" );
if( p_intf->p_sys->p_input != NULL )
{
input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PLAY );
p_main->p_playlist->b_stopped = 0;
}
else
{
vlc_mutex_lock( &p_main->p_playlist->change_lock );
if( p_main->p_playlist->b_stopped )
{
if( p_main->p_playlist->i_size )
{
vlc_mutex_unlock( &p_main->p_playlist->change_lock );
intf_PlaylistJumpto( p_main->p_playlist,
p_main->p_playlist->i_index );
}
}
else
{
vlc_mutex_unlock( &p_main->p_playlist->change_lock );
}
}
}
/*****************************************************************
* Read directory helper function.
****************************************************************/
void ReadDirectory( GtkCList *clist, char *psz_dir )
{
// intf_thread_t *p_intf = GtkGetIntf( clist );
struct dirent **namelist;
int n,i;
intf_ErrMsg( "@@@ ReadDirectory - Enter" );
g_print( "%s\n",psz_dir );
if (psz_dir)
chdir(psz_dir);
n = scandir(".", &namelist, 0, NULL);
if (n<0)
perror("scandir");
else
{
gchar *ppsz_text[2];
gtk_clist_freeze( clist );
gtk_clist_clear( clist );
g_print( "dir entries: %d\n",n );
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);
g_print( "%s %s\n",ppsz_text[0],ppsz_text[1] );
if (strcmp(ppsz_text[1],"") == 0)
intf_ErrMsg("File system error unknown filetype encountered.");
gtk_clist_insert( clist, i, ppsz_text );
g_print( "%s\n",ppsz_text[0] );
free(namelist[i]);
}
free(namelist);
gtk_clist_thaw( clist );
}
intf_ErrMsg( "@@@ ReadDirectory - Exit" );
}
static char* get_file_perm(const char *path)
{
struct stat st;
char *perm;
perm = (char *) malloc(sizeof(char)*10);
strncpy( perm, "----------", sizeof("----------"));
if (lstat(path, &st)==0)
{
if (S_ISLNK(st.st_mode))
perm[0]= 'l';
else if (S_ISDIR(st.st_mode))
perm[0]= 'd';
else if (S_ISCHR(st.st_mode))
perm[0]= 'c';
else if (S_ISBLK(st.st_mode))
perm[0]= 'b';
else if (S_ISFIFO(st.st_mode))
perm[0]= 'f';
else if (S_ISSOCK(st.st_mode))
perm[0]= 's';
else if (S_ISREG(st.st_mode))
perm[0]= '-';
else /* Unknown type is an error */
perm[0]= '?';
/* Get file permissions */
/* User */
if (st.st_mode & S_IRUSR)
perm[1]= 'r';
if (st.st_mode & S_IWUSR)
perm[2]= 'w';
if (st.st_mode & S_IXUSR)
{
if (st.st_mode & S_ISUID)
perm[3] = 's';
else
perm[3]= 'x';
}
else if (st.st_mode & S_ISUID)
perm[3] = 'S';
/* Group */
if (st.st_mode & S_IRGRP)
perm[4]= 'r';
if (st.st_mode & S_IWGRP)
perm[5]= 'w';
if (st.st_mode & S_IXGRP)
{
if (st.st_mode & S_ISGID)
perm[6] = 's';
else
perm[6]= 'x';
}
else if (st.st_mode & S_ISGID)
perm[6] = 'S';
/* Other */
if (st.st_mode & S_IROTH)
perm[7]= 'r';
if (st.st_mode & S_IWOTH)
perm[8]= 'w';
if (st.st_mode & S_IXOTH)
{
// 'sticky' bit
if (st.st_mode &S_ISVTX)
perm[9] = 't';
else
perm[9]= 'x';
}
else if (st.st_mode &S_ISVTX)
perm[9]= 'T';
}
return perm;
}
/*
* 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->b_die = 1;
vlc_mutex_unlock( &p_intf->change_lock );
return TRUE;
}
void
on_toolbar_open_clicked (GtkButton *button,
gpointer user_data)
{
intf_thread_t *p_intf = GtkGetIntf( 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, ".");
}
void
on_toolbar_preferences_clicked (GtkButton *button,
gpointer user_data)
{
intf_thread_t *p_intf = GtkGetIntf( button );
gtk_widget_show( GTK_WIDGET(p_intf->p_sys->p_notebook) );
gdk_window_raise( p_intf->p_sys->p_window->window );
}
void
on_toolbar_rewind_clicked (GtkButton *button,
gpointer user_data)
{
intf_thread_t * p_intf = GtkGetIntf( button );
if( p_intf->p_sys->p_input )
{
input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_SLOWER );
}
}
void
on_toolbar_pause_clicked (GtkButton *button,
gpointer user_data)
{
intf_thread_t * p_intf = GtkGetIntf( button );
if( p_intf->p_sys->p_input )
{
input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PAUSE );
}
}
void
on_toolbar_play_clicked (GtkButton *button,
gpointer user_data)
{
intf_thread_t * p_intf = GtkGetIntf( button );
if( p_intf->p_sys->p_input == NULL )
{
gtk_widget_show( GTK_WIDGET(p_intf->p_sys->p_notebook) );
gdk_window_raise( p_intf->p_sys->p_window->window );
/* Display open page */
}
/* If the playlist is empty, open a file requester instead */
vlc_mutex_lock( &p_main->p_playlist->change_lock );
if( p_main->p_playlist->i_size )
{
vlc_mutex_unlock( &p_main->p_playlist->change_lock );
input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PLAY );
p_main->p_playlist->b_stopped = 0;
gdk_window_lower( p_intf->p_sys->p_window->window );
}
else
{
vlc_mutex_lock( &p_main->p_playlist->change_lock );
if( p_main->p_playlist->b_stopped )
{
if( p_main->p_playlist->i_size )
{
vlc_mutex_unlock( &p_main->p_playlist->change_lock );
intf_PlaylistJumpto( p_main->p_playlist,
p_main->p_playlist->i_index );
}
else
{
vlc_mutex_unlock( &p_main->p_playlist->change_lock );
/* simulate on open button click */
on_toolbar_open_clicked(button,user_data);
}
}
else
{
vlc_mutex_unlock( &p_main->p_playlist->change_lock );
}
}
}
void
on_toolbar_stop_clicked (GtkButton *button,
gpointer user_data)
{
intf_thread_t * p_intf = GtkGetIntf( button );
if( p_intf->p_sys->p_input != NULL )
{
/* end playing item */
p_intf->p_sys->p_input->b_eof = 1;
/* update playlist */
vlc_mutex_lock( &p_main->p_playlist->change_lock );
p_main->p_playlist->i_index--;
p_main->p_playlist->b_stopped = 1;
vlc_mutex_unlock( &p_main->p_playlist->change_lock );
gdk_window_raise( p_intf->p_sys->p_window->window );
}
}
void
on_toolbar_forward_clicked (GtkButton *button,
gpointer user_data)
{
intf_thread_t * p_intf = GtkGetIntf( button );
if( p_intf->p_sys->p_input )
{
input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_FASTER );
}
}
void
on_toolbar_about_clicked (GtkButton *button,
gpointer user_data)
{
intf_thread_t *p_intf = GtkGetIntf( button );
// Toggle notebook
if (p_intf->p_sys->p_notebook)
{
/* if ( gtk_get_data( GTK_WIDGET(p_intf->p_sys->p_notebook), "visible" ) )
* gtk_widget_hide( GTK_WIDGET(p_intf->p_sys->p_notebook) );
* else
*/ gtk_widget_show( GTK_WIDGET(p_intf->p_sys->p_notebook) );
}
gdk_window_raise( p_intf->p_sys->p_window->window );
}
void
on_comboURL_entry_changed (GtkEditable *editable,
gpointer user_data)
{
intf_thread_t * p_intf = GtkGetIntf( editable );
gchar * psz_url;
if (p_intf->p_sys->b_autoplayfile == 1)
{
psz_url = gtk_entry_get_text(GTK_ENTRY(editable));
MediaURLOpenChanged( GTK_WIDGET(editable), psz_url );
}
}
void
on_clistmedia_click_column (GtkCList *clist,
gint column,
gpointer user_data)
{
static GtkSortType sort_type = GTK_SORT_ASCENDING;
// Should sort on column
switch(sort_type)
{
case GTK_SORT_ASCENDING:
sort_type = GTK_SORT_DESCENDING;
break;
case GTK_SORT_DESCENDING:
sort_type = GTK_SORT_ASCENDING;
break;
}
gtk_clist_freeze( clist );
gtk_clist_set_sort_type( clist, sort_type );
gtk_clist_sort( clist );
gtk_clist_thaw( clist );
}
void
on_clistmedia_select_row (GtkCList *clist,
gint row,
gint column,
GdkEvent *event,
gpointer user_data)
{
gchar *text[2];
gint ret;
struct stat st;
ret = gtk_clist_get_text (clist, row, 0, text);
if (ret)
{
if (lstat((char*)text[0], &st)==0)
{
if (S_ISDIR(st.st_mode))
ReadDirectory(clist, text[0]);
else
MediaURLOpenChanged(GTK_WIDGET(clist), text[0]);
}
}
}
void
on_cbautoplay_toggled (GtkToggleButton *togglebutton,
gpointer user_data)
{
intf_thread_t * p_intf = GtkGetIntf( togglebutton );
if (p_intf->p_sys->b_autoplayfile == 1)
p_intf->p_sys->b_autoplayfile = 0;
else
p_intf->p_sys->b_autoplayfile = 1;
}
gboolean
on_familiar_delete_event (GtkWidget *widget,
GdkEvent *event,
gpointer user_data)
{
GtkExit( GTK_WIDGET( widget ), user_data );
return TRUE;
}
/*****************************************************************************
* 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 $
*
* 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.
*****************************************************************************/
#include <gtk/gtk.h>
gboolean GtkExit ( GtkWidget *, gpointer );
void ReadDirectory(GtkCList *clist, char *psz_dir);
void
on_toolbar_open_clicked (GtkButton *button,
gpointer user_data);
void
on_toolbar_preferences_clicked (GtkButton *button,
gpointer user_data);
void
on_toolbar_rewind_clicked (GtkButton *button,
gpointer user_data);
void
on_toolbar_pause_clicked (GtkButton *button,
gpointer user_data);
void
on_toolbar_play_clicked (GtkButton *button,
gpointer user_data);
void
on_toolbar_stop_clicked (GtkButton *button,
gpointer user_data);
void
on_toolbar_forward_clicked (GtkButton *button,
gpointer user_data);
void
on_toolbar_about_clicked (GtkButton *button,
gpointer user_data);
void
on_comboURL_entry_changed (GtkEditable *editable,
gpointer user_data);
void
on_clistmedia_click_column (GtkCList *clist,
gint column,
gpointer user_data);
void
on_clistmedia_select_row (GtkCList *clist,
gint row,
gint column,
GdkEvent *event,
gpointer user_data);
void
on_cbautoplay_toggled (GtkToggleButton *togglebutton,
gpointer user_data);
gboolean
on_familiar_delete_event (GtkWidget *widget,
GdkEvent *event,
gpointer user_data);
/*
* DO NOT EDIT THIS FILE - it is generated by Glade.
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
#include "familiar_callbacks.h"
#include "familiar_interface.h"
#include "familiar_support.h"
GtkWidget*
create_familiar (void)
{
GtkWidget *familiar;
GtkWidget *vbox;
GtkWidget *toolbar;
GtkWidget *tmp_toolbar_icon;
GtkWidget *toolbar_open;
GtkWidget *toolbar_preferences;
GtkWidget *toolbar_rewind;
GtkWidget *toolbar_pause;
GtkWidget *toolbar_play;
GtkWidget *toolbar_stop;
GtkWidget *toolbar_forward;
GtkWidget *toolbar_about;
GtkWidget *progress;
GtkWidget *notebook;
GtkWidget *fixedMedia;
GtkWidget *labelUrl;
GtkWidget *comboURL;
GList *comboURL_items = NULL;
GtkWidget *comboURL_entry;
GtkWidget *scrolledwindow1;
GtkWidget *clistmedia;
GtkWidget *labelname;
GtkWidget *labeltype;
GtkWidget *labelsize;
GtkWidget *labeluid;
GtkWidget *labelgid;
GtkWidget *media;
GtkWidget *fixedPreferences;
GtkWidget *buttonSave;
GtkWidget *buttonApply;
GtkWidget *buttonCancel;
GtkWidget *cbautoplay;
GtkWidget *preferences;
GtkWidget *fixedAbout;
GtkWidget *logo;
GtkWidget *labelVlc;
GtkWidget *labelCopyright;
GtkWidget *labelAuthors;
GtkWidget *labelAbout;
GtkWidget *about;
familiar = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_set_name (familiar, "familiar");
gtk_object_set_data (GTK_OBJECT (familiar), "familiar", familiar);
gtk_widget_set_usize (familiar, 240, 320);
gtk_window_set_title (GTK_WINDOW (familiar), _("vlc (familiar)"));
gtk_window_set_policy (GTK_WINDOW (familiar), TRUE, TRUE, TRUE);
vbox = gtk_vbox_new (FALSE, 0);
gtk_widget_set_name (vbox, "vbox");
gtk_widget_ref (vbox);
gtk_object_set_data_full (GTK_OBJECT (familiar), "vbox", vbox,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (vbox);
gtk_container_add (GTK_CONTAINER (familiar), vbox);
toolbar = gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_ICONS);
gtk_widget_set_name (toolbar, "toolbar");
gtk_widget_ref (toolbar);
gtk_object_set_data_full (GTK_OBJECT (familiar), "toolbar", toolbar,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (toolbar);
gtk_box_pack_start (GTK_BOX (vbox), toolbar, TRUE, TRUE, 0);
gtk_widget_set_usize (toolbar, 112, 16);
tmp_toolbar_icon = create_pixmap (familiar, "familiar-openb16x16.xpm");
toolbar_open = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar),
GTK_TOOLBAR_CHILD_BUTTON,
NULL,
_("Open"),
_("Open file"), NULL,
tmp_toolbar_icon, NULL, NULL);
gtk_widget_set_name (toolbar_open, "toolbar_open");
gtk_widget_ref (toolbar_open);
gtk_object_set_data_full (GTK_OBJECT (familiar), "toolbar_open", toolbar_open,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (toolbar_open);
tmp_toolbar_icon = create_pixmap (familiar, "familiar-preferencesb16x16.xpm");
toolbar_preferences = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar),
GTK_TOOLBAR_CHILD_BUTTON,
NULL,
_("Preferences"),
_("Preferences"), NULL,
tmp_toolbar_icon, NULL, NULL);
gtk_widget_set_name (toolbar_preferences, "toolbar_preferences");
gtk_widget_ref (toolbar_preferences);
gtk_object_set_data_full (GTK_OBJECT (familiar), "toolbar_preferences", toolbar_preferences,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (toolbar_preferences);
gtk_toolbar_append_space (GTK_TOOLBAR (toolbar));
tmp_toolbar_icon = create_pixmap (familiar, "familiar-rewindb16x16.xpm");
toolbar_rewind = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar),
GTK_TOOLBAR_CHILD_BUTTON,
NULL,
_("Rewind"),
_("Rewind stream"), NULL,
tmp_toolbar_icon, NULL, NULL);
gtk_widget_set_name (toolbar_rewind, "toolbar_rewind");
gtk_widget_ref (toolbar_rewind);
gtk_object_set_data_full (GTK_OBJECT (familiar), "toolbar_rewind", toolbar_rewind,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (toolbar_rewind);
tmp_toolbar_icon = create_pixmap (familiar, "familiar-pauseb16x16.xpm");
toolbar_pause = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar),
GTK_TOOLBAR_CHILD_BUTTON,
NULL,
_("Pause"),
_("Pause stream"), NULL,
tmp_toolbar_icon, NULL, NULL);
gtk_widget_set_name (toolbar_pause, "toolbar_pause");
gtk_widget_ref (toolbar_pause);
gtk_object_set_data_full (GTK_OBJECT (familiar), "toolbar_pause", toolbar_pause,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (toolbar_pause);
tmp_toolbar_icon = create_pixmap (familiar, "familiar-playb16x16.xpm");
toolbar_play = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar),
GTK_TOOLBAR_CHILD_BUTTON,
NULL,
_("Play"),
_("Play stream"), NULL,
tmp_toolbar_icon, NULL, NULL);
gtk_widget_set_name (toolbar_play, "toolbar_play");
gtk_widget_ref (toolbar_play);
gtk_object_set_data_full (GTK_OBJECT (familiar), "toolbar_play", toolbar_play,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (toolbar_play);
tmp_toolbar_icon = create_pixmap (familiar, "familiar-stopb16x16.xpm");
toolbar_stop = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar),
GTK_TOOLBAR_CHILD_BUTTON,
NULL,
_("Stop"),
_("Stop stream"), NULL,
tmp_toolbar_icon, NULL, NULL);
gtk_widget_set_name (toolbar_stop, "toolbar_stop");
gtk_widget_ref (toolbar_stop);
gtk_object_set_data_full (GTK_OBJECT (familiar), "toolbar_stop", toolbar_stop,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (toolbar_stop);
tmp_toolbar_icon = create_pixmap (familiar, "familiar-forwardb16x16.xpm");
toolbar_forward = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar),
GTK_TOOLBAR_CHILD_BUTTON,
NULL,
_("Forward"),
_("Forward stream"), NULL,
tmp_toolbar_icon, NULL, NULL);
gtk_widget_set_name (toolbar_forward, "toolbar_forward");
gtk_widget_ref (toolbar_forward);
gtk_object_set_data_full (GTK_OBJECT (familiar), "toolbar_forward", toolbar_forward,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (toolbar_forward);
gtk_toolbar_append_space (GTK_TOOLBAR (toolbar));
tmp_toolbar_icon = create_pixmap (familiar, "vlc16x16.xpm");
toolbar_about = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar),
GTK_TOOLBAR_CHILD_BUTTON,
NULL,
_("About"),
_("About"), NULL,
tmp_toolbar_icon, NULL, NULL);
gtk_widget_set_name (toolbar_about, "toolbar_about");
gtk_widget_ref (toolbar_about);
gtk_object_set_data_full (GTK_OBJECT (familiar), "toolbar_about", toolbar_about,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (toolbar_about);
progress = gtk_progress_bar_new ();
gtk_widget_set_name (progress, "progress");
gtk_widget_ref (progress);
gtk_object_set_data_full (GTK_OBJECT (familiar), "progress", progress,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (progress);
gtk_box_pack_start (GTK_BOX (vbox), progress, FALSE, FALSE, 0);
gtk_progress_set_activity_mode (GTK_PROGRESS (progress), TRUE);
notebook = gtk_notebook_new ();
gtk_widget_set_name (notebook, "notebook");
gtk_widget_ref (notebook);
gtk_object_set_data_full (GTK_OBJECT (familiar), "notebook", notebook,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (notebook);
gtk_box_pack_start (GTK_BOX (vbox), notebook, TRUE, TRUE, 0);
fixedMedia = gtk_fixed_new ();
gtk_widget_set_name (fixedMedia, "fixedMedia");
gtk_widget_ref (fixedMedia);
gtk_object_set_data_full (GTK_OBJECT (familiar), "fixedMedia", fixedMedia,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (fixedMedia);
gtk_container_add (GTK_CONTAINER (notebook), fixedMedia);
labelUrl = gtk_label_new (_("URL:"));
gtk_widget_set_name (labelUrl, "labelUrl");
gtk_widget_ref (labelUrl);
gtk_object_set_data_full (GTK_OBJECT (familiar), "labelUrl", labelUrl,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (labelUrl);
gtk_fixed_put (GTK_FIXED (fixedMedia), labelUrl, 4, 8);
gtk_widget_set_uposition (labelUrl, 4, 8);
gtk_widget_set_usize (labelUrl, 38, 18);
comboURL = gtk_combo_new ();
gtk_widget_set_name (comboURL, "comboURL");
gtk_widget_ref (comboURL);
gtk_object_set_data_full (GTK_OBJECT (familiar), "comboURL", comboURL,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (comboURL);
gtk_fixed_put (GTK_FIXED (fixedMedia), comboURL, 40, 4);
gtk_widget_set_uposition (comboURL, 40, 4);
gtk_widget_set_usize (comboURL, 185, 24);
comboURL_items = g_list_append (comboURL_items, (gpointer) _("file://"));
comboURL_items = g_list_append (comboURL_items, (gpointer) _("ftp://"));
comboURL_items = g_list_append (comboURL_items, (gpointer) _("http://"));
comboURL_items = g_list_append (comboURL_items, (gpointer) _("udp://:1234"));
comboURL_items = g_list_append (comboURL_items, (gpointer) _("udpstream://@:1234"));
gtk_combo_set_popdown_strings (GTK_COMBO (comboURL), comboURL_items);
g_list_free (comboURL_items);
comboURL_entry = GTK_COMBO (comboURL)->entry;
gtk_widget_set_name (comboURL_entry, "comboURL_entry");
gtk_widget_ref (comboURL_entry);
gtk_object_set_data_full (GTK_OBJECT (familiar), "comboURL_entry", comboURL_entry,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (comboURL_entry);
gtk_entry_set_text (GTK_ENTRY (comboURL_entry), _("file://"));
scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_set_name (scrolledwindow1, "scrolledwindow1");
gtk_widget_ref (scrolledwindow1);
gtk_object_set_data_full (GTK_OBJECT (familiar), "scrolledwindow1", scrolledwindow1,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (scrolledwindow1);
gtk_fixed_put (GTK_FIXED (fixedMedia), scrolledwindow1, 0, 32);
gtk_widget_set_uposition (scrolledwindow1, 0, 32);
gtk_widget_set_usize (scrolledwindow1, 240, 208);
clistmedia = gtk_clist_new (5);
gtk_widget_set_name (clistmedia, "clistmedia");
gtk_widget_ref (clistmedia);
gtk_object_set_data_full (GTK_OBJECT (familiar), "clistmedia", clistmedia,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (clistmedia);
gtk_container_add (GTK_CONTAINER (scrolledwindow1), clistmedia);
gtk_clist_set_column_width (GTK_CLIST (clistmedia), 0, 123);
gtk_clist_set_column_width (GTK_CLIST (clistmedia), 1, 80);
gtk_clist_set_column_width (GTK_CLIST (clistmedia), 2, 80);
gtk_clist_set_column_width (GTK_CLIST (clistmedia), 3, 80);
gtk_clist_set_column_width (GTK_CLIST (clistmedia), 4, 80);
gtk_clist_column_titles_show (GTK_CLIST (clistmedia));
labelname = gtk_label_new (_("Name"));
gtk_widget_set_name (labelname, "labelname");
gtk_widget_ref (labelname);
gtk_object_set_data_full (GTK_OBJECT (familiar), "labelname", labelname,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (labelname);
gtk_clist_set_column_widget (GTK_CLIST (clistmedia), 0, labelname);
labeltype = gtk_label_new (_("Type"));
gtk_widget_set_name (labeltype, "labeltype");
gtk_widget_ref (labeltype);
gtk_object_set_data_full (GTK_OBJECT (familiar), "labeltype", labeltype,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (labeltype);
gtk_clist_set_column_widget (GTK_CLIST (clistmedia), 1, labeltype);
labelsize = gtk_label_new (_("Size"));
gtk_widget_set_name (labelsize, "labelsize");
gtk_widget_ref (labelsize);
gtk_object_set_data_full (GTK_OBJECT (familiar), "labelsize", labelsize,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (labelsize);
gtk_clist_set_column_widget (GTK_CLIST (clistmedia), 2, labelsize);
labeluid = gtk_label_new (_("User"));
gtk_widget_set_name (labeluid, "labeluid");
gtk_widget_ref (labeluid);
gtk_object_set_data_full (GTK_OBJECT (familiar), "labeluid", labeluid,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (labeluid);
gtk_clist_set_column_widget (GTK_CLIST (clistmedia), 3, labeluid);
labelgid = gtk_label_new (_("Group"));
gtk_widget_set_name (labelgid, "labelgid");
gtk_widget_ref (labelgid);
gtk_object_set_data_full (GTK_OBJECT (familiar), "labelgid", labelgid,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (labelgid);
gtk_clist_set_column_widget (GTK_CLIST (clistmedia), 4, labelgid);
media = gtk_label_new (_("Media"));
gtk_widget_set_name (media, "media");
gtk_widget_ref (media);
gtk_object_set_data_full (GTK_OBJECT (familiar), "media", media,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (media);
gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), 0), media);
fixedPreferences = gtk_fixed_new ();
gtk_widget_set_name (fixedPreferences, "fixedPreferences");
gtk_widget_ref (fixedPreferences);
gtk_object_set_data_full (GTK_OBJECT (familiar), "fixedPreferences", fixedPreferences,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (fixedPreferences);
gtk_container_add (GTK_CONTAINER (notebook), fixedPreferences);
buttonSave = gtk_button_new_with_label (_("Save"));
gtk_widget_set_name (buttonSave, "buttonSave");
gtk_widget_ref (buttonSave);
gtk_object_set_data_full (GTK_OBJECT (familiar), "buttonSave", buttonSave,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (buttonSave);
gtk_fixed_put (GTK_FIXED (fixedPreferences), buttonSave, 8, 216);
gtk_widget_set_uposition (buttonSave, 8, 216);
gtk_widget_set_usize (buttonSave, 54, 24);
buttonApply = gtk_button_new_with_label (_("Apply"));
gtk_widget_set_name (buttonApply, "buttonApply");
gtk_widget_ref (buttonApply);
gtk_object_set_data_full (GTK_OBJECT (familiar), "buttonApply", buttonApply,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (buttonApply);
gtk_fixed_put (GTK_FIXED (fixedPreferences), buttonApply, 64, 216);
gtk_widget_set_uposition (buttonApply, 64, 216);
gtk_widget_set_usize (buttonApply, 54, 24);
buttonCancel = gtk_button_new_with_label (_("Cancel"));
gtk_widget_set_name (buttonCancel, "buttonCancel");
gtk_widget_ref (buttonCancel);
gtk_object_set_data_full (GTK_OBJECT (familiar), "buttonCancel", buttonCancel,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (buttonCancel);
gtk_fixed_put (GTK_FIXED (fixedPreferences), buttonCancel, 176, 216);
gtk_widget_set_uposition (buttonCancel, 176, 216);
gtk_widget_set_usize (buttonCancel, 54, 24);
cbautoplay = gtk_check_button_new_with_label (_("Automatically play file."));
gtk_widget_set_name (cbautoplay, "cbautoplay");
gtk_widget_ref (cbautoplay);
gtk_object_set_data_full (GTK_OBJECT (familiar), "cbautoplay", cbautoplay,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (cbautoplay);
gtk_fixed_put (GTK_FIXED (fixedPreferences), cbautoplay, 8, 8);
gtk_widget_set_uposition (cbautoplay, 8, 8);
gtk_widget_set_usize (cbautoplay, 216, 24);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cbautoplay), TRUE);
preferences = gtk_label_new (_("Preference"));
gtk_widget_set_name (preferences, "preferences");
gtk_widget_ref (preferences);
gtk_object_set_data_full (GTK_OBJECT (familiar), "preferences", preferences,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (preferences);
gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), 1), preferences);
fixedAbout = gtk_fixed_new ();
gtk_widget_set_name (fixedAbout, "fixedAbout");
gtk_widget_ref (fixedAbout);
gtk_object_set_data_full (GTK_OBJECT (familiar), "fixedAbout", fixedAbout,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (fixedAbout);
gtk_container_add (GTK_CONTAINER (notebook), fixedAbout);
logo = create_pixmap (familiar, "vlc32x32.xpm");
gtk_widget_set_name (logo, "logo");
gtk_widget_ref (logo);
gtk_object_set_data_full (GTK_OBJECT (familiar), "logo", logo,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (logo);
gtk_fixed_put (GTK_FIXED (fixedAbout), logo, 8, 0);
gtk_widget_set_uposition (logo, 8, 0);
gtk_widget_set_usize (logo, 50, 50);
labelVlc = gtk_label_new (_("VideoLAN Client\n for familiar Linux"));
gtk_widget_set_name (labelVlc, "labelVlc");
gtk_widget_ref (labelVlc);
gtk_object_set_data_full (GTK_OBJECT (familiar), "labelVlc", labelVlc,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (labelVlc);
gtk_fixed_put (GTK_FIXED (fixedAbout), labelVlc, 64, 8);
gtk_widget_set_uposition (labelVlc, 64, 8);
gtk_widget_set_usize (labelVlc, 120, 40);
gtk_label_set_line_wrap (GTK_LABEL (labelVlc), TRUE);
labelCopyright = gtk_label_new (_("(c) 2002, the VideoLAN Team"));
gtk_widget_set_name (labelCopyright, "labelCopyright");
gtk_widget_ref (labelCopyright);
gtk_object_set_data_full (GTK_OBJECT (familiar), "labelCopyright", labelCopyright,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (labelCopyright);
gtk_fixed_put (GTK_FIXED (fixedAbout), labelCopyright, 16, 56);
gtk_widget_set_uposition (labelCopyright, 16, 56);
gtk_widget_set_usize (labelCopyright, 200, 18);
labelAuthors = gtk_label_new (_("Authors: The VideoLAN Team, http://www.videolan.org"));
gtk_widget_set_name (labelAuthors, "labelAuthors");
gtk_widget_ref (labelAuthors);
gtk_object_set_data_full (GTK_OBJECT (familiar), "labelAuthors", labelAuthors,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (labelAuthors);
gtk_fixed_put (GTK_FIXED (fixedAbout), labelAuthors, 16, 80);
gtk_widget_set_uposition (labelAuthors, 16, 80);
gtk_widget_set_usize (labelAuthors, 200, 40);
gtk_label_set_line_wrap (GTK_LABEL (labelAuthors), TRUE);
labelAbout = gtk_label_new (_("The VideoLAN Client is a MPEG, MPEG 2, MP3, DivX player, that accepts input from local or network sources."));
gtk_widget_set_name (labelAbout, "labelAbout");
gtk_widget_ref (labelAbout);
gtk_object_set_data_full (GTK_OBJECT (familiar), "labelAbout", labelAbout,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (labelAbout);
gtk_fixed_put (GTK_FIXED (fixedAbout), labelAbout, 16, 128);
gtk_widget_set_uposition (labelAbout, 16, 128);
gtk_widget_set_usize (labelAbout, 200, 70);
gtk_label_set_justify (GTK_LABEL (labelAbout), GTK_JUSTIFY_LEFT);
gtk_label_set_line_wrap (GTK_LABEL (labelAbout), TRUE);
about = gtk_label_new (_("About"));
gtk_widget_set_name (about, "about");
gtk_widget_ref (about);
gtk_object_set_data_full (GTK_OBJECT (familiar), "about", about,
(GtkDestroyNotify) gtk_widget_unref);
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), "delete_event",
GTK_SIGNAL_FUNC (on_familiar_delete_event),
NULL);
gtk_signal_connect (GTK_OBJECT (toolbar_open), "clicked",
GTK_SIGNAL_FUNC (on_toolbar_open_clicked),
NULL);
gtk_signal_connect (GTK_OBJECT (toolbar_preferences), "clicked",
GTK_SIGNAL_FUNC (on_toolbar_preferences_clicked),
NULL);
gtk_signal_connect (GTK_OBJECT (toolbar_rewind), "clicked",
GTK_SIGNAL_FUNC (on_toolbar_rewind_clicked),
NULL);
gtk_signal_connect (GTK_OBJECT (toolbar_pause), "clicked",
GTK_SIGNAL_FUNC (on_toolbar_pause_clicked),
NULL);
gtk_signal_connect (GTK_OBJECT (toolbar_play), "clicked",
GTK_SIGNAL_FUNC (on_toolbar_play_clicked),
NULL);
gtk_signal_connect (GTK_OBJECT (toolbar_stop), "clicked",
GTK_SIGNAL_FUNC (on_toolbar_stop_clicked),
NULL);
gtk_signal_connect (GTK_OBJECT (toolbar_forward), "clicked",
GTK_SIGNAL_FUNC (on_toolbar_forward_clicked),
NULL);
gtk_signal_connect (GTK_OBJECT (toolbar_about), "clicked",
GTK_SIGNAL_FUNC (on_toolbar_about_clicked),
NULL);
gtk_signal_connect (GTK_OBJECT (comboURL_entry), "changed",
GTK_SIGNAL_FUNC (on_comboURL_entry_changed),
NULL);
gtk_signal_connect (GTK_OBJECT (clistmedia), "select_row",
GTK_SIGNAL_FUNC (on_clistmedia_select_row),
NULL);
gtk_signal_connect (GTK_OBJECT (clistmedia), "click_column",
GTK_SIGNAL_FUNC (on_clistmedia_click_column),
NULL);
gtk_signal_connect (GTK_OBJECT (cbautoplay), "toggled",
GTK_SIGNAL_FUNC (on_cbautoplay_toggled),
NULL);
return familiar;
}
/*
* DO NOT EDIT THIS FILE - it is generated by Glade.
*/
GtkWidget* create_familiar (void);
/*
* DO NOT EDIT THIS FILE - it is generated by Glade.
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <gtk/gtk.h>
#include "familiar_support.h"
/* This is an internally used function to check if a pixmap file exists. */
static gchar* check_file_exists (const gchar *directory,
const gchar *filename);
/* This is an internally used function to create pixmaps. */
static GtkWidget* create_dummy_pixmap (GtkWidget *widget);
GtkWidget*
lookup_widget (GtkWidget *widget,
const gchar *widget_name)
{
GtkWidget *parent, *found_widget;
for (;;)
{
if (GTK_IS_MENU (widget))
parent = gtk_menu_get_attach_widget (GTK_MENU (widget));
else
parent = widget->parent;
if (parent == NULL)
break;
widget = parent;
}
found_widget = (GtkWidget*) gtk_object_get_data (GTK_OBJECT (widget),
widget_name);
if (!found_widget)
g_warning ("Widget not found: %s", widget_name);
return found_widget;
}
/* This is a dummy pixmap we use when a pixmap can't be found. */
static char *dummy_pixmap_xpm[] = {
/* columns rows colors chars-per-pixel */
"1 1 1 1",
" c None",
/* pixels */
" "
};
/* This is an internally used function to create pixmaps. */
static GtkWidget*
create_dummy_pixmap (GtkWidget *widget)
{
GdkColormap *colormap;
GdkPixmap *gdkpixmap;
GdkBitmap *mask;
GtkWidget *pixmap;
colormap = gtk_widget_get_colormap (widget);
gdkpixmap = gdk_pixmap_colormap_create_from_xpm_d (NULL, colormap, &mask,
NULL, dummy_pixmap_xpm);
if (gdkpixmap == NULL)
g_error ("Couldn't create replacement pixmap.");
pixmap = gtk_pixmap_new (gdkpixmap, mask);
gdk_pixmap_unref (gdkpixmap);
gdk_bitmap_unref (mask);
return pixmap;
}
static GList *pixmaps_directories = NULL;
/* Use this function to set the directory containing installed pixmaps. */
void
add_pixmap_directory (const gchar *directory)
{
pixmaps_directories = g_list_prepend (pixmaps_directories,
g_strdup (directory));
}
/* This is an internally used function to create pixmaps. */
GtkWidget*
create_pixmap (GtkWidget *widget,
const gchar *filename)
{
gchar *found_filename = NULL;
GdkColormap *colormap;
GdkPixmap *gdkpixmap;
GdkBitmap *mask;
GtkWidget *pixmap;
GList *elem;
if (!filename || !filename[0])
return create_dummy_pixmap (widget);
/* We first try any pixmaps directories set by the application. */
elem = pixmaps_directories;
while (elem)
{
found_filename = check_file_exists ((gchar*)elem->data, filename);
if (found_filename)
break;
elem = elem->next;
}
/* If we haven't found the pixmap, try the source directory. */
if (!found_filename)
{
found_filename = check_file_exists ("../../share", filename);
}
if (!found_filename)
{
g_warning (_("Couldn't find pixmap file: %s"), filename);
return create_dummy_pixmap (widget);
}
colormap = gtk_widget_get_colormap (widget);
gdkpixmap = gdk_pixmap_colormap_create_from_xpm (NULL, colormap, &mask,
NULL, found_filename);
if (gdkpixmap == NULL)
{
g_warning (_("Error loading pixmap file: %s"), found_filename);
g_free (found_filename);
return create_dummy_pixmap (widget);
}
g_free (found_filename);
pixmap = gtk_pixmap_new (gdkpixmap, mask);
gdk_pixmap_unref (gdkpixmap);
gdk_bitmap_unref (mask);
return pixmap;
}
/* This is an internally used function to check if a pixmap file exists. */
static gchar*
check_file_exists (const gchar *directory,
const gchar *filename)
{
gchar *full_filename;
struct stat s;
gint status;
full_filename = (gchar*) g_malloc (strlen (directory) + 1
+ strlen (filename) + 1);
strcpy (full_filename, directory);
strcat (full_filename, G_DIR_SEPARATOR_S);
strcat (full_filename, filename);
status = stat (full_filename, &s);
if (status == 0 && S_ISREG (s.st_mode))
return full_filename;
g_free (full_filename);
return NULL;
}
/*
* DO NOT EDIT THIS FILE - it is generated by Glade.
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <gtk/gtk.h>
/*
* Standard gettext macros.
*/
#ifdef ENABLE_NLS
# include <libintl.h>
# undef _
# define _(String) dgettext (PACKAGE, String)
# ifdef gettext_noop
# define N_(String) gettext_noop (String)
# else
# define N_(String) (String)
# endif
#else
# define textdomain(String) (String)
# define gettext(String) (String)
# define dgettext(Domain,Message) (Message)
# define dcgettext(Domain,Message,Type) (Message)
# define bindtextdomain(Domain,Directory) (Domain)
# define _(String) (String)
# define N_(String) (String)
#endif
/*
* Public Functions.
*/
/*
* This function returns a widget in a component created by Glade.
* Call it with the toplevel widget in the component (i.e. a window/dialog),
* or alternatively any widget in the component, and the name of the widget
* you want returned.
*/
GtkWidget* lookup_widget (GtkWidget *widget,
const gchar *widget_name);
/* get_widget() is deprecated. Use lookup_widget instead. */
#define get_widget lookup_widget
/* Use this function to set the directory containing installed pixmaps. */
void add_pixmap_directory (const gchar *directory);
/*
* Private Functions.
*/
/* This is used to create the pixmaps in the interface. */
GtkWidget* create_pixmap (GtkWidget *widget,
const gchar *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