summaryrefslogtreecommitdiff
path: root/src/lib/emotion/emotion_modules.c
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@gmail.com>2013-01-11 17:41:53 +0000
committerGustavo Sverzut Barbieri <barbieri@gmail.com>2013-01-11 17:41:53 +0000
commitd83b83e10befda5a8065069a3152846decf91aa3 (patch)
tree5d134edc042408798a9cce6ebd9ed7928e6fd67d /src/lib/emotion/emotion_modules.c
parent5b885ea931de57a3eaece798d9cbe3ec6aa3cea2 (diff)
efl/emotion: delay module loading until they are needed.
SVN revision: 82651
Diffstat (limited to 'src/lib/emotion/emotion_modules.c')
-rw-r--r--src/lib/emotion/emotion_modules.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/lib/emotion/emotion_modules.c b/src/lib/emotion/emotion_modules.c
index 95ac2b3c91..95d6a8b30c 100644
--- a/src/lib/emotion/emotion_modules.c
+++ b/src/lib/emotion/emotion_modules.c
@@ -25,6 +25,7 @@ typedef struct _Emotion_Engine_Registry_Entry
25 25
26static Eina_List *_emotion_engine_registry = NULL; 26static Eina_List *_emotion_engine_registry = NULL;
27static Eina_Array *_emotion_modules = NULL; 27static Eina_Array *_emotion_modules = NULL;
28static Eina_Bool _emotion_modules_loaded = EINA_FALSE;
28 29
29static void 30static void
30_emotion_engine_registry_entry_free(Emotion_Engine_Registry_Entry *re) 31_emotion_engine_registry_entry_free(Emotion_Engine_Registry_Entry *re)
@@ -49,7 +50,7 @@ _emotion_engine_registry_entry_cmp(const void *pa, const void *pb)
49} 50}
50 51
51static void 52static void
52_emotion_modules_load(void) 53_emotion_modules_find(void)
53{ 54{
54 char buf[PATH_MAX]; 55 char buf[PATH_MAX];
55 char *path; 56 char *path;
@@ -103,12 +104,25 @@ _emotion_modules_load(void)
103 _emotion_modules = eina_module_arch_list_get(_emotion_modules, buf, MODULE_ARCH); 104 _emotion_modules = eina_module_arch_list_get(_emotion_modules, buf, MODULE_ARCH);
104} 105}
105 106
107static void
108_emotion_modules_load(void)
109{
110 if (_emotion_modules_loaded) return;
111 _emotion_modules_loaded = EINA_TRUE;
112
113 if (_emotion_modules)
114 eina_module_list_load(_emotion_modules);
115
116 if (!_emotion_engine_registry)
117 ERR("Couldn't find any emotion engine.");
118}
119
106Eina_Bool 120Eina_Bool
107emotion_modules_init(void) 121emotion_modules_init(void)
108{ 122{
109 int static_modules = 0; 123 int static_modules = 0;
110 124
111 _emotion_modules_load(); 125 _emotion_modules_find();
112 126
113 /* Init static module */ 127 /* Init static module */
114#ifdef EMOTION_STATIC_BUILD_XINE 128#ifdef EMOTION_STATIC_BUILD_XINE
@@ -123,11 +137,6 @@ emotion_modules_init(void)
123 137
124 if ((!_emotion_modules) && (!static_modules)) 138 if ((!_emotion_modules) && (!static_modules))
125 WRN("No emotion modules found!"); 139 WRN("No emotion modules found!");
126 else if (_emotion_modules)
127 eina_module_list_load(_emotion_modules);
128
129 if (!_emotion_engine_registry)
130 ERR("Couldn't find any emotion engine.");
131 140
132 return EINA_TRUE; 141 return EINA_TRUE;
133} 142}
@@ -156,6 +165,8 @@ emotion_modules_shutdown(void)
156 eina_array_free(_emotion_modules); 165 eina_array_free(_emotion_modules);
157 _emotion_modules = NULL; 166 _emotion_modules = NULL;
158 } 167 }
168
169 _emotion_modules_loaded = EINA_FALSE;
159} 170}
160 171
161EAPI Eina_Bool 172EAPI Eina_Bool
@@ -296,6 +307,8 @@ emotion_engine_instance_new(const char *name, Evas_Object *obj, Emotion_Module_O
296 const Emotion_Engine *engine; 307 const Emotion_Engine *engine;
297 void *data; 308 void *data;
298 309
310 _emotion_modules_load();
311
299 if ((!name) && getenv("EMOTION_ENGINE")) 312 if ((!name) && getenv("EMOTION_ENGINE"))
300 { 313 {
301 name = getenv("EMOTION_ENGINE"); 314 name = getenv("EMOTION_ENGINE");