WARNING: API CHANGE. Ecore_Config should now be Ecore compliant, there you go Raster ;)

SVN revision: 10126
This commit is contained in:
handyande 2004-05-08 14:51:05 +00:00 committed by handyande
parent 093bd1d9c2
commit 8db5850a36
7 changed files with 196 additions and 196 deletions

View File

@ -18,11 +18,11 @@ char *rgb_val;
char *thm_val;
void set_defaults (void) {
ecore_config_default_int(INT_VAL_KEY, 0);
ecore_config_default_float(FLT_VAL_KEY, 0.0);
ecore_config_default_string(STR_VAL_KEY, "test1");
ecore_config_default_rgb(RGB_VAL_KEY, "#000000");
ecore_config_default_theme(THM_VAL_KEY, "default");
ecore_config_int_default(INT_VAL_KEY, 0);
ecore_config_float_default(FLT_VAL_KEY, 0.0);
ecore_config_string_default(STR_VAL_KEY, "test1");
ecore_config_rgb_default(RGB_VAL_KEY, "#000000");
ecore_config_theme_default(THM_VAL_KEY, "default");
}
void get_settings (void) {
@ -31,11 +31,11 @@ void get_settings (void) {
*/
set_defaults();
ecore_config_load();
int_val = ecore_config_get_int(INT_VAL_KEY);
flt_val = ecore_config_get_float(FLT_VAL_KEY);
str_val = ecore_config_get_string(STR_VAL_KEY);
rgb_val = ecore_config_get_rgbstr(RGB_VAL_KEY);
thm_val = ecore_config_get_theme(THM_VAL_KEY);
int_val = ecore_config_int_get(INT_VAL_KEY);
flt_val = ecore_config_float_get(FLT_VAL_KEY);
str_val = ecore_config_string_get(STR_VAL_KEY);
rgb_val = ecore_config_rgbstr_get(RGB_VAL_KEY);
thm_val = ecore_config_theme_get(THM_VAL_KEY);
}
void change_settings(void) {
@ -63,11 +63,11 @@ void change_settings(void) {
}
void save_settings (void) {
ecore_config_set_int(INT_VAL_KEY, int_val);
ecore_config_set_float(FLT_VAL_KEY, flt_val);
ecore_config_set_string(STR_VAL_KEY, str_val);
ecore_config_set_rgb(RGB_VAL_KEY, rgb_val);
ecore_config_set_theme(THM_VAL_KEY, thm_val);
ecore_config_int_set(INT_VAL_KEY, int_val);
ecore_config_float_set(FLT_VAL_KEY, flt_val);
ecore_config_string_set(STR_VAL_KEY, str_val);
ecore_config_rgb_set(RGB_VAL_KEY, rgb_val);
ecore_config_theme_set(THM_VAL_KEY, thm_val);
ecore_config_save();
}

View File

@ -81,8 +81,8 @@ typedef struct Ecore_Config_Prop
{
char *key; ///< Property key.
char *description; ///< Description set by ecore_config_descibe.
char short_opt;
char *long_opt;
char short_opt; ///< short identifier on command line (-f)
char *long_opt; ///< long identifier on command line (--foo)
char *ptr; ///< Used as the value when the property is a string or theme.
Ecore_Config_Type type; ///< Property type.
long val; ///< Used as the value when the property is an integer, float or colour.
@ -130,47 +130,47 @@ extern "C"
extern char *__ecore_config_app_name;
Ecore_Config_Prop *ecore_config_get(const char *key);
const char *ecore_config_get_type(const Ecore_Config_Prop * e);
void *ecore_config_get_data(const char *key);
char *ecore_config_get_string(const char *key);
long ecore_config_get_int(const char *key);
int ecore_config_get_rgb(const char *key, int *r, int *g,
const char *ecore_config_type_get(const Ecore_Config_Prop * e);
void *ecore_config_data_get(const char *key);
char *ecore_config_string_get(const char *key);
long ecore_config_int_get(const char *key);
int ecore_config_rgb_get(const char *key, int *r, int *g,
int *b);
float ecore_config_get_float(const char *key);
char *ecore_config_get_theme(const char *key);
char *ecore_config_get_as_string(const char *key);
char *ecore_config_rgbstr_get(const char *key);
float ecore_config_float_get(const char *key);
char *ecore_config_theme_get(const char *key);
char *ecore_config_as_string_get(const char *key);
int ecore_config_describe(const char *key, char *desc);
int ecore_config_set_short_opt(const char *key,
int ecore_config_short_opt_set(const char *key,
char short_opt);
int ecore_config_set_long_opt(const char *key,
int ecore_config_long_opt_set(const char *key,
char *long_opt);
int ecore_config_set(const char *key, char *val);
int ecore_config_set_typed(const char *key, void *val,
int ecore_config_typed_set(const char *key, void *val,
int type);
int ecore_config_set_string(const char *key, char *val);
int ecore_config_set_int(const char *key, int val);
int ecore_config_set_rgb(const char *key, char *val);
char *ecore_config_get_rgbstr(const char *key);
int ecore_config_set_float(const char *key, float val);
int ecore_config_set_theme(const char *key, char *val);
int ecore_config_set_theme_preview_group(const char *key,
int ecore_config_string_set(const char *key, char *val);
int ecore_config_int_set(const char *key, int val);
int ecore_config_rgb_set(const char *key, char *val);
int ecore_config_float_set(const char *key, float val);
int ecore_config_theme_set(const char *key, char *val);
int ecore_config_theme_preview_group_set(const char *key,
char *group);
int ecore_config_set_as_string(const char *key, char *val);
int ecore_config_as_string_set(const char *key, char *val);
int ecore_config_default(const char *key, char *val,
float lo, float hi, float step);
int ecore_config_default_typed(const char *key, void *val,
int ecore_config_typed_default(const char *key, void *val,
int type);
int ecore_config_default_int(const char *key, int val);
int ecore_config_default_int_bound(const char *key, int val,
int ecore_config_int_default(const char *key, int val);
int ecore_config_int_default_bound(const char *key, int val,
int lo, int hi, int step);
int ecore_config_default_string(const char *key, char *val);
int ecore_config_default_float(const char *key, float val);
int ecore_config_default_float_bound(const char *key,
int ecore_config_string_default(const char *key, char *val);
int ecore_config_float_default(const char *key, float val);
int ecore_config_float_default_bound(const char *key,
float val, float lo,
float hi, float step);
int ecore_config_default_rgb(const char *key, char *val);
int ecore_config_default_theme(const char *key, char *val);
int ecore_config_rgb_default(const char *key, char *val);
int ecore_config_theme_default(const char *key, char *val);
int ecore_config_listen(const char *name, const char *key,
Ecore_Config_Listener listener,
@ -178,27 +178,27 @@ extern "C"
int ecore_config_deaf(const char *name, const char *key,
Ecore_Config_Listener listener);
Ecore_Config_Prop *ecore_config_dst(Ecore_Config_Prop * e);
int ecore_config_guess_type(const char *key, char *val);
int ecore_config_type_guess(const char *key, char *val);
Ecore_Config_Bundle *ecore_config_bundle_new(Ecore_Config_Server * srv,
const char *id);
Ecore_Config_Bundle *ecore_config_bundle_get_1st(Ecore_Config_Server * srv);
Ecore_Config_Bundle *ecore_config_bundle_get_next(Ecore_Config_Bundle * ns);
Ecore_Config_Bundle *ecore_config_bundle_get_by_serial(Ecore_Config_Server *
Ecore_Config_Bundle *ecore_config_bundle_1st_get(Ecore_Config_Server * srv);
Ecore_Config_Bundle *ecore_config_bundle_next_get(Ecore_Config_Bundle * ns);
Ecore_Config_Bundle *ecore_config_bundle_by_serial_get(Ecore_Config_Server *
srv, long serial);
Ecore_Config_Bundle *ecore_config_bundle_get_by_label(Ecore_Config_Server *
Ecore_Config_Bundle *ecore_config_bundle_by_label_get(Ecore_Config_Server *
srv,
const char *label);
long ecore_config_bundle_get_serial(Ecore_Config_Bundle * ns);
char *ecore_config_bundle_get_label(Ecore_Config_Bundle * ns);
long ecore_config_bundle_serial_get(Ecore_Config_Bundle * ns);
char *ecore_config_bundle_label_get(Ecore_Config_Bundle * ns);
int ecore_config_init(char *name);
int ecore_config_shutdown(void);
int ecore_config_load(void);
int ecore_config_load_file(char *file);
int ecore_config_file_load(char *file);
int ecore_config_save(void);
int ecore_config_save_file(char *file);
int ecore_config_file_save(char *file);
/* error codes */
# define ECORE_CONFIG_ERR_NOTSUPP (-16)
@ -219,9 +219,9 @@ extern "C"
# define ECORE_CONFIG_ERR_FAIL (-1) ///< Failure result.
# define ECORE_CONFIG_ERR_SUCC (0) ///< Success result.
# define ECORE_CONFIG_PARSE_HELP (-2)
# define ECORE_CONFIG_PARSE_EXIT (-1)
# define ECORE_CONFIG_PARSE_CONTINUE (0)
# define ECORE_CONFIG_PARSE_HELP (-2) ///< Help was displayed
# define ECORE_CONFIG_PARSE_EXIT (-1) ///< An error occurred
# define ECORE_CONFIG_PARSE_CONTINUE (0) ///< Arguments parsed successfully
/* convenience mathods in convenience.c */
int ecore_config_evas_font_path_apply(Evas * evas);
@ -232,33 +232,33 @@ extern "C"
int ecore_config_create(const char *key, void *val,
char short_opt, char *long_opt,
char *desc);
int ecore_config_create_typed(const char *key, void *val,
int ecore_config_typed_create(const char *key, void *val,
int type, char short_opt,
char *long_opt, char *desc);
int ecore_config_create_int(const char *key, int val,
int ecore_config_int_create(const char *key, int val,
char short_opt, char *long_opt,
char *desc);
int ecore_config_create_int_bound(const char *key, int val,
int ecore_config_int_create_bound(const char *key, int val,
int low, int high,
int step, char short_opt,
char *long_opt,
char *desc);
int ecore_config_create_string(const char *key, char *val,
int ecore_config_string_create(const char *key, char *val,
char short_opt,
char *long_opt, char *desc);
int ecore_config_create_float(const char *key, float val,
int ecore_config_float_create(const char *key, float val,
char short_opt, char *long_opt,
char *desc);
int ecore_config_create_float_bound(const char *key,
int ecore_config_float_create_bound(const char *key,
float val, float low,
float high, float step,
char short_opt,
char *long_opt,
char *desc);
int ecore_config_create_rgb(const char *key, char *val,
int ecore_config_rgb_create(const char *key, char *val,
char short_opt, char *long_opt,
char *desc);
int ecore_config_create_theme(const char *key, char *val,
int ecore_config_theme_create(const char *key, char *val,
char short_opt, char *long_opt,
char *desc);

View File

@ -14,41 +14,41 @@ int
ecore_config_create(const char *key, void *val, char short_opt, char *long_opt,
char *desc)
{
int type = ecore_config_guess_type(key, val);
int type = ecore_config_type_guess(key, val);
return ecore_config_create_typed(key, val, type, short_opt, long_opt, desc);
return ecore_config_typed_create(key, val, type, short_opt, long_opt, desc);
}
int
ecore_config_create_typed(const char *key, void *val, int type, char short_opt,
ecore_config_typed_create(const char *key, void *val, int type, char short_opt,
char *long_opt, char *desc)
{
int ret;
if ((ret =
ecore_config_default_typed(key, val, type)) != ECORE_CONFIG_ERR_SUCC)
ecore_config_typed_default(key, val, type)) != ECORE_CONFIG_ERR_SUCC)
return ret;
if ((ret =
ecore_config_set_short_opt(key, short_opt)) != ECORE_CONFIG_ERR_SUCC)
ecore_config_short_opt_set(key, short_opt)) != ECORE_CONFIG_ERR_SUCC)
return ret;
if ((ret =
ecore_config_set_long_opt(key, long_opt)) != ECORE_CONFIG_ERR_SUCC)
ecore_config_long_opt_set(key, long_opt)) != ECORE_CONFIG_ERR_SUCC)
return ret;
ret = ecore_config_describe(key, desc);
return ret;
}
int
ecore_config_create_int(const char *key, int val, char short_opt,
ecore_config_int_create(const char *key, int val, char short_opt,
char *long_opt, char *desc)
{
return
ecore_config_create_typed(key, (void *)&val, PT_INT, short_opt, long_opt,
ecore_config_typed_create(key, (void *)&val, PT_INT, short_opt, long_opt,
desc);
}
int
ecore_config_create_int_bound(const char *key, int val, int low, int high,
ecore_config_int_create_bound(const char *key, int val, int low, int high,
int step, char short_opt, char *long_opt,
char *desc)
{
@ -56,7 +56,7 @@ ecore_config_create_int_bound(const char *key, int val, int low, int high,
int ret;
ret =
ecore_config_create_typed(key, (void *)&val, PT_INT, short_opt, long_opt,
ecore_config_typed_create(key, (void *)&val, PT_INT, short_opt, long_opt,
desc);
if (ret != ECORE_CONFIG_ERR_SUCC)
return ret;
@ -73,25 +73,25 @@ ecore_config_create_int_bound(const char *key, int val, int low, int high,
}
int
ecore_config_create_string(const char *key, char *val, char short_opt,
ecore_config_string_create(const char *key, char *val, char short_opt,
char *long_opt, char *desc)
{
return
ecore_config_create_typed(key, (void *)val, PT_STR, short_opt, long_opt,
ecore_config_typed_create(key, (void *)val, PT_STR, short_opt, long_opt,
desc);
}
int
ecore_config_create_float(const char *key, float val, char short_opt,
ecore_config_float_create(const char *key, float val, char short_opt,
char *long_opt, char *desc)
{
return
ecore_config_create_typed(key, (void *)&val, PT_FLT, short_opt, long_opt,
ecore_config_typed_create(key, (void *)&val, PT_FLT, short_opt, long_opt,
desc);
}
int
ecore_config_create_float_bound(const char *key, float val, float low,
ecore_config_float_create_bound(const char *key, float val, float low,
float high, float step, char short_opt,
char *long_opt, char *desc)
{
@ -99,7 +99,7 @@ ecore_config_create_float_bound(const char *key, float val, float low,
int ret;
ret =
ecore_config_create_typed(key, (void *)&val, PT_FLT, short_opt, long_opt,
ecore_config_typed_create(key, (void *)&val, PT_FLT, short_opt, long_opt,
desc);
e = ecore_config_get(key);
if (e)
@ -114,20 +114,20 @@ ecore_config_create_float_bound(const char *key, float val, float low,
}
int
ecore_config_create_rgb(const char *key, char *val, char short_opt,
ecore_config_rgb_create(const char *key, char *val, char short_opt,
char *long_opt, char *desc)
{
return
ecore_config_create_typed(key, (void *)val, PT_RGB, short_opt, long_opt,
ecore_config_typed_create(key, (void *)val, PT_RGB, short_opt, long_opt,
desc);
}
int
ecore_config_create_theme(const char *key, char *val, char short_opt,
ecore_config_theme_create(const char *key, char *val, char short_opt,
char *long_opt, char *desc)
{
return
ecore_config_create_typed(key, (void *)val, PT_THM, short_opt, long_opt,
ecore_config_typed_create(key, (void *)val, PT_THM, short_opt, long_opt,
desc);
}
@ -145,7 +145,7 @@ ecore_config_evas_font_path_apply(Evas * evas)
{
char *font_path, *font_path_tmp, *ptr, *end;
font_path = ecore_config_get_string("/e/font/path");
font_path = ecore_config_string_get("/e/font/path");
if (!font_path)
return ECORE_CONFIG_ERR_NODATA;

View File

@ -110,7 +110,7 @@ ecore_config_get(const char *key)
* string "not found" is returned.
*/
const char *
ecore_config_get_type(const Ecore_Config_Prop * e)
ecore_config_type_get(const Ecore_Config_Prop * e)
{
if (e)
{
@ -125,7 +125,7 @@ ecore_config_get_type(const Ecore_Config_Prop * e)
* @return Data pointer used by the property.
*/
void *
ecore_config_get_data(const char *key)
ecore_config_data_get(const char *key)
{
Ecore_Config_Prop *e;
@ -141,7 +141,7 @@ ecore_config_get_data(const char *key)
* property is not a string or is not set.
*/
char *
ecore_config_get_string(const char *key)
ecore_config_string_get(const char *key)
{
Ecore_Config_Prop *e;
@ -156,7 +156,7 @@ ecore_config_get_string(const char *key)
* property is not an integer or is not set.
*/
long
ecore_config_get_int(const char *key)
ecore_config_int_get(const char *key)
{
Ecore_Config_Prop *e;
@ -171,7 +171,7 @@ ecore_config_get_int(const char *key)
* property is not a float or is not set.
*/
float
ecore_config_get_float(const char *key)
ecore_config_float_get(const char *key)
{
Ecore_Config_Prop *e;
@ -191,7 +191,7 @@ ecore_config_get_float(const char *key)
* otherwise.
*/
int
ecore_config_get_rgb(const char *key, int *r, int *g, int *b)
ecore_config_rgb_get(const char *key, int *r, int *g, int *b)
{
Ecore_Config_Prop *e;
@ -213,12 +213,12 @@ ecore_config_get_rgb(const char *key, int *r, int *g, int *b)
* @return A string of hexadecimal characters in the format #rrggbb.
*/
char *
ecore_config_get_rgbstr(const char *key)
ecore_config_rgbstr_get(const char *key)
{
char *r;
r = NULL;
esprintf(&r, "#%06x", ecore_config_get_int(key));
esprintf(&r, "#%06x", ecore_config_int_get(key));
return r;
}
@ -229,7 +229,7 @@ ecore_config_get_rgbstr(const char *key)
* NULL if the property is not a theme or is not set.
*/
char *
ecore_config_get_theme(const char *key)
ecore_config_theme_get(const char *key)
{
Ecore_Config_Prop *e;
@ -244,7 +244,7 @@ ecore_config_get_theme(const char *key)
* returned if the property does not exist.
*/
char *
ecore_config_get_as_string(const char *key)
ecore_config_as_string_get(const char *key)
{
Ecore_Config_Prop *e;
char *r;
@ -254,7 +254,7 @@ ecore_config_get_as_string(const char *key)
E(0, "no such property, \"%s\"...\n", key);
else
{
const char *type = ecore_config_get_type(e);
const char *type = ecore_config_type_get(e);
switch (e->type)
{
@ -262,21 +262,21 @@ ecore_config_get_as_string(const char *key)
esprintf(&r, "%s:%s=<nil>", key, type);
break;
case PT_INT:
esprintf(&r, "%s:%s=%ld", key, type, ecore_config_get_int(key));
esprintf(&r, "%s:%s=%ld", key, type, ecore_config_int_get(key));
break;
case PT_FLT:
esprintf(&r, "%s:%s=%lf", key, type, ecore_config_get_float(key));
esprintf(&r, "%s:%s=%lf", key, type, ecore_config_float_get(key));
break;
case PT_STR:
esprintf(&r, "%s:%s=\"%s\"", key, type,
ecore_config_get_string(key));
ecore_config_string_get(key));
break;
case PT_RGB:
esprintf(&r, "%s:%s=#%06x", key, type, ecore_config_get_int(key));
esprintf(&r, "%s:%s=#%06x", key, type, ecore_config_int_get(key));
break;
case PT_THM:
esprintf(&r, "%s:%s=\"%s\"", key, type,
ecore_config_get_theme(key));
ecore_config_theme_get(key));
break;
default:
esprintf(&r, "%s:unknown_type", key);
@ -354,7 +354,7 @@ ecore_config_bound(Ecore_Config_Prop * e)
* val is NULL, PT_NIL will be returned.
*/
int
ecore_config_guess_type(const char *key, char *val)
ecore_config_type_guess(const char *key, char *val)
{
Ecore_Config_Prop *p;
char *l;
@ -382,7 +382,7 @@ ecore_config_guess_type(const char *key, char *val)
}
static int
ecore_config_val_typed(Ecore_Config_Prop * e, void *val, int type)
ecore_config_typed_val(Ecore_Config_Prop * e, void *val, int type)
{
char *l;
long v;
@ -456,7 +456,7 @@ ecore_config_val_typed(Ecore_Config_Prop * e, void *val, int type)
}
static int
ecore_config_add_typed(const char *key, void *val, int type)
ecore_config_typed_add(const char *key, void *val, int type)
{
Ecore_Config_Prop *e;
Ecore_Config_Bundle *t;
@ -474,7 +474,7 @@ ecore_config_add_typed(const char *key, void *val, int type)
if (!val)
e->type = PT_NIL;
else if (ecore_config_val_typed(e, val, type) == ECORE_CONFIG_ERR_OOM)
else if (ecore_config_typed_val(e, val, type) == ECORE_CONFIG_ERR_OOM)
goto ret_free_key;
e->next = t ? t->data : NULL;
@ -496,8 +496,8 @@ ecore_config_add(const char *key, char *val)
{
int type;
type = ecore_config_guess_type(key, val);
return ecore_config_add_typed(key, val, type);
type = ecore_config_type_guess(key, val);
return ecore_config_typed_add(key, val, type);
}
/**
@ -519,7 +519,7 @@ ecore_config_describe(const char *key, char *desc)
}
int
ecore_config_set_short_opt(const char *key, char short_opt)
ecore_config_short_opt_set(const char *key, char short_opt)
{
Ecore_Config_Prop *e;
@ -530,7 +530,7 @@ ecore_config_set_short_opt(const char *key, char short_opt)
}
int
ecore_config_set_long_opt(const char *key, char *long_opt)
ecore_config_long_opt_set(const char *key, char *long_opt)
{
Ecore_Config_Prop *e;
@ -551,7 +551,7 @@ ecore_config_set_long_opt(const char *key, char *long_opt)
* @return ECORE_CONFIG_ERR_SUCC if the property is set successfully.
*/
int
ecore_config_set_typed(const char *key, void *val, int type)
ecore_config_typed_set(const char *key, void *val, int type)
{
Ecore_Config_Prop *e;
Ecore_Config_Listener_List *l;
@ -568,9 +568,9 @@ ecore_config_set_typed(const char *key, void *val, int type)
}
*/
if (!(e = ecore_config_get(key)))
return ecore_config_add_typed(key, val, type);
return ecore_config_typed_add(key, val, type);
if ((ret = ecore_config_val_typed(e, val, type)) == ECORE_CONFIG_ERR_SUCC)
if ((ret = ecore_config_typed_val(e, val, type)) == ECORE_CONFIG_ERR_SUCC)
{
for (l = e->listeners; l; l = l->next)
l->listener(e->key, e->type, l->tag, l->data);
@ -578,7 +578,7 @@ ecore_config_set_typed(const char *key, void *val, int type)
else
{
E(0,
"ecore_config_set_typed(\"%s\"): ecore_config_val_typed() failed: %d\n",
"ecore_config_typed_set(\"%s\"): ecore_config_typed_val() failed: %d\n",
key, ret);
}
@ -599,19 +599,19 @@ ecore_config_set(const char *key, char *val)
int tmpi;
float tmpf;
type = ecore_config_guess_type(key, val);
type = ecore_config_type_guess(key, val);
if (type == PT_INT)
{
tmpi = atoi(val);
return ecore_config_set_typed(key, (void *)&tmpi, type);
return ecore_config_typed_set(key, (void *)&tmpi, type);
}
else if (type == PT_FLT)
{
tmpf = atof(val);
return ecore_config_set_typed(key, (void *)&tmpf, type);
return ecore_config_typed_set(key, (void *)&tmpf, type);
}
else
return ecore_config_set_typed(key, (void *)val, type);
return ecore_config_typed_set(key, (void *)val, type);
}
/**
@ -621,7 +621,7 @@ ecore_config_set(const char *key, char *val)
* @return ECORE_CONFIG_ERR_SUCC if the property is set successfully.
*/
int
ecore_config_set_as_string(const char *key, char *val)
ecore_config_as_string_set(const char *key, char *val)
{
return ecore_config_set(key, val);
}
@ -633,9 +633,9 @@ ecore_config_set_as_string(const char *key, char *val)
* @return ECORE_CONFIG_ERR_SUCC if the property is set successfully.
*/
int
ecore_config_set_int(const char *key, int val)
ecore_config_int_set(const char *key, int val)
{
return ecore_config_set_typed(key, (void *)&val, PT_INT);
return ecore_config_typed_set(key, (void *)&val, PT_INT);
}
/**
@ -645,9 +645,9 @@ ecore_config_set_int(const char *key, int val)
* @return ECORE_CONFIG_ERR_SUCC if the property is set successfully.
*/
int
ecore_config_set_string(const char *key, char *val)
ecore_config_string_set(const char *key, char *val)
{
return ecore_config_set_typed(key, (void *)val, PT_STR);
return ecore_config_typed_set(key, (void *)val, PT_STR);
}
/**
@ -657,9 +657,9 @@ ecore_config_set_string(const char *key, char *val)
* @return ECORE_CONFIG_ERR_SUCC if the property is set successfully.
*/
int
ecore_config_set_float(const char *key, float val)
ecore_config_float_set(const char *key, float val)
{
return ecore_config_set_typed(key, (void *)&val, PT_FLT);
return ecore_config_typed_set(key, (void *)&val, PT_FLT);
}
/**
@ -669,9 +669,9 @@ ecore_config_set_float(const char *key, float val)
* @return ECORE_CONFIG_ERR_SUCC if the property is set successfully.
*/
int
ecore_config_set_rgb(const char *key, char *val)
ecore_config_rgb_set(const char *key, char *val)
{
return ecore_config_set_typed(key, (void *)val, PT_RGB);
return ecore_config_typed_set(key, (void *)val, PT_RGB);
}
/**
@ -681,9 +681,9 @@ ecore_config_set_rgb(const char *key, char *val)
* @return ECORE_CONFIG_ERR_SUCC if the property is set successfully.
*/
int
ecore_config_set_theme(const char *key, char *val)
ecore_config_theme_set(const char *key, char *val)
{
return ecore_config_set_typed(key, (void *)val, PT_THM);
return ecore_config_typed_set(key, (void *)val, PT_THM);
}
/**
@ -693,7 +693,7 @@ ecore_config_set_theme(const char *key, char *val)
* @return ECORE_CONFIG_ERR_SUCC on success.
*/
int
ecore_config_set_theme_preview_group(const char *key, char *group)
ecore_config_theme_preview_group_set(const char *key, char *group)
{
int ret;
Ecore_Config_Prop *e;
@ -701,7 +701,7 @@ ecore_config_set_theme_preview_group(const char *key, char *group)
ret = ECORE_CONFIG_ERR_SUCC;
if (!(e = ecore_config_get(key)))
{ /* prop doesn't exist yet */
if ((ret = ecore_config_add_typed(key, "", PT_THM)) != ECORE_CONFIG_ERR_SUCC) /* try to add it */
if ((ret = ecore_config_typed_add(key, "", PT_THM)) != ECORE_CONFIG_ERR_SUCC) /* try to add it */
return ret; /* ...failed */
if (!(e = ecore_config_get(key))) /* get handle */
return ECORE_CONFIG_ERR_FAIL;
@ -714,7 +714,7 @@ ecore_config_set_theme_preview_group(const char *key, char *group)
}
int
ecore_config_default_typed(const char *key, void *val, int type)
ecore_config_typed_default(const char *key, void *val, int type)
{
int ret;
Ecore_Config_Prop *e;
@ -723,7 +723,7 @@ ecore_config_default_typed(const char *key, void *val, int type)
if (!(e = ecore_config_get(key)))
{ /* prop doesn't exist yet */
if ((ret = ecore_config_add_typed(key, val, type)) != ECORE_CONFIG_ERR_SUCC) /* try to add it */
if ((ret = ecore_config_typed_add(key, val, type)) != ECORE_CONFIG_ERR_SUCC) /* try to add it */
return ret; /* ...failed */
if (!(e = ecore_config_get(key))) /* get handle */
return ECORE_CONFIG_ERR_FAIL;
@ -750,8 +750,8 @@ ecore_config_default(const char *key, char *val, float lo, float hi, float step)
int ret, type;
Ecore_Config_Prop *e;
type = ecore_config_guess_type(key, val);
ret = ecore_config_default_typed(key, val, type);
type = ecore_config_type_guess(key, val);
ret = ecore_config_typed_default(key, val, type);
e = ecore_config_get(key);
if (e)
{
@ -784,9 +784,9 @@ ecore_config_default(const char *key, char *val, float lo, float hi, float step)
* @return ECORE_CONFIG_ERR_SUCC if there are no problems.
*/
int
ecore_config_default_int(const char *key, int val)
ecore_config_int_default(const char *key, int val)
{
return ecore_config_default_typed(key, (void *)&val, PT_INT);
return ecore_config_typed_default(key, (void *)&val, PT_INT);
}
/**
@ -803,13 +803,13 @@ ecore_config_default_int(const char *key, int val)
* @return ECORE_CONFIG_ERR_SUCC if there were no problems.
*/
int
ecore_config_default_int_bound(const char *key, int val, int low, int high,
ecore_config_int_default_bound(const char *key, int val, int low, int high,
int step)
{
Ecore_Config_Prop *e;
int ret;
ret = ecore_config_default_typed(key, (void *)&val, PT_INT);
ret = ecore_config_typed_default(key, (void *)&val, PT_INT);
e = ecore_config_get(key);
if (e)
{
@ -831,9 +831,9 @@ ecore_config_default_int_bound(const char *key, int val, int low, int high,
* @return ECORE_CONFIG_ERR_SUCC if there were no problems.
*/
int
ecore_config_default_string(const char *key, char *val)
ecore_config_string_default(const char *key, char *val)
{
return ecore_config_default_typed(key, (void *)val, PT_STR);
return ecore_config_typed_default(key, (void *)val, PT_STR);
}
/**
@ -844,9 +844,9 @@ ecore_config_default_string(const char *key, char *val)
* @return ECORE_CONFIG_ERR_SUCC if there were no problems.
*/
int
ecore_config_default_float(const char *key, float val)
ecore_config_float_default(const char *key, float val)
{
return ecore_config_default_typed(key, (void *)&val, PT_FLT);
return ecore_config_typed_default(key, (void *)&val, PT_FLT);
}
/**
@ -863,13 +863,13 @@ ecore_config_default_float(const char *key, float val)
* @return ECORE_CONFIG_ERR_SUCC if there were no problems.
*/
int
ecore_config_default_float_bound(const char *key, float val, float low,
ecore_config_float_default_bound(const char *key, float val, float low,
float high, float step)
{
Ecore_Config_Prop *e;
int ret;
ret = ecore_config_default_typed(key, (void *)&val, PT_FLT);
ret = ecore_config_typed_default(key, (void *)&val, PT_FLT);
e = ecore_config_get(key);
if (e)
{
@ -891,9 +891,9 @@ ecore_config_default_float_bound(const char *key, float val, float low,
* @return ECORE_CONFIG_ERR_SUCC if there are no problems.
*/
int
ecore_config_default_rgb(const char *key, char *val)
ecore_config_rgb_default(const char *key, char *val)
{
return ecore_config_default_typed(key, (void *)val, PT_RGB);
return ecore_config_typed_default(key, (void *)val, PT_RGB);
}
/**
@ -904,9 +904,9 @@ ecore_config_default_rgb(const char *key, char *val)
* @return ECORE_CONFIG_ERR_SUCC if the property is set successfully.
*/
int
ecore_config_default_theme(const char *key, char *val)
ecore_config_theme_default(const char *key, char *val)
{
return ecore_config_default_typed(key, (void *)val, PT_THM);
return ecore_config_typed_default(key, (void *)val, PT_THM);
}
/**
@ -1024,7 +1024,7 @@ ecore_config_deaf(const char *name, const char *key,
* @return Pointer to the first configuration bundle.
*/
Ecore_Config_Bundle *
ecore_config_bundle_get_1st(Ecore_Config_Server * srv)
ecore_config_bundle_1st_get(Ecore_Config_Server * srv)
{ /* anchor: global, but read-only */
return srv->bundles;
}
@ -1035,7 +1035,7 @@ ecore_config_bundle_get_1st(Ecore_Config_Server * srv)
* @return The next configuration bundle.
*/
Ecore_Config_Bundle *
ecore_config_bundle_get_next(Ecore_Config_Bundle * ns)
ecore_config_bundle_next_get(Ecore_Config_Bundle * ns)
{
return ns ? ns->next : NULL;
}
@ -1048,7 +1048,7 @@ ecore_config_bundle_get_next(Ecore_Config_Bundle * ns)
* @return The configuration bundle with the given serial number.
*/
Ecore_Config_Bundle *
ecore_config_bundle_get_by_serial(Ecore_Config_Server * srv, long serial)
ecore_config_bundle_by_serial_get(Ecore_Config_Server * srv, long serial)
{
Ecore_Config_Bundle *eb;
@ -1081,7 +1081,7 @@ ecore_config_bundle_get_by_serial(Ecore_Config_Server * srv, long serial)
* be found.
*/
Ecore_Config_Bundle *
ecore_config_bundle_get_by_label(Ecore_Config_Server * srv, const char *label)
ecore_config_bundle_by_label_get(Ecore_Config_Server * srv, const char *label)
{
Ecore_Config_Bundle *ns;
@ -1102,7 +1102,7 @@ ecore_config_bundle_get_by_label(Ecore_Config_Server * srv, const char *label)
* @return The bundle's identifier string, or -1 if ns is NULL.
*/
long
ecore_config_bundle_get_serial(Ecore_Config_Bundle * ns)
ecore_config_bundle_serial_get(Ecore_Config_Bundle * ns)
{
return ns ? ns->serial : -1;
}
@ -1113,7 +1113,7 @@ ecore_config_bundle_get_serial(Ecore_Config_Bundle * ns)
* @return The bundle's identifer string.
*/
char *
ecore_config_bundle_get_label(Ecore_Config_Bundle * ns)
ecore_config_bundle_label_get(Ecore_Config_Bundle * ns)
{
return ns ? ns->identifier : NULL;
}
@ -1231,8 +1231,8 @@ ecore_config_init(char *name)
if ((buf = malloc(PATH_MAX * sizeof(char))))
{
snprintf(buf, PATH_MAX, "%s/.e/config.db", p);
if (ecore_config_load_file(buf) != 0)
if (ecore_config_load_file(PACKAGE_DATA_DIR "/system.db") != 0)
if (ecore_config_file_load(buf) != 0)
if (ecore_config_file_load(PACKAGE_DATA_DIR "/system.db") != 0)
return ECORE_CONFIG_ERR_NOFILE;
sys = __ecore_config_bundle_local->data;
while (sys)

View File

@ -22,7 +22,7 @@ ecore_config_load(void)
snprintf(file, PATH_MAX, "%s/.e/apps/%s/config.db", getenv("HOME"),
__ecore_config_app_name);
return ecore_config_load_file(file);
return ecore_config_file_load(file);
}
/**
@ -37,7 +37,7 @@ ecore_config_save(void)
snprintf(file, PATH_MAX, "%s/.e/apps/%s/config.db", getenv("HOME"),
__ecore_config_app_name);
return ecore_config_save_file(file);
return ecore_config_file_save(file);
}
/**
@ -47,7 +47,7 @@ ecore_config_save(void)
* returned if the file cannot be loaded.
*/
int
ecore_config_load_file(char *file)
ecore_config_file_load(char *file)
{
E_DB_File *db;
char **keys;
@ -81,7 +81,7 @@ ecore_config_load_file(char *file)
{
if (e_db_int_get(db, keys[x], &itmp))
{
ecore_config_set_int(keys[x], itmp);
ecore_config_int_set(keys[x], itmp);
}
else
{
@ -92,7 +92,7 @@ ecore_config_load_file(char *file)
{
if (e_db_float_get(db, keys[x], &ftmp))
{
ecore_config_set_float(keys[x], ftmp);
ecore_config_float_set(keys[x], ftmp);
}
else
{
@ -104,17 +104,17 @@ ecore_config_load_file(char *file)
data = e_db_str_get(db, keys[x]);
if (data)
{
itmp = ecore_config_guess_type(keys[x], data);
itmp = ecore_config_type_guess(keys[x], data);
switch (itmp)
{
case PT_RGB:
ecore_config_set_rgb(keys[x], data);
ecore_config_rgb_set(keys[x], data);
break;
case PT_THM:
ecore_config_set_theme(keys[x], data);
ecore_config_theme_set(keys[x], data);
break;
default:
ecore_config_set_string(keys[x], data);
ecore_config_string_set(keys[x], data);
}
free(data);
}
@ -165,7 +165,7 @@ _ecore_config_recurse_mkdir(char *file)
* ECORE_CONFIG_ERR_FAIL is returned if the data cannot be saved.
*/
int
ecore_config_save_file(char *file)
ecore_config_file_save(char *file)
{
Ecore_Config_Prop *next;
E_DB_File *db;
@ -195,19 +195,19 @@ ecore_config_save_file(char *file)
switch (next->type)
{
case PT_INT:
e_db_int_set(db, next->key, ecore_config_get_int(next->key));
e_db_int_set(db, next->key, ecore_config_int_get(next->key));
break;
case PT_FLT:
e_db_float_set(db, next->key, ecore_config_get_float(next->key));
e_db_float_set(db, next->key, ecore_config_float_get(next->key));
break;
case PT_RGB:
e_db_str_set(db, next->key, ecore_config_get_rgbstr(next->key));
e_db_str_set(db, next->key, ecore_config_rgbstr_get(next->key));
break;
case PT_STR:
e_db_str_set(db, next->key, ecore_config_get_string(next->key));
e_db_str_set(db, next->key, ecore_config_string_get(next->key));
break;
case PT_THM:
e_db_str_set(db, next->key, ecore_config_get_theme(next->key));
e_db_str_set(db, next->key, ecore_config_theme_get(next->key));
break;
case PT_NIL:
/* currently we do nothing for undefined ojects */

View File

@ -24,7 +24,7 @@
/*****************************************************************************/
static int
_ecore_config_ipc_ecore_get_string(char **m, char **r)
_ecore_config_ipc_ecore_string_get(char **m, char **r)
{
char *q;
int l = 0;
@ -88,7 +88,7 @@ _ecore_config_ipc_global_prop_list(Ecore_Config_Server * srv, const long serial)
data = e_db_str_get(db, keys[x]);
if (data)
{
if (ecore_config_guess_type(keys[x], data) == PT_RGB)
if (ecore_config_type_guess(keys[x], data) == PT_RGB)
estring_appendf(s, "%s%s: colour", f ? "\n" : "", keys[x]);
else
estring_appendf(s, "%s%s: string", f ? "\n" : "", keys[x]);
@ -156,17 +156,17 @@ _ecore_config_ipc_ecore_handle_request(Ecore_Ipc_Server * server,
r = _ecore_config_ipc_prop_list(srv, serial);
break;
case IPC_PROP_DESC:
if (_ecore_config_ipc_ecore_get_string(&m, &k) == ECORE_CONFIG_ERR_SUCC)
if (_ecore_config_ipc_ecore_string_get(&m, &k) == ECORE_CONFIG_ERR_SUCC)
r = _ecore_config_ipc_prop_desc(srv, serial, k);
break;
case IPC_PROP_GET:
if (_ecore_config_ipc_ecore_get_string(&m, &k) == ECORE_CONFIG_ERR_SUCC)
if (_ecore_config_ipc_ecore_string_get(&m, &k) == ECORE_CONFIG_ERR_SUCC)
r = _ecore_config_ipc_prop_get(srv, serial, k);
break;
case IPC_PROP_SET:
if (_ecore_config_ipc_ecore_get_string(&m, &k) == ECORE_CONFIG_ERR_SUCC)
if (_ecore_config_ipc_ecore_string_get(&m, &k) == ECORE_CONFIG_ERR_SUCC)
{
if (_ecore_config_ipc_ecore_get_string(&m, &v) ==
if (_ecore_config_ipc_ecore_string_get(&m, &v) ==
ECORE_CONFIG_ERR_SUCC)
return _ecore_config_ipc_ecore_send(e,
_ecore_config_ipc_prop_set
@ -178,7 +178,7 @@ _ecore_config_ipc_ecore_handle_request(Ecore_Ipc_Server * server,
r = _ecore_config_ipc_bundle_list(srv);
break;
case IPC_BUNDLE_NEW:
if (_ecore_config_ipc_ecore_get_string(&m, &k) == ECORE_CONFIG_ERR_SUCC)
if (_ecore_config_ipc_ecore_string_get(&m, &k) == ECORE_CONFIG_ERR_SUCC)
return _ecore_config_ipc_ecore_send(e,
k ?
_ecore_config_ipc_bundle_new(srv,
@ -186,7 +186,7 @@ _ecore_config_ipc_ecore_handle_request(Ecore_Ipc_Server * server,
ECORE_CONFIG_ERR_FAIL, NULL);
break;
case IPC_BUNDLE_LABEL_SET:
if (_ecore_config_ipc_ecore_get_string(&m, &k) == ECORE_CONFIG_ERR_SUCC)
if (_ecore_config_ipc_ecore_string_get(&m, &k) == ECORE_CONFIG_ERR_SUCC)
return _ecore_config_ipc_ecore_send(e,
k ?
_ecore_config_ipc_bundle_label_set
@ -195,7 +195,7 @@ _ecore_config_ipc_ecore_handle_request(Ecore_Ipc_Server * server,
NULL);
break;
case IPC_BUNDLE_LABEL_FIND:
if (_ecore_config_ipc_ecore_get_string(&m, &k) == ECORE_CONFIG_ERR_SUCC)
if (_ecore_config_ipc_ecore_string_get(&m, &k) == ECORE_CONFIG_ERR_SUCC)
return _ecore_config_ipc_ecore_send(e,
_ecore_config_ipc_bundle_label_find
(srv, k), NULL);

View File

@ -67,7 +67,7 @@ _ecore_config_ipc_prop_list(Ecore_Config_Server * srv, const long serial)
estring *s;
int f;
theme = ecore_config_bundle_get_by_serial(srv, serial);
theme = ecore_config_bundle_by_serial_get(srv, serial);
e = theme ? theme->data : NULL;
s = estring_new(8192);
f = 0;
@ -80,7 +80,7 @@ _ecore_config_ipc_prop_list(Ecore_Config_Server * srv, const long serial)
continue;
}
estring_appendf(s, "%s%s: %s", f ? "\n" : "", e->key,
ecore_config_get_type(e));
ecore_config_type_get(e));
if (e->flags & PF_BOUNDS)
{
if (e->type == PT_FLT)
@ -107,14 +107,14 @@ _ecore_config_ipc_prop_desc(Ecore_Config_Server * srv, const long serial,
Ecore_Config_Bundle *theme;
Ecore_Config_Prop *e;
theme = ecore_config_bundle_get_by_serial(srv, serial);
theme = ecore_config_bundle_by_serial_get(srv, serial);
e = ecore_config_get(key);
if (e)
{
estring *s = estring_new(512);
estring_appendf(s, "%s: %s", e->key, ecore_config_get_type(e));
estring_appendf(s, "%s: %s", e->key, ecore_config_type_get(e));
if (e->flags & PF_BOUNDS)
estring_appendf(s, ", range %d..%d", e->lo, e->hi);
return estring_disown(s);
@ -132,8 +132,8 @@ _ecore_config_ipc_prop_get(Ecore_Config_Server * srv, const long serial,
Ecore_Config_Bundle *theme;
ret = NULL;
theme = ecore_config_bundle_get_by_serial(srv, serial);
if ((ret = ecore_config_get_as_string( /*theme, */ key)))
theme = ecore_config_bundle_by_serial_get(srv, serial);
if ((ret = ecore_config_as_string_get( /*theme, */ key)))
return ret;
#endif
return strdup("<undefined>");
@ -147,7 +147,7 @@ _ecore_config_ipc_prop_set(Ecore_Config_Server * srv, const long serial,
int ret;
Ecore_Config_Bundle *theme;
theme = ecore_config_bundle_get_by_serial(srv, serial);
theme = ecore_config_bundle_by_serial_get(srv, serial);
ret = ecore_config_set(key, (char *)val);
E(1, "ipc.prop.set(%s->%s,\"%s\") => %d\n", theme ? theme->identifier : "",
key, val, ret);
@ -166,7 +166,7 @@ _ecore_config_ipc_bundle_list(Ecore_Config_Server * srv)
estring *s;
int f;
ns = ecore_config_bundle_get_1st(srv);
ns = ecore_config_bundle_1st_get(srv);
s = estring_new(8192);
f = 0;
if (!ns)
@ -175,10 +175,10 @@ _ecore_config_ipc_bundle_list(Ecore_Config_Server * srv)
while (ns)
{
estring_appendf(s, "%s%d: %s", f ? "\n" : "",
ecore_config_bundle_get_serial(ns),
ecore_config_bundle_get_label(ns));
ecore_config_bundle_serial_get(ns),
ecore_config_bundle_label_get(ns));
f = 1;
ns = ecore_config_bundle_get_next(ns);
ns = ecore_config_bundle_next_get(ns);
}
return estring_disown(s);
@ -198,8 +198,8 @@ _ecore_config_ipc_bundle_label_get(Ecore_Config_Server * srv, const long serial)
Ecore_Config_Bundle *ns;
char *label;
ns = ecore_config_bundle_get_by_serial(srv, serial);
label = ecore_config_bundle_get_label(ns);
ns = ecore_config_bundle_by_serial_get(srv, serial);
label = ecore_config_bundle_label_get(ns);
return strdup(label ? label : "<no such bundle>");
}
@ -209,7 +209,7 @@ _ecore_config_ipc_bundle_label_set(Ecore_Config_Server * srv, const long serial,
{
Ecore_Config_Bundle *ns;
ns = ecore_config_bundle_get_by_serial(srv, serial);
ns = ecore_config_bundle_by_serial_get(srv, serial);
if (!(ns->identifier = malloc(sizeof(label))))
return ECORE_CONFIG_ERR_OOM;
memcpy(ns->identifier, label, sizeof(label));
@ -222,8 +222,8 @@ _ecore_config_ipc_bundle_label_find(Ecore_Config_Server * srv,
{
Ecore_Config_Bundle *ns;
ns = ecore_config_bundle_get_by_label(srv, label);
return ns ? ecore_config_bundle_get_serial(ns) : -1;
ns = ecore_config_bundle_by_label_get(srv, label);
return ns ? ecore_config_bundle_serial_get(ns) : -1;
}
static int