Search
lxdream.org :: lxdream :: r458:cbb2dd12daeb
lxdream 0.9.1
released Jun 29
Download Now
changeset458:cbb2dd12daeb
parent457:af605fd32c0b
child459:21041c9634e4
authornkeynes
dateMon Oct 22 21:12:54 2007 +0000 (12 years ago)
Add set value by name method
src/config.c
src/config.h
1.1 --- a/src/config.c Sun Oct 21 11:38:02 2007 +0000
1.2 +++ b/src/config.c Mon Oct 22 21:12:54 2007 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: config.c,v 1.1 2007-10-17 11:26:45 nkeynes Exp $
1.6 + * $Id: config.c,v 1.2 2007-10-22 21:12:54 nkeynes Exp $
1.7 *
1.8 * User configuration support
1.9 *
1.10 @@ -117,6 +117,22 @@
1.11 param->value = g_strdup(value);
1.12 }
1.13
1.14 +gboolean lxdream_set_group_value( lxdream_config_group_t group, const gchar *key, const gchar *value )
1.15 +{
1.16 + int i;
1.17 + for( i=0; group->params[i].key != NULL; i++ ) {
1.18 + if( strcasecmp( group->params[i].key, key ) == 0 ) {
1.19 + if( group->params[i].value != group->params[i].default_value &&
1.20 + group->params[i].value != NULL ) {
1.21 + free( group->params[i].value );
1.22 + }
1.23 + group->params[i].value = g_strdup( value );
1.24 + return TRUE;
1.25 + }
1.26 + }
1.27 + return FALSE;
1.28 +}
1.29 +
1.30 gboolean lxdream_load_config( )
1.31 {
1.32 if( lxdream_config_load_filename == NULL ) {
2.1 --- a/src/config.h Sun Oct 21 11:38:02 2007 +0000
2.2 +++ b/src/config.h Mon Oct 22 21:12:54 2007 +0000
2.3 @@ -1,5 +1,5 @@
2.4 /**
2.5 - * $Id: config.h,v 1.1 2007-10-17 11:26:45 nkeynes Exp $
2.6 + * $Id: config.h,v 1.2 2007-10-22 21:12:54 nkeynes Exp $
2.7 *
2.8 * User configuration support
2.9 *
2.10 @@ -52,7 +52,7 @@
2.11 const gchar *lxdream_get_config_value( int key );
2.12
2.13 void lxdream_set_config_value( int key, const gchar *value );
2.14 -
2.15 +gboolean lxdream_set_group_value( lxdream_config_group_t group, const gchar *key, const gchar *value );
2.16 /**
2.17 * Search the standard locations for the configuration file:
2.18 * $HOME/.lxdreamrc
.