edje: Edje_Edit - add edje_edit_without_source save function.
Summary: Add function, which provide fast save group(s) back into edj file, bypassing the source code generation. Reviewers: raster, seoz, cedric, Hermet, reutskiy.v.v CC: cedric, reutskiy.v.v Differential Revision: https://phab.enlightenment.org/D1053 Signed-off-by: Cedric BAIL <c.bail@partner.samsung.com>
This commit is contained in:
parent
7d381a01ef
commit
e7550e7bbf
|
@ -197,6 +197,28 @@ EAPI Eina_Bool edje_edit_save(Evas_Object *obj);
|
|||
*/
|
||||
EAPI Eina_Bool edje_edit_save_all(Evas_Object *obj);
|
||||
|
||||
/** Save the group(s) back to the file, without generation source code.
|
||||
*
|
||||
* This function saves changes in group(s) back into the edj file. Process of
|
||||
* saving takes a bit time in compare with @edje_edit_save and @edje_edit_save_all,
|
||||
* because this function DOES NOT generate source code for groups.
|
||||
*
|
||||
* @note With using this function all source code will be erased. And DOES NOT
|
||||
* generated new code. In attempt to decompile edj file, wich was saved with
|
||||
* using this functions will unpacked only resources(like fonts, images, sounds).
|
||||
* If needed saving source code into file, please use @edje_edit_save or
|
||||
* @edje_edit_save_all.
|
||||
|
||||
* @param obj Object to save back to the file it was loaded from.
|
||||
* @param current_group EINA_TRUE if needed save only group which loaded with obj,
|
||||
* or EINA_FALSE for save all groups, which exists in edj file.
|
||||
*
|
||||
* @return EINA_TRUE if successful, EINA_FALSE otherwise.
|
||||
*
|
||||
*/
|
||||
EAPI Eina_Bool
|
||||
edje_edit_without_source_save(Evas_Object *obj, Eina_Bool current_group);
|
||||
|
||||
/** Print on standard output many information about the internal status
|
||||
* of the edje object.
|
||||
*
|
||||
|
|
|
@ -10132,7 +10132,7 @@ save_free_source:
|
|||
}
|
||||
|
||||
Eina_Bool
|
||||
_edje_edit_internal_save(Evas_Object *obj, int current_only)
|
||||
_edje_edit_internal_save(Evas_Object *obj, int current_only, Eina_Bool generate_source)
|
||||
{
|
||||
Edje_File *ef;
|
||||
Eet_File *eetf;
|
||||
|
@ -10269,10 +10269,11 @@ _edje_edit_internal_save(Evas_Object *obj, int current_only)
|
|||
eina_hash_del(eed->program_scripts, &ps->id, ps);
|
||||
}
|
||||
|
||||
if (!_edje_edit_source_save(eetf, obj))
|
||||
{
|
||||
eet_close(eetf);
|
||||
return EINA_FALSE;
|
||||
if (generate_source)
|
||||
if (!_edje_edit_source_save(eetf, obj))
|
||||
{
|
||||
eet_close(eetf);
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
eet_close(eetf);
|
||||
|
@ -10292,13 +10293,54 @@ _edje_edit_internal_save(Evas_Object *obj, int current_only)
|
|||
EAPI Eina_Bool
|
||||
edje_edit_save(Evas_Object *obj)
|
||||
{
|
||||
return _edje_edit_internal_save(obj, 1);
|
||||
return _edje_edit_internal_save(obj, 1, EINA_TRUE);
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
edje_edit_save_all(Evas_Object *obj)
|
||||
{
|
||||
return _edje_edit_internal_save(obj, 0);
|
||||
return _edje_edit_internal_save(obj, 0, EINA_TRUE);
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
edje_edit_without_source_save(Evas_Object *obj, Eina_Bool current_group)
|
||||
{
|
||||
GET_ED_OR_RETURN(EINA_FALSE);
|
||||
Eet_File *eetf = NULL;
|
||||
SrcFile_List *sfl = NULL;
|
||||
|
||||
if (!_edje_edit_internal_save(obj, current_group, EINA_FALSE))
|
||||
{
|
||||
ERR("Unable save binary data into file");
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
sfl = _alloc(sizeof(SrcFile_List));
|
||||
if (!sfl)
|
||||
{
|
||||
ERR("Unable to create file list");
|
||||
return EINA_FALSE;
|
||||
}
|
||||
sfl->list = NULL;
|
||||
eetf = eet_open(ed->file->path, EET_FILE_MODE_READ_WRITE);
|
||||
if (!eetf)
|
||||
{
|
||||
ERR("Error. Unable to open \"%s\" for cleaning source", ed->file->path);
|
||||
free(sfl);
|
||||
return EINA_FALSE;
|
||||
}
|
||||
source_edd();
|
||||
if (eet_data_write(eetf, _srcfile_list_edd, "edje_sources", sfl, 1) <= 0)
|
||||
{
|
||||
ERR("Unable to clean edc source from edj file");
|
||||
free(sfl);
|
||||
eet_close(eetf);
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
free(sfl);
|
||||
eet_close(eetf);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
|
|
Loading…
Reference in New Issue