summaryrefslogtreecommitdiff
path: root/src/lib/ecore
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@profusion.mobi>2013-08-08 20:32:53 -0300
committerGustavo Sverzut Barbieri <barbieri@profusion.mobi>2013-08-09 14:28:02 -0300
commitc0c5736a4e0d41adc9c97577006c289718c926de (patch)
tree50bc5feedd13d4c4fca49aeb55842008fd3100b7 /src/lib/ecore
parentca39ff976e576dd917becf989f28fdf149c9f1d0 (diff)
ecore: add system modules, implement 'systemd'.
Ecore will now load "system modules" on ecore_init(). The "systemd" module will use DBus to monitor localed, hostnamed and timedated and add system events related to those changes.
Diffstat (limited to 'src/lib/ecore')
-rw-r--r--src/lib/ecore/ecore.c90
1 files changed, 90 insertions, 0 deletions
diff --git a/src/lib/ecore/ecore.c b/src/lib/ecore/ecore.c
index 28726a2229..489dc6074d 100644
--- a/src/lib/ecore/ecore.c
+++ b/src/lib/ecore/ecore.c
@@ -116,6 +116,77 @@ int _ecore_main_lock_count;
116# define CODESET "INVALID" 116# define CODESET "INVALID"
117#endif 117#endif
118 118
119static Eina_Prefix *_ecore_pfx = NULL;
120static Eina_Array *module_list = NULL;
121
122static void
123ecore_system_modules_load(void)
124{
125 char buf[PATH_MAX] = "";
126 char *path;
127
128 if (getenv("EFL_RUN_IN_TREE"))
129 {
130 struct stat st;
131 snprintf(buf, sizeof(buf), "%s/src/modules/ecore/system",
132 PACKAGE_BUILD_DIR);
133 if (stat(buf, &st) == 0)
134 {
135 const char *built_modules[] = {
136#ifdef HAVE_SYSTEMD
137 "systemd",
138#endif
139 NULL
140 };
141 const char **itr;
142 for (itr = built_modules; *itr != NULL; itr++)
143 {
144 snprintf(buf, sizeof(buf),
145 "%s/src/modules/ecore/system/%s/.libs",
146 PACKAGE_BUILD_DIR, *itr);
147 module_list = eina_module_list_get(module_list, buf,
148 EINA_FALSE, NULL, NULL);
149 }
150
151 if (module_list)
152 eina_module_list_load(module_list);
153 return;
154 }
155 }
156
157 path = eina_module_environment_path_get("ECORE_MODULES_DIR",
158 "/ecore/system");
159 if (path)
160 {
161 module_list = eina_module_arch_list_get(module_list, path, MODULE_ARCH);
162 free(path);
163 }
164
165 path = eina_module_environment_path_get("HOME", "/.ecore/system");
166 if (path)
167 {
168 module_list = eina_module_arch_list_get(module_list, path, MODULE_ARCH);
169 free(path);
170 }
171
172 snprintf(buf, sizeof(buf), "%s/ecore/system",
173 eina_prefix_lib_get(_ecore_pfx));
174 module_list = eina_module_arch_list_get(module_list, buf, MODULE_ARCH);
175
176 eina_module_list_load(module_list);
177}
178
179static void
180ecore_system_modules_unload(void)
181{
182 if (module_list)
183 {
184 eina_module_list_free(module_list);
185 eina_array_free(module_list);
186 module_list = NULL;
187 }
188}
189
119/** 190/**
120 * @addtogroup Ecore_Init_Group 191 * @addtogroup Ecore_Init_Group
121 * 192 *
@@ -170,6 +241,16 @@ ecore_init(void)
170 goto shutdown_log_dom; 241 goto shutdown_log_dom;
171 } 242 }
172 243
244 _ecore_pfx = eina_prefix_new(NULL, ecore_init,
245 "ECORE", "ecore", "checkme",
246 PACKAGE_BIN_DIR, PACKAGE_LIB_DIR,
247 PACKAGE_DATA_DIR, PACKAGE_DATA_DIR);
248 if (!_ecore_pfx)
249 {
250 ERR("Could not get ecore installation prefix");
251 goto shutdown_log_dom;
252 }
253
173 eo_init(); 254 eo_init();
174 255
175 if (getenv("ECORE_FPS_DEBUG")) _ecore_fps_debug = 1; 256 if (getenv("ECORE_FPS_DEBUG")) _ecore_fps_debug = 1;
@@ -230,6 +311,9 @@ ecore_init(void)
230 EINA_LOG_STATE_STOP, 311 EINA_LOG_STATE_STOP,
231 EINA_LOG_STATE_INIT); 312 EINA_LOG_STATE_INIT);
232 313
314
315 ecore_system_modules_load();
316
233 return _ecore_init_count; 317 return _ecore_init_count;
234 318
235shutdown_mempool: 319shutdown_mempool:
@@ -273,6 +357,8 @@ ecore_shutdown(void)
273 if (--_ecore_init_count != 0) 357 if (--_ecore_init_count != 0)
274 goto unlock; 358 goto unlock;
275 359
360 ecore_system_modules_unload();
361
276 eina_log_timing(_ecore_log_dom, 362 eina_log_timing(_ecore_log_dom,
277 EINA_LOG_STATE_START, 363 EINA_LOG_STATE_START,
278 EINA_LOG_STATE_SHUTDOWN); 364 EINA_LOG_STATE_SHUTDOWN);
@@ -345,6 +431,10 @@ ecore_shutdown(void)
345 ecore_mempool_shutdown(); 431 ecore_mempool_shutdown();
346 eina_log_domain_unregister(_ecore_log_dom); 432 eina_log_domain_unregister(_ecore_log_dom);
347 _ecore_log_dom = -1; 433 _ecore_log_dom = -1;
434
435 eina_prefix_free(_ecore_pfx);
436 _ecore_pfx = NULL;
437
348 eina_shutdown(); 438 eina_shutdown();
349#ifdef HAVE_EVIL 439#ifdef HAVE_EVIL
350 evil_shutdown(); 440 evil_shutdown();