Search
lxdream.org :: lxdream/src/config.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/config.c
changeset 460:a0c865b74c63
prev458:cbb2dd12daeb
next464:8e099fad42a6
author nkeynes
date Tue Oct 23 10:47:17 2007 +0000 (13 years ago)
permissions -rw-r--r--
last change Make controller config actually work
file annotate diff log raw
1.1 --- a/src/config.c Mon Oct 22 21:12:54 2007 +0000
1.2 +++ b/src/config.c Tue Oct 23 10:47:17 2007 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: config.c,v 1.2 2007-10-22 21:12:54 nkeynes Exp $
1.6 + * $Id: config.c,v 1.3 2007-10-23 10:47:17 nkeynes Exp $
1.7 *
1.8 * User configuration support
1.9 *
1.10 @@ -108,31 +108,39 @@
1.11 return global_config[key].value;
1.12 }
1.13
1.14 -void lxdream_set_config_value( int key, const gchar *value )
1.15 +void lxdream_set_config_value( lxdream_config_entry_t param, const gchar *value )
1.16 {
1.17 - struct lxdream_config_entry *param = &global_config[key];
1.18 if( param->value != param->default_value && param->value != NULL ) {
1.19 free( param->value );
1.20 }
1.21 param->value = g_strdup(value);
1.22 }
1.23
1.24 +void lxdream_set_global_config_value( int key, const gchar *value )
1.25 +{
1.26 + lxdream_set_config_value(&global_config[key], value);
1.27 +}
1.28 +
1.29 gboolean lxdream_set_group_value( lxdream_config_group_t group, const gchar *key, const gchar *value )
1.30 {
1.31 int i;
1.32 for( i=0; group->params[i].key != NULL; i++ ) {
1.33 if( strcasecmp( group->params[i].key, key ) == 0 ) {
1.34 - if( group->params[i].value != group->params[i].default_value &&
1.35 - group->params[i].value != NULL ) {
1.36 - free( group->params[i].value );
1.37 - }
1.38 - group->params[i].value = g_strdup( value );
1.39 + lxdream_set_config_value( &group->params[i], value );
1.40 return TRUE;
1.41 }
1.42 }
1.43 return FALSE;
1.44 }
1.45
1.46 +void lxdream_copy_config_list( lxdream_config_entry_t dest, lxdream_config_entry_t src )
1.47 +{
1.48 + int i;
1.49 + for( i=0; src[i].key != NULL; i++ ) {
1.50 + lxdream_set_config_value( &dest[i], src[i].value );
1.51 + }
1.52 +}
1.53 +
1.54 gboolean lxdream_load_config( )
1.55 {
1.56 if( lxdream_config_load_filename == NULL ) {
.