More playing with ecore_config

Azundris suggested this new layout and I agree
docs should be available soon


SVN revision: 8570
This commit is contained in:
handyande 2004-01-20 00:45:52 +00:00 committed by handyande
parent c436a9c5ee
commit 3b2ef67c3a
3 changed files with 30 additions and 7 deletions

View File

@ -44,6 +44,7 @@
# define E(lvl,args...) do { } while(0)
#endif
#define ECORE_CONFIG_GLOBAL_ID "_system"
/* structures */
@ -109,6 +110,8 @@ typedef struct Ecore_Config_Server {
Ecore_Config_Bundle *bundles; /* data anchor */
struct Ecore_Config_Server *next; } Ecore_Config_Server;
Ecore_Config_Server *config_system;
Ecore_Config_Prop *ecore_config_get(const Ecore_Config_Bundle *t,const char *key);
const char *ecore_config_get_type(const Ecore_Config_Prop *e);
@ -149,8 +152,7 @@ long ecore_config_bundle_get_serial(Ecore_Config_Bundle *ns);
char *ecore_config_bundle_get_label(Ecore_Config_Bundle *ns);
Ecore_Config_Server *ecore_config_init(char *name);
Ecore_Config_Server *ecore_config_init_global(char *name);
Ecore_Config_Bundle *ecore_config_init(char *name);
int ecore_config_exit(void);
int ecore_config_load(Ecore_Config_Bundle *b);

View File

@ -551,7 +551,7 @@ Ecore_Config_Server *do_init(char *name) {
return ipc_init(name);
}
Ecore_Config_Server *ecore_config_init(char *name) {
Ecore_Config_Server *ecore_config_init_local(char *name) {
char *p;
char *buf;
@ -585,6 +585,28 @@ Ecore_Config_Server *ecore_config_init_global(char *name) {
return do_init(name);
}
Ecore_Config_Bundle *ecore_config_init(char *name) {
Ecore_Config_Server *srv;
Ecore_Config_Bundle *bdl;
char *buf, *p;
srv = ecore_config_init_local(name);
ecore_config_init_global(ECORE_CONFIG_GLOBAL_ID);
bdl = ecore_config_bundle_new(srv, "config");
if((p=getenv("HOME"))) { /* debug-only ### FIXME */
if ((buf=malloc(PATH_MAX*sizeof(char)))) {
snprintf(buf,PATH_MAX,"%s/.e/config.db",p);
ecore_config_load_file(bdl, buf);
}
free(buf);
}
config_system=srv;
return bdl;
}
int ecore_config_exit(void) {
return ipc_exit();
}

View File

@ -21,7 +21,6 @@
# define TRUE (!FALSE)
#endif
typedef struct _ipc {
void *lib;
void *data;
@ -40,7 +39,7 @@ static unsigned long ipc_timer=0L;
Ecore_Config_Server *srv2ecore_config_srv(void *srv) {
ipc *ipc_tmp;
Ecore_Config_Server *srv_tmp;
/*
ipc_tmp = ipc_modules;
while (ipc_tmp) {
srv_tmp = ipc_tmp->data;
@ -51,8 +50,8 @@ Ecore_Config_Server *srv2ecore_config_srv(void *srv) {
}
ipc_tmp = ipc_tmp->next;
}
return NULL;
*/
return config_system;
}
/*****************************************************************************/