edje - file set - use vpath for edje files now too like evas images

This commit is contained in:
Carsten Haitzler 2016-05-09 19:37:48 +09:00
parent b39d869b7a
commit 90e8ad8d7d
4 changed files with 61 additions and 8 deletions

View File

@ -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);

View File

@ -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

View File

@ -1660,6 +1660,8 @@ struct _Edje
double duration_scale;
Efl_Vpath_File *file_obj;
Eina_List *user_defined;
lua_State *L;

View File

@ -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);