From: Carsten Haitzler (Rasterman) Date: Mon, 9 May 2016 10:37:48 +0000 (+0900) Subject: edje - file set - use vpath for edje files now too like evas images X-Git-Tag: upstream/1.20.0~6427 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=90e8ad8d7dec453fa0037792cb6e2e04bdeadc8b;p=platform%2Fupstream%2Fefl.git edje - file set - use vpath for edje files now too like evas images --- diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c index da63dd7..bd5552a 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 * (GROUP parts or BOX/TABLE items pointing to non-existent/renamed * groups). */ + Efl_Vpath_File *file_obj = + efl_vpath_manager_fetch(EFL_VPATH_MANAGER_CLASS, file); + efl_vpath_file_do(file_obj); + // XXX:FIXME: allow this to be async + efl_vpath_file_wait(file_obj); + file = efl_vpath_file_result_get(file_obj); + Eina_Bool int_ret = EINA_FALSE; int_ret = efl_file_set(eo_super(obj, MY_CLASS), file, group); if (!int_ret) - return ret; + { + eo_del(file_obj); + return ret; + } eed->program_scripts = eina_hash_int32_new((Eina_Free_Cb)_edje_edit_program_script_free); ef = eet_open(file, EET_FILE_MODE_READ); + eo_del(file_obj); snprintf(buf, sizeof(buf), "edje/scripts/embryo/source/%i", eed->base->collection->id); diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c index e73007f..af9e7ce 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) Eina_List *lst; if ((!file) || (!*file)) return NULL; + Efl_Vpath_File *file_obj = + efl_vpath_manager_fetch(EFL_VPATH_MANAGER_CLASS, file); + efl_vpath_file_do(file_obj); + // XXX:FIXME: allow this to be async + efl_vpath_file_wait(file_obj); + file = efl_vpath_file_result_get(file_obj); f = eina_file_open(file, EINA_FALSE); lst = edje_mmap_collection_list(f); eina_file_close(f); + eo_del(file_obj); return lst; } @@ -1412,11 +1419,6 @@ _edje_file_add(Edje *ed, const Eina_File *f) ed->file = NULL; } } - else - { - // FIXME: it will be actually better to remove ed->path. - ed->path = eina_stringshare_add(eina_file_filename_get(f)); - } } static int diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h index c70f282..92148e8 100644 --- a/src/lib/edje/edje_private.h +++ b/src/lib/edje/edje_private.h @@ -1660,6 +1660,8 @@ struct _Edje double duration_scale; + Efl_Vpath_File *file_obj; + Eina_List *user_defined; lua_State *L; diff --git a/src/lib/edje/edje_smart.c b/src/lib/edje/edje_smart.c index 2e905bf..ebfcf0c 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) EOLIAN static void _edje_object_eo_base_destructor(Eo *obj, Edje *class_data) { + if (class_data->file_obj) + { + eo_del(class_data->file_obj); + class_data->file_obj = NULL; + } eo_destructor(eo_super(obj, MY_CLASS)); eo_data_unref(obj, class_data->base); } @@ -359,11 +364,28 @@ _edje_object_efl_file_file_set(Eo *obj, Edje *ed, const char *file, const char * ret = EINA_FALSE; + if (ed->file_obj) + { + eo_del(ed->file_obj); + ed->file_obj = NULL; + } if (file) { - f = eina_file_open(file, EINA_FALSE); + const char *file2; + + ed->file_obj = efl_vpath_manager_fetch(EFL_VPATH_MANAGER_CLASS, file); + efl_vpath_file_do(ed->file_obj); + // XXX:FIXME: allow this to be async + efl_vpath_file_wait(ed->file_obj); + file2 = efl_vpath_file_result_get(ed->file_obj); + + f = eina_file_open(file2, EINA_FALSE); if (!f) { + eo_del(ed->file_obj); + ed->file_obj = NULL; + if (ed->path) eina_stringshare_del(ed->path); + ed->path = NULL; ed->load_error = EDJE_LOAD_ERROR_DOES_NOT_EXIST; return ret; } @@ -371,7 +393,23 @@ _edje_object_efl_file_file_set(Eo *obj, Edje *ed, const char *file, const char * nested = eina_array_new(8); if (_edje_object_file_set_internal(obj, f, group, NULL, NULL, nested)) - ret = EINA_TRUE; + { + if (file) + { + ed->path = eina_stringshare_add(file); + } + else + { + if (ed->path) eina_stringshare_del(ed->path); + ed->path = NULL; + } + ret = EINA_TRUE; + } + else + { + if (ed->path) eina_stringshare_del(ed->path); + ed->path = NULL; + } eina_array_free(nested); eina_file_close(f);