summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2016-05-09 19:37:48 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2016-05-09 19:37:48 +0900
commit90e8ad8d7dec453fa0037792cb6e2e04bdeadc8b (patch)
treedb34c05ef4bb320f85a9c6337dd1b88b8a5c56f7 /src
parentb39d869b7a6fc80a33ec6ec531efab68097e7c7a (diff)
edje - file set - use vpath for edje files now too like evas images
Diffstat (limited to 'src')
-rw-r--r--src/lib/edje/edje_edit.c13
-rw-r--r--src/lib/edje/edje_load.c12
-rw-r--r--src/lib/edje/edje_private.h2
-rw-r--r--src/lib/edje/edje_smart.c42
4 files changed, 61 insertions, 8 deletions
diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c
index da63dd7a9f..bd5552a0e3 100644
--- a/src/lib/edje/edje_edit.c
+++ b/src/lib/edje/edje_edit.c
@@ -189,14 +189,25 @@ _edje_edit_efl_file_file_set(Eo *obj, Edje_Edit *eed, const char *file, const ch
189 * (GROUP parts or BOX/TABLE items pointing to non-existent/renamed 189 * (GROUP parts or BOX/TABLE items pointing to non-existent/renamed
190 * groups). 190 * groups).
191 */ 191 */
192 Efl_Vpath_File *file_obj =
193 efl_vpath_manager_fetch(EFL_VPATH_MANAGER_CLASS, file);
194 efl_vpath_file_do(file_obj);
195 // XXX:FIXME: allow this to be async
196 efl_vpath_file_wait(file_obj);
197 file = efl_vpath_file_result_get(file_obj);
198
192 Eina_Bool int_ret = EINA_FALSE; 199 Eina_Bool int_ret = EINA_FALSE;
193 int_ret = efl_file_set(eo_super(obj, MY_CLASS), file, group); 200 int_ret = efl_file_set(eo_super(obj, MY_CLASS), file, group);
194 if (!int_ret) 201 if (!int_ret)
195 return ret; 202 {
203 eo_del(file_obj);
204 return ret;
205 }
196 206
197 eed->program_scripts = eina_hash_int32_new((Eina_Free_Cb)_edje_edit_program_script_free); 207 eed->program_scripts = eina_hash_int32_new((Eina_Free_Cb)_edje_edit_program_script_free);
198 208
199 ef = eet_open(file, EET_FILE_MODE_READ); 209 ef = eet_open(file, EET_FILE_MODE_READ);
210 eo_del(file_obj);
200 211
201 snprintf(buf, sizeof(buf), "edje/scripts/embryo/source/%i", 212 snprintf(buf, sizeof(buf), "edje/scripts/embryo/source/%i",
202 eed->base->collection->id); 213 eed->base->collection->id);
diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c
index e73007f3d4..af9e7cefed 100644
--- a/src/lib/edje/edje_load.c
+++ b/src/lib/edje/edje_load.c
@@ -246,11 +246,18 @@ edje_file_collection_list(const char *file)
246 Eina_List *lst; 246 Eina_List *lst;
247 247
248 if ((!file) || (!*file)) return NULL; 248 if ((!file) || (!*file)) return NULL;
249 Efl_Vpath_File *file_obj =
250 efl_vpath_manager_fetch(EFL_VPATH_MANAGER_CLASS, file);
251 efl_vpath_file_do(file_obj);
252 // XXX:FIXME: allow this to be async
253 efl_vpath_file_wait(file_obj);
254 file = efl_vpath_file_result_get(file_obj);
249 f = eina_file_open(file, EINA_FALSE); 255 f = eina_file_open(file, EINA_FALSE);
250 256
251 lst = edje_mmap_collection_list(f); 257 lst = edje_mmap_collection_list(f);
252 258
253 eina_file_close(f); 259 eina_file_close(f);
260 eo_del(file_obj);
254 return lst; 261 return lst;
255} 262}
256 263
@@ -1412,11 +1419,6 @@ _edje_file_add(Edje *ed, const Eina_File *f)
1412 ed->file = NULL; 1419 ed->file = NULL;
1413 } 1420 }
1414 } 1421 }
1415 else
1416 {
1417 // FIXME: it will be actually better to remove ed->path.
1418 ed->path = eina_stringshare_add(eina_file_filename_get(f));
1419 }
1420} 1422}
1421 1423
1422static int 1424static int
diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h
index c70f282eb4..92148e8d50 100644
--- a/src/lib/edje/edje_private.h
+++ b/src/lib/edje/edje_private.h
@@ -1660,6 +1660,8 @@ struct _Edje
1660 1660
1661 double duration_scale; 1661 double duration_scale;
1662 1662
1663 Efl_Vpath_File *file_obj;
1664
1663 Eina_List *user_defined; 1665 Eina_List *user_defined;
1664 1666
1665 lua_State *L; 1667 lua_State *L;
diff --git a/src/lib/edje/edje_smart.c b/src/lib/edje/edje_smart.c
index 2e905bf2ac..ebfcf0cf23 100644
--- a/src/lib/edje/edje_smart.c
+++ b/src/lib/edje/edje_smart.c
@@ -50,6 +50,11 @@ _edje_object_eo_base_constructor(Eo *obj, Edje *ed)
50EOLIAN static void 50EOLIAN static void
51_edje_object_eo_base_destructor(Eo *obj, Edje *class_data) 51_edje_object_eo_base_destructor(Eo *obj, Edje *class_data)
52{ 52{
53 if (class_data->file_obj)
54 {
55 eo_del(class_data->file_obj);
56 class_data->file_obj = NULL;
57 }
53 eo_destructor(eo_super(obj, MY_CLASS)); 58 eo_destructor(eo_super(obj, MY_CLASS));
54 eo_data_unref(obj, class_data->base); 59 eo_data_unref(obj, class_data->base);
55} 60}
@@ -359,11 +364,28 @@ _edje_object_efl_file_file_set(Eo *obj, Edje *ed, const char *file, const char *
359 364
360 ret = EINA_FALSE; 365 ret = EINA_FALSE;
361 366
367 if (ed->file_obj)
368 {
369 eo_del(ed->file_obj);
370 ed->file_obj = NULL;
371 }
362 if (file) 372 if (file)
363 { 373 {
364 f = eina_file_open(file, EINA_FALSE); 374 const char *file2;
375
376 ed->file_obj = efl_vpath_manager_fetch(EFL_VPATH_MANAGER_CLASS, file);
377 efl_vpath_file_do(ed->file_obj);
378 // XXX:FIXME: allow this to be async
379 efl_vpath_file_wait(ed->file_obj);
380 file2 = efl_vpath_file_result_get(ed->file_obj);
381
382 f = eina_file_open(file2, EINA_FALSE);
365 if (!f) 383 if (!f)
366 { 384 {
385 eo_del(ed->file_obj);
386 ed->file_obj = NULL;
387 if (ed->path) eina_stringshare_del(ed->path);
388 ed->path = NULL;
367 ed->load_error = EDJE_LOAD_ERROR_DOES_NOT_EXIST; 389 ed->load_error = EDJE_LOAD_ERROR_DOES_NOT_EXIST;
368 return ret; 390 return ret;
369 } 391 }
@@ -371,7 +393,23 @@ _edje_object_efl_file_file_set(Eo *obj, Edje *ed, const char *file, const char *
371 nested = eina_array_new(8); 393 nested = eina_array_new(8);
372 394
373 if (_edje_object_file_set_internal(obj, f, group, NULL, NULL, nested)) 395 if (_edje_object_file_set_internal(obj, f, group, NULL, NULL, nested))
374 ret = EINA_TRUE; 396 {
397 if (file)
398 {
399 ed->path = eina_stringshare_add(file);
400 }
401 else
402 {
403 if (ed->path) eina_stringshare_del(ed->path);
404 ed->path = NULL;
405 }
406 ret = EINA_TRUE;
407 }
408 else
409 {
410 if (ed->path) eina_stringshare_del(ed->path);
411 ed->path = NULL;
412 }
375 413
376 eina_array_free(nested); 414 eina_array_free(nested);
377 eina_file_close(f); 415 eina_file_close(f);