Finally fix boolean up properly - phew

SVN revision: 11773
This commit is contained in:
handyande 2004-10-06 20:32:47 +00:00 committed by handyande
parent 8f0ab07a61
commit 202f1ba109
2 changed files with 23 additions and 12 deletions

View File

@ -487,12 +487,12 @@ ecore_config_typed_val(Ecore_Config_Prop * e, void *val, int type)
e->val = (long)*i; e->val = (long)*i;
e->type = PT_INT; e->type = PT_INT;
} }
else if (type == PT_BLN ) else if (type == PT_BLN )
{ {
i = (int *)val; i = (int *)val;
e->val = (long)*i; e->val = (long)*i;
e->type = PT_BLN; e->type = PT_BLN;
} }
else if (type == PT_STR || type == PT_THM) else if (type == PT_STR || type == PT_THM)
{ {
if (!(e->ptr = strdup(val))) if (!(e->ptr = strdup(val)))
@ -716,7 +716,7 @@ ecore_config_set(const char *key, char *val)
float tmpf; float tmpf;
type = ecore_config_type_guess(key, val); type = ecore_config_type_guess(key, val);
if (type == PT_INT) if (type == PT_INT || type == PT_BLN)
{ {
tmpi = atoi(val); tmpi = atoi(val);
return ecore_config_typed_set(key, (void *)&tmpi, type); return ecore_config_typed_set(key, (void *)&tmpi, type);

View File

@ -59,7 +59,7 @@ ecore_config_file_load(char *file)
E_DB_File *db; E_DB_File *db;
char **keys; char **keys;
int key_count; int key_count;
int x; int x, pt;
int itmp; int itmp;
float ftmp; float ftmp;
char *type; char *type;
@ -88,7 +88,16 @@ ecore_config_file_load(char *file)
{ {
if (e_db_int_get(db, keys[x], &itmp)) if (e_db_int_get(db, keys[x], &itmp))
{ {
ecore_config_int_set(keys[x], itmp); pt = ecore_config_type_guess(keys[x], itmp);
switch (pt)
{
case PT_BLN:
ecore_config_boolean_set(keys[x], itmp);
break;
default:
ecore_config_int_set(keys[x], itmp);
break;
}
} }
else else
{ {
@ -111,8 +120,8 @@ ecore_config_file_load(char *file)
data = e_db_str_get(db, keys[x]); data = e_db_str_get(db, keys[x]);
if (data) if (data)
{ {
itmp = ecore_config_type_guess(keys[x], data); pt = ecore_config_type_guess(keys[x], data);
switch (itmp) switch (pt)
{ {
case PT_RGB: case PT_RGB:
ecore_config_argb_set(keys[x], data); ecore_config_argb_set(keys[x], data);
@ -208,9 +217,11 @@ ecore_config_file_save(char *file)
switch (next->type) switch (next->type)
{ {
case PT_INT: case PT_INT:
case PT_BLN:
e_db_int_set(db, next->key, ecore_config_int_get(next->key)); e_db_int_set(db, next->key, ecore_config_int_get(next->key));
break; break;
case PT_BLN:
e_db_int_set(db, next->key, ecore_config_boolean_get(next->key));
break;
case PT_FLT: case PT_FLT:
e_db_float_set(db, next->key, ecore_config_float_get(next->key)); e_db_float_set(db, next->key, ecore_config_float_get(next->key));
break; break;