Mercurial > mplayer.hg
changeset 8168:ff6a98628e6c
Fix the Gui with NEW_CONFIG
author | albeu |
---|---|
date | Tue, 12 Nov 2002 12:39:05 +0000 |
parents | e8832e66babd |
children | 7c9253521f9c |
files | Gui/cfg.c m_config.h m_option.c m_option.h |
diffstat | 4 files changed, 36 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/Gui/cfg.c Tue Nov 12 12:33:56 2002 +0000 +++ b/Gui/cfg.c Tue Nov 12 12:39:05 2002 +0000 @@ -156,7 +156,11 @@ // -- read configuration mp_msg( MSGT_GPLAYER,MSGL_STATUS,"[cfg] read config file: %s\n",cfg ); - gui_conf=m_config_new( play_tree_new() ); + gui_conf=m_config_new( +#ifndef NEW_CONFIG + play_tree_new() +#endif + ); m_config_register_options( gui_conf,gui_opts ); if ( m_config_parse_config_file( gui_conf,cfg ) < 0 ) { @@ -221,6 +225,14 @@ { for ( i=0;gui_opts[i].name;i++ ) { +#ifdef NEW_CONFIG + char* v = m_option_print(&gui_opts[i],gui_opts[i].p); + if(v) { + fprintf( f,"%s = \"%s\"\n",gui_opts[i].name, v); + free(v); + } else if((int)v == -1) + mp_msg(MSGT_GPLAYER,MSGL_WARN,"Unable to save the %s option\n"); +#else switch ( gui_opts[i].type ) { case CONF_TYPE_INT: @@ -239,6 +251,7 @@ break; } } +#endif } fclose( f ); }
--- a/m_config.h Tue Nov 12 12:33:56 2002 +0000 +++ b/m_config.h Tue Nov 12 12:39:05 2002 +0000 @@ -55,6 +55,9 @@ struct m_option* m_config_get_option(m_config_t *config, char* arg); +void +m_config_print_option_list(m_config_t *config); + ///////////////////////////////////////////////////////////////////////////////////// /////////////////////////// Backward compat. stuff //////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////
--- a/m_option.c Tue Nov 12 12:33:56 2002 +0000 +++ b/m_option.c Tue Nov 12 12:39:05 2002 +0000 @@ -315,7 +315,7 @@ } static char* print_str(m_option_t* opt, void* val) { - return (val && VAL(val) && strlen(VAL(val)) > 0) ? strdup(VAL(val)) : strdup("(empty)"); + return (val && VAL(val) && strlen(VAL(val)) > 0) ? strdup(VAL(val)) : NULL; } static void copy_str(m_option_t* opt,void* dst, void* src) { @@ -559,7 +559,23 @@ } static char* print_str_list(m_option_t* opt, void* src) { - return strdup("TODO ;)"); + char **lst = NULL; + char *ret = NULL,*last = NULL; + int i; + + if(!(src && VAL(src))) return NULL; + lst = VAL(src); + + for(i = 0 ; lst[i] ; i++) { + if(last) { + ret = dup_printf("%s,%s",last,lst[i]); + free(last); + } else + ret = strdup(lst[i]); + last = ret; + } + if(last && last != ret) free(last); + return ret; } m_option_type_t m_option_type_string_list = {