Commit 278bc72e authored by Gildas Bazin's avatar Gildas Bazin

* This the last piece of the new configuration module. You can now save your
configuration options (only from the gtk/gnome interface for now). The config
file will be saved as ~/.VideoLan/vlc

It's not quite yet finished (well there are a few small details to sort out),
but I'm going away for the week-end and I wanted to commit this before so you
can all have a play with it :)
parent dffb93e1
This diff is collapsed.
...@@ -162,6 +162,7 @@ AC_CHECK_FUNCS(swab) ...@@ -162,6 +162,7 @@ AC_CHECK_FUNCS(swab)
AC_CHECK_FUNCS([memalign valloc]) AC_CHECK_FUNCS([memalign valloc])
AC_CHECK_FUNCS(sigrelse) AC_CHECK_FUNCS(sigrelse)
AC_CHECK_FUNCS(getpwuid_r getpwuid)
dnl Check for getopt dnl Check for getopt
NEED_GETOPT=0 NEED_GETOPT=0
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* Collection of useful common types and macros definitions * Collection of useful common types and macros definitions
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN * Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: common.h,v 1.85 2002/03/11 07:23:09 gbazin Exp $ * $Id: common.h,v 1.86 2002/03/16 01:40:58 gbazin Exp $
* *
* Authors: Samuel Hocevar <sam@via.ecp.fr> * Authors: Samuel Hocevar <sam@via.ecp.fr>
* Vincent Seguin <seguin@via.ecp.fr> * Vincent Seguin <seguin@via.ecp.fr>
...@@ -472,6 +472,8 @@ typedef struct module_symbols_s ...@@ -472,6 +472,8 @@ typedef struct module_symbols_s
char * ( * config_GetPszVariable ) ( const char * ); char * ( * config_GetPszVariable ) ( const char * );
void ( * config_PutIntVariable ) ( const char *, int ); void ( * config_PutIntVariable ) ( const char *, int );
void ( * config_PutPszVariable ) ( const char *, char * ); void ( * config_PutPszVariable ) ( const char *, char * );
int ( * config_LoadConfigFile ) ( const char * );
int ( * config_SaveConfigFile ) ( const char * );
struct module_config_s * ( * config_FindConfig ) ( const char * ); struct module_config_s * ( * config_FindConfig ) ( const char * );
struct module_config_s * ( * config_Duplicate ) ( struct module_s * ); struct module_config_s * ( * config_Duplicate ) ( struct module_s * );
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* It includes functions allowing to declare, get or set configuration options. * It includes functions allowing to declare, get or set configuration options.
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: configuration.h,v 1.2 2002/03/11 07:23:09 gbazin Exp $ * $Id: configuration.h,v 1.3 2002/03/16 01:40:58 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -69,15 +69,20 @@ char * config_GetPszVariable( const char *psz_name ); ...@@ -69,15 +69,20 @@ char * config_GetPszVariable( const char *psz_name );
void config_PutIntVariable( const char *psz_name, int i_value ); void config_PutIntVariable( const char *psz_name, int i_value );
void config_PutPszVariable( const char *psz_name, char *psz_value ); void config_PutPszVariable( const char *psz_name, char *psz_value );
int config_LoadConfigFile( const char *psz_module_name );
int config_SaveConfigFile( const char *psz_module_name );
module_config_t *config_FindConfig( const char *psz_name ); module_config_t *config_FindConfig( const char *psz_name );
module_config_t *config_Duplicate ( module_t *p_module ); module_config_t *config_Duplicate ( module_t *p_module );
#else #else
# define config_GetIntVariable p_symbols->config_GetIntVariable # define config_GetIntVariable p_symbols->config_GetIntVariable
# define config_PutIntVariable p_symbols->config_PutIntVariable # define config_PutIntVariable p_symbols->config_PutIntVariable
# define config_GetPszVariable p_symbols->config_GetPszVariable # define config_GetPszVariable p_symbols->config_GetPszVariable
# define config_PutPszVariable p_symbols->config_PutPszVariable # define config_PutPszVariable p_symbols->config_PutPszVariable
# define config_Duplicate p_symbols->config_Duplicate # define config_Duplicate p_symbols->config_Duplicate
# define config_FindConfig p_symbols->config_FindConfig # define config_FindConfig p_symbols->config_FindConfig
# define config_LoadConfigFile p_symbols->config_LoadConfigFile
# define config_SaveConfigFile p_symbols->config_SaveConfigFile
#endif #endif
/***************************************************************************** /*****************************************************************************
......
...@@ -121,6 +121,12 @@ ...@@ -121,6 +121,12 @@
/* Define if you have the sigrelse function. */ /* Define if you have the sigrelse function. */
#undef HAVE_SIGRELSE #undef HAVE_SIGRELSE
/* Define if you have the getpwuid_r function. */
#undef HAVE_GETPWUID_R
/* Define if you have the getpwuid function. */
#undef HAVE_GETPWUID
/* Define if you have the stpcpy function. */ /* Define if you have the stpcpy function. */
#undef HAVE_STPCPY #undef HAVE_STPCPY
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* Declaration and extern access to global program object. * Declaration and extern access to global program object.
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: main.h,v 1.31 2002/03/12 18:37:46 stef Exp $ * $Id: main.h,v 1.32 2002/03/16 01:40:58 gbazin Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* *
...@@ -63,6 +63,9 @@ typedef struct main_s ...@@ -63,6 +63,9 @@ typedef struct main_s
p_playlist_t p_playlist; /* playlist */ p_playlist_t p_playlist; /* playlist */
p_intf_msg_t p_msg; /* messages interface data */ p_intf_msg_t p_msg; /* messages interface data */
p_input_channel_t p_channel; /* channel library data */ p_input_channel_t p_channel; /* channel library data */
/* Locks */
vlc_mutex_t config_lock; /* lock for the config file */
} main_t; } main_t;
#ifndef PLUGIN #ifndef PLUGIN
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* gtk_preferences.c: functions to handle the preferences dialog box. * gtk_preferences.c: functions to handle the preferences dialog box.
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2000, 2001 VideoLAN
* $Id: gtk_preferences.c,v 1.13 2002/03/11 20:14:16 gbazin Exp $ * $Id: gtk_preferences.c,v 1.14 2002/03/16 01:40:58 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -55,6 +55,7 @@ static void GtkCreateConfigDialog( char *, intf_thread_t * ); ...@@ -55,6 +55,7 @@ static void GtkCreateConfigDialog( char *, intf_thread_t * );
static void GtkConfigOk ( GtkButton *, gpointer ); static void GtkConfigOk ( GtkButton *, gpointer );
static void GtkConfigApply ( GtkButton *, gpointer ); static void GtkConfigApply ( GtkButton *, gpointer );
static void GtkConfigCancel ( GtkButton *, gpointer ); static void GtkConfigCancel ( GtkButton *, gpointer );
static void GtkConfigSave ( GtkButton *, gpointer );
static void GtkConfigDialogDestroyed ( GtkObject *, gpointer ); static void GtkConfigDialogDestroyed ( GtkObject *, gpointer );
...@@ -102,6 +103,7 @@ static void GtkCreateConfigDialog( char *psz_module_name, ...@@ -102,6 +103,7 @@ static void GtkCreateConfigDialog( char *psz_module_name,
GtkWidget *dialog_action_area; GtkWidget *dialog_action_area;
GtkWidget *ok_button; GtkWidget *ok_button;
GtkWidget *apply_button; GtkWidget *apply_button;
GtkWidget *save_button;
GtkWidget *cancel_button; GtkWidget *cancel_button;
GtkWidget *item_frame; GtkWidget *item_frame;
...@@ -483,6 +485,11 @@ static void GtkCreateConfigDialog( char *psz_module_name, ...@@ -483,6 +485,11 @@ static void GtkCreateConfigDialog( char *psz_module_name,
gtk_box_pack_start( GTK_BOX(dialog_action_area), apply_button, gtk_box_pack_start( GTK_BOX(dialog_action_area), apply_button,
TRUE, TRUE, 0 ); TRUE, TRUE, 0 );
save_button = gtk_button_new_with_label( _("Save") );
gtk_widget_show( save_button );
gtk_box_pack_start( GTK_BOX(dialog_action_area), save_button,
TRUE, TRUE, 0 );
cancel_button = gtk_button_new_with_label( _("Cancel") ); cancel_button = gtk_button_new_with_label( _("Cancel") );
gtk_widget_show( cancel_button ); gtk_widget_show( cancel_button );
gtk_box_pack_start( GTK_BOX(dialog_action_area), cancel_button, gtk_box_pack_start( GTK_BOX(dialog_action_area), cancel_button,
...@@ -494,6 +501,9 @@ static void GtkCreateConfigDialog( char *psz_module_name, ...@@ -494,6 +501,9 @@ static void GtkCreateConfigDialog( char *psz_module_name,
gtk_signal_connect( GTK_OBJECT(apply_button), "clicked", gtk_signal_connect( GTK_OBJECT(apply_button), "clicked",
GTK_SIGNAL_FUNC(GtkConfigApply), GTK_SIGNAL_FUNC(GtkConfigApply),
config_dialog ); config_dialog );
gtk_signal_connect( GTK_OBJECT(save_button), "clicked",
GTK_SIGNAL_FUNC(GtkConfigSave),
config_dialog );
gtk_signal_connect( GTK_OBJECT(cancel_button), "clicked", gtk_signal_connect( GTK_OBJECT(cancel_button), "clicked",
GTK_SIGNAL_FUNC(GtkConfigCancel), GTK_SIGNAL_FUNC(GtkConfigCancel),
config_dialog ); config_dialog );
...@@ -522,7 +532,6 @@ void GtkConfigApply( GtkButton * button, gpointer user_data ) ...@@ -522,7 +532,6 @@ void GtkConfigApply( GtkButton * button, gpointer user_data )
hash_table = (GHashTable *)gtk_object_get_data( GTK_OBJECT(user_data), hash_table = (GHashTable *)gtk_object_get_data( GTK_OBJECT(user_data),
"config_hash_table" ); "config_hash_table" );
g_hash_table_foreach( hash_table, GtkSaveHashValue, NULL ); g_hash_table_foreach( hash_table, GtkSaveHashValue, NULL );
} }
void GtkConfigOk( GtkButton * button, gpointer user_data ) void GtkConfigOk( GtkButton * button, gpointer user_data )
...@@ -531,12 +540,17 @@ void GtkConfigOk( GtkButton * button, gpointer user_data ) ...@@ -531,12 +540,17 @@ void GtkConfigOk( GtkButton * button, gpointer user_data )
gtk_widget_hide( gtk_widget_get_toplevel( GTK_WIDGET (button) ) ); gtk_widget_hide( gtk_widget_get_toplevel( GTK_WIDGET (button) ) );
} }
void GtkConfigCancel( GtkButton * button, gpointer user_data ) void GtkConfigCancel( GtkButton * button, gpointer user_data )
{ {
gtk_widget_hide( gtk_widget_get_toplevel( GTK_WIDGET (button) ) ); gtk_widget_hide( gtk_widget_get_toplevel( GTK_WIDGET (button) ) );
} }
void GtkConfigSave( GtkButton * button, gpointer user_data )
{
GtkConfigApply( button, user_data );
config_SaveConfigFile( NULL );
}
/**************************************************************************** /****************************************************************************
* GtkPluginHighlighted: display plugin description when an entry is selected * GtkPluginHighlighted: display plugin description when an entry is selected
* in the clist, and activate the configure button if necessary. * in the clist, and activate the configure button if necessary.
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* and spawn threads. * and spawn threads.
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * Copyright (C) 1998-2001 VideoLAN
* $Id: main.c,v 1.163 2002/03/12 18:37:46 stef Exp $ * $Id: main.c,v 1.164 2002/03/16 01:40:58 gbazin Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -401,7 +401,6 @@ vout_bank_t *p_vout_bank; ...@@ -401,7 +401,6 @@ vout_bank_t *p_vout_bank;
/***************************************************************************** /*****************************************************************************
* Local prototypes * Local prototypes
*****************************************************************************/ *****************************************************************************/
static int GetConfigurationFromFile ( void ){return 0;};
static int GetConfigurationFromCmdLine ( int *pi_argc, char *ppsz_argv[], static int GetConfigurationFromCmdLine ( int *pi_argc, char *ppsz_argv[],
boolean_t b_ignore_errors ); boolean_t b_ignore_errors );
static int GetFilenames ( int i_argc, char *ppsz_argv[] ); static int GetFilenames ( int i_argc, char *ppsz_argv[] );
...@@ -604,11 +603,8 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] ) ...@@ -604,11 +603,8 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
/* /*
* Override default configuration with config file settings * Override default configuration with config file settings
*/ */
if( GetConfigurationFromFile() ) vlc_mutex_init( &p_main->config_lock );
{ config_LoadConfigFile( NULL );
intf_MsgDestroy();
return( errno );
}
/* /*
* Override configuration with command line settings * Override configuration with command line settings
...@@ -619,6 +615,7 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] ) ...@@ -619,6 +615,7 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
return( errno ); return( errno );
} }
/* p_main inititalization. FIXME ? */ /* p_main inititalization. FIXME ? */
p_main->i_desync = (mtime_t)config_GetIntVariable( "desync" ) p_main->i_desync = (mtime_t)config_GetIntVariable( "desync" )
* (mtime_t)1000; * (mtime_t)1000;
......
This diff is collapsed.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* modules_plugin.h : Plugin management functions used by the core application. * modules_plugin.h : Plugin management functions used by the core application.
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: modules_plugin.h,v 1.15 2002/03/11 07:23:10 gbazin Exp $ * $Id: modules_plugin.h,v 1.16 2002/03/16 01:40:58 gbazin Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -162,6 +162,8 @@ module_error( void ) ...@@ -162,6 +162,8 @@ module_error( void )
(p_symbols)->config_GetPszVariable = config_GetPszVariable; \ (p_symbols)->config_GetPszVariable = config_GetPszVariable; \
(p_symbols)->config_PutIntVariable = config_PutIntVariable; \ (p_symbols)->config_PutIntVariable = config_PutIntVariable; \
(p_symbols)->config_PutPszVariable = config_PutPszVariable; \ (p_symbols)->config_PutPszVariable = config_PutPszVariable; \
(p_symbols)->config_LoadConfigFile = config_LoadConfigFile; \
(p_symbols)->config_SaveConfigFile = config_SaveConfigFile; \
(p_symbols)->config_Duplicate = config_Duplicate; \ (p_symbols)->config_Duplicate = config_Duplicate; \
(p_symbols)->config_FindConfig = config_FindConfig; \ (p_symbols)->config_FindConfig = config_FindConfig; \
(p_symbols)->intf_MsgSub = intf_MsgSub; \ (p_symbols)->intf_MsgSub = intf_MsgSub; \
......
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