From a7c3818d59c5627d15be610e5ec6bcac8de23a9b Mon Sep 17 00:00:00 2001 From: handyande Date: Sat, 27 Mar 2004 20:59:42 +0000 Subject: [PATCH] Fixup listing of system properties - handled differently to local properties this allows the _system connector to be 'examined' SVN revision: 9500 --- legacy/ecore/src/lib/ecore_config/Makefile.am | 4 +- .../ecore/src/lib/ecore_config/ecore_config.c | 1 + legacy/ecore/src/lib/ecore_config/ipc.h | 1 + legacy/ecore/src/lib/ecore_config/ipc_ecore.c | 41 +++++++++++++++++++ 4 files changed, 45 insertions(+), 2 deletions(-) diff --git a/legacy/ecore/src/lib/ecore_config/Makefile.am b/legacy/ecore/src/lib/ecore_config/Makefile.am index cec65dcabb..475aca45fa 100644 --- a/legacy/ecore/src/lib/ecore_config/Makefile.am +++ b/legacy/ecore/src/lib/ecore_config/Makefile.am @@ -3,7 +3,7 @@ INCLUDES = \ -I$(top_srcdir)/src/lib/ecore \ -I$(top_srcdir)/src/lib/ecore_ipc \ --I$(top_srcdir)/ @evas_cflags@ +-I$(top_srcdir)/ @evas_cflags@ @edb_cflags@ DB = system.db CLEANFILES = $(DB) @@ -47,7 +47,7 @@ ecore_config_ipc_ecore_la_LIBADD = \ $(top_builddir)/src/lib/ecore/libecore.la \ $(top_builddir)/src/lib/ecore_ipc/libecore_ipc.la \ libecore_config.la \ --ledb +@edb_libs@ $(DB): sh build_$(DB).sh diff --git a/legacy/ecore/src/lib/ecore_config/ecore_config.c b/legacy/ecore/src/lib/ecore_config/ecore_config.c index 0daa4f572a..f4b4cd1716 100644 --- a/legacy/ecore/src/lib/ecore_config/ecore_config.c +++ b/legacy/ecore/src/lib/ecore_config/ecore_config.c @@ -77,6 +77,7 @@ const char *ecore_config_get_type(const Ecore_Config_Prop *e) { return "not found"; } + void *ecore_config_get_data(const char *key) { Ecore_Config_Prop *e; e=ecore_config_get(__ecore_config_bundle_local,key); diff --git a/legacy/ecore/src/lib/ecore_config/ipc.h b/legacy/ecore/src/lib/ecore_config/ipc.h index 3383327deb..36ce702955 100644 --- a/legacy/ecore/src/lib/ecore_config/ipc.h +++ b/legacy/ecore/src/lib/ecore_config/ipc.h @@ -4,6 +4,7 @@ typedef enum { IPC_NONE, IPC_PROP_LIST, + IPC_GLOBAL_PROP_LIST, IPC_PROP_DESC, IPC_PROP_GET, IPC_PROP_SET, diff --git a/legacy/ecore/src/lib/ecore_config/ipc_ecore.c b/legacy/ecore/src/lib/ecore_config/ipc_ecore.c index ad01d335ec..1a2753bf7f 100644 --- a/legacy/ecore/src/lib/ecore_config/ipc_ecore.c +++ b/legacy/ecore/src/lib/ecore_config/ipc_ecore.c @@ -1,6 +1,7 @@ /* by Azundris, with thanks to Corey Donohoe */ #include "ipc.h" +#include "util.h" #include #include @@ -15,6 +16,8 @@ #include #include +#include + #include "Ecore_Config.h" @@ -43,7 +46,42 @@ static int _ecore_config_ipc_ecore_get_string(char **m,char **r) { return ECORE_CONFIG_ERR_SUCC; } +char *_ecore_config_ipc_global_prop_list(Ecore_Config_Server *srv, const long serial) { + E_DB_File *db; + char **keys; + int key_count, x; + estring *s; + int f; + char *buf, *p, *type; + s=estring_new(8192); + f=0; + if((p=getenv("HOME"))) { /* debug-only ### FIXME */ + if ((buf=malloc(PATH_MAX*sizeof(char)))) { + snprintf(buf,PATH_MAX,"%s/.e/config.db",p); + db=e_db_open_read(buf); + if (!(db=e_db_open_read(buf))) + if (!(db=e_db_open_read(buf=PACKAGE_DATA_DIR "/system.db"))) + return ECORE_CONFIG_ERR_NOFILE; + } + } + + keys = e_db_dump_key_list(buf, &key_count); + free(buf); + + for (x = 0; x < key_count; x++) { + type = e_db_type_get(db, keys[x]); + if (!type) type = "?"; + + estring_appendf(s,"%s%s: %s",f?"\n":"",keys[x],ecore_config_edb_to_ecore_config_type(type)); + + if (type) free(type); + f=1; + } + e_db_close(db); + free(keys); + + return estring_disown(s);} @@ -82,6 +120,9 @@ static int _ecore_config_ipc_ecore_handle_request(Ecore_Ipc_Server *server,Ecore case IPC_PROP_LIST: r=_ecore_config_ipc_prop_list(srv, serial); break; + case IPC_GLOBAL_PROP_LIST: + r=_ecore_config_ipc_global_prop_list(srv, serial); + break; case IPC_PROP_DESC: if(_ecore_config_ipc_ecore_get_string(&m,&k)==ECORE_CONFIG_ERR_SUCC) r=_ecore_config_ipc_prop_desc(srv, serial,k); -- 2.34.1