summaryrefslogtreecommitdiff
path: root/legacy/emotion/src/lib
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2010-08-30 13:25:35 +0000
committerCedric BAIL <cedric.bail@free.fr>2010-08-30 13:25:35 +0000
commit61c07ad1c48386557a226154a56ccd9596454ac0 (patch)
treea6be70d21c73df506586d93af681cbab9b260a7e /legacy/emotion/src/lib
parentc128fa4d80637341d6b30871ff66e8f3b0d9ef14 (diff)
* emotion: emotion_object_init will choose the best available backend
if NULL is passed. SVN revision: 51747
Diffstat (limited to 'legacy/emotion/src/lib')
-rw-r--r--legacy/emotion/src/lib/emotion_smart.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/legacy/emotion/src/lib/emotion_smart.c b/legacy/emotion/src/lib/emotion_smart.c
index 579b6df3fd..91a9eaff17 100644
--- a/legacy/emotion/src/lib/emotion_smart.c
+++ b/legacy/emotion/src/lib/emotion_smart.c
@@ -145,7 +145,7 @@ _emotion_module_unregister(const char *name)
145 return eina_hash_del(_backends, name, NULL); 145 return eina_hash_del(_backends, name, NULL);
146} 146}
147 147
148static Eina_Bool 148static const char *
149_emotion_module_open(const char *name, Evas_Object *obj, Emotion_Video_Module **mod, void **video) 149_emotion_module_open(const char *name, Evas_Object *obj, Emotion_Video_Module **mod, void **video)
150{ 150{
151 Eina_Emotion_Plugins *plugin; 151 Eina_Emotion_Plugins *plugin;
@@ -156,7 +156,7 @@ _emotion_module_open(const char *name, Evas_Object *obj, Emotion_Video_Module **
156 if (!_backends) 156 if (!_backends)
157 { 157 {
158 fprintf(stderr, "No backend loaded\n"); 158 fprintf(stderr, "No backend loaded\n");
159 return EINA_FALSE; 159 return NULL;
160 } 160 }
161 161
162 /* FIXME: Always look for a working backend. */ 162 /* FIXME: Always look for a working backend. */
@@ -179,7 +179,7 @@ _emotion_module_open(const char *name, Evas_Object *obj, Emotion_Video_Module **
179 if (*mod) 179 if (*mod)
180 { 180 {
181 (*mod)->plugin = plugin; 181 (*mod)->plugin = plugin;
182 return EINA_TRUE; 182 return name;
183 } 183 }
184 } 184 }
185 185
@@ -188,7 +188,7 @@ _emotion_module_open(const char *name, Evas_Object *obj, Emotion_Video_Module **
188 188
189 fprintf (stderr, "Unable to load module %s\n", name); 189 fprintf (stderr, "Unable to load module %s\n", name);
190 190
191 return EINA_FALSE; 191 return NULL;
192} 192}
193 193
194static void 194static void
@@ -240,14 +240,12 @@ emotion_object_init(Evas_Object *obj, const char *module_filename)
240 Smart_Data *sd; 240 Smart_Data *sd;
241 char *file; 241 char *file;
242 242
243 if (!module_filename) return EINA_FALSE;
244
245 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0); 243 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
246 244
247 if ((sd->module_name) && (!strcmp(sd->module_name, module_filename))) 245 if ((sd->module_name) && module_filename && (!strcmp(sd->module_name, module_filename)))
248 return EINA_TRUE; 246 return EINA_TRUE;
249 free(sd->module_name); 247 free(sd->module_name);
250 sd->module_name = strdup(module_filename); 248 sd->module_name = NULL;
251 249
252 file = sd->file; 250 file = sd->file;
253 sd->file = NULL; 251 sd->file = NULL;
@@ -272,9 +270,13 @@ emotion_object_init(Evas_Object *obj, const char *module_filename)
272 _emotion_module_close(sd->module, sd->video); 270 _emotion_module_close(sd->module, sd->video);
273 sd->module = NULL; 271 sd->module = NULL;
274 sd->video = NULL; 272 sd->video = NULL;
275 if (!_emotion_module_open(module_filename, obj, &sd->module, &sd->video)) 273
274 module_filename = _emotion_module_open(module_filename, obj, &sd->module, &sd->video);
275 if (!module_filename)
276 return EINA_FALSE; 276 return EINA_FALSE;
277 277
278 sd->module_name = strdup(module_filename);
279
278 if (file) 280 if (file)
279 { 281 {
280 emotion_object_file_set(obj, file); 282 emotion_object_file_set(obj, file);