summaryrefslogtreecommitdiff
path: root/legacy/emotion/src/lib/emotion_smart.c
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@gmail.com>2010-04-01 02:17:40 +0000
committerGustavo Sverzut Barbieri <barbieri@gmail.com>2010-04-01 02:17:40 +0000
commitdc0eb078600b82b70ec0dc7759d9b4912c5142d8 (patch)
tree67fa56baa300f9800b2610b8335f429fff174db2 /legacy/emotion/src/lib/emotion_smart.c
parent4a9c82671edee823233570c95f1d9c1b4e4034fd (diff)
allow changing module during runtime, don't forget about file and play state.
SVN revision: 47638
Diffstat (limited to '')
-rw-r--r--legacy/emotion/src/lib/emotion_smart.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/legacy/emotion/src/lib/emotion_smart.c b/legacy/emotion/src/lib/emotion_smart.c
index b9fe3e924f..2c83c4a31c 100644
--- a/legacy/emotion/src/lib/emotion_smart.c
+++ b/legacy/emotion/src/lib/emotion_smart.c
@@ -163,7 +163,7 @@ _emotion_module_open(const char *name, Evas_Object *obj, Emotion_Video_Module **
163static void 163static void
164_emotion_module_close(Emotion_Video_Module *mod, void *video) 164_emotion_module_close(Emotion_Video_Module *mod, void *video)
165{ 165{
166 166 if (!mod) return;
167 if (mod->plugin->close && video) 167 if (mod->plugin->close && video)
168 mod->plugin->close(mod, video); 168 mod->plugin->close(mod, video);
169 /* FIXME: we can't go dlclosing here as a thread still may be running from 169 /* FIXME: we can't go dlclosing here as a thread still may be running from
@@ -207,11 +207,20 @@ EAPI Eina_Bool
207emotion_object_init(Evas_Object *obj, const char *module_filename) 207emotion_object_init(Evas_Object *obj, const char *module_filename)
208{ 208{
209 Smart_Data *sd; 209 Smart_Data *sd;
210 char *file;
211
212 if (!module_filename) return EINA_FALSE;
210 213
211 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0); 214 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
212 215
213 free(sd->file); 216 if ((sd->module_name) && (!strcmp(sd->module_name, module_filename)))
217 return EINA_TRUE;
218 free(sd->module_name);
219 sd->module_name = strdup(module_filename);
220
221 file = sd->file;
214 sd->file = NULL; 222 sd->file = NULL;
223
215 free(sd->title); 224 free(sd->title);
216 sd->title = NULL; 225 sd->title = NULL;
217 free(sd->progress.info); 226 free(sd->progress.info);
@@ -229,11 +238,16 @@ emotion_object_init(Evas_Object *obj, const char *module_filename)
229 238
230 ecore_init(); 239 ecore_init();
231 240
232 if ((!sd->module) || (!sd->video)) 241 _emotion_module_close(sd->module, sd->video);
242 sd->module = NULL;
243 sd->video = NULL;
244 if (!_emotion_module_open(module_filename, obj, &sd->module, &sd->video))
245 return EINA_FALSE;
246
247 if (file)
233 { 248 {
234 if (!_emotion_module_open(module_filename, obj, 249 emotion_object_file_set(obj, file);
235 &sd->module, &sd->video)) 250 free(file);
236 return EINA_FALSE;
237 } 251 }
238 252
239 return EINA_TRUE; 253 return EINA_TRUE;
@@ -1304,6 +1318,7 @@ _smart_del(Evas_Object * obj)
1304 _emotion_module_close(sd->module, sd->video); 1318 _emotion_module_close(sd->module, sd->video);
1305 evas_object_del(sd->obj); 1319 evas_object_del(sd->obj);
1306 free(sd->file); 1320 free(sd->file);
1321 free(sd->module_name);
1307 if (sd->job) ecore_job_del(sd->job); 1322 if (sd->job) ecore_job_del(sd->job);
1308 free(sd->progress.info); 1323 free(sd->progress.info);
1309 free(sd->ref.file); 1324 free(sd->ref.file);