forked from enlightenment/efl
edje_edit: refactor eet file usage
Summary: Move opening for read/write/read-write and error message to internal method Reuse eet file from Edje instead of opening it again in read-only mode Add wrapper for eet_close to skip closing if internal file was used Reviewers: NikaWhite Subscribers: cedric, jpeg, #eflete Differential Revision: https://phab.enlightenment.org/D4353
This commit is contained in:
parent
a0cdbc9ec2
commit
6711a414dc
|
@ -165,6 +165,35 @@ _edje_edit_program_script_free(Program_Script *ps)
|
||||||
free(ps);
|
free(ps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Eet_File *
|
||||||
|
_edje_edit_eet_open(Edje *ed, Eet_File_Mode mode)
|
||||||
|
{
|
||||||
|
Eet_File *eetf;
|
||||||
|
|
||||||
|
switch (mode)
|
||||||
|
{
|
||||||
|
case EET_FILE_MODE_INVALID:
|
||||||
|
return NULL;
|
||||||
|
case EET_FILE_MODE_READ:
|
||||||
|
return ed->file->ef;
|
||||||
|
case EET_FILE_MODE_WRITE:
|
||||||
|
case EET_FILE_MODE_READ_WRITE:
|
||||||
|
eetf = eet_open(ed->path, mode);
|
||||||
|
if (!eetf)
|
||||||
|
ERR("Unable to open \"%s\" for writing output", ed->path);
|
||||||
|
return eetf;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_edje_edit_eet_close(Eet_File *ef)
|
||||||
|
{
|
||||||
|
Eet_File_Mode mode = eet_mode_get(ef);
|
||||||
|
if (mode != EET_FILE_MODE_READ)
|
||||||
|
eet_close(ef);
|
||||||
|
}
|
||||||
|
|
||||||
EOLIAN static Eina_Bool
|
EOLIAN static Eina_Bool
|
||||||
_edje_edit_efl_file_file_set(Eo *obj, Edje_Edit *eed, const char *file, const char *group)
|
_edje_edit_efl_file_file_set(Eo *obj, Edje_Edit *eed, const char *file, const char *group)
|
||||||
{
|
{
|
||||||
|
@ -206,9 +235,11 @@ _edje_edit_efl_file_file_set(Eo *obj, Edje_Edit *eed, const char *file, const ch
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GET_ED_OR_RETURN(EINA_FALSE);
|
||||||
|
|
||||||
eed->program_scripts = eina_hash_int32_new((Eina_Free_Cb)_edje_edit_program_script_free);
|
eed->program_scripts = eina_hash_int32_new((Eina_Free_Cb)_edje_edit_program_script_free);
|
||||||
|
|
||||||
ef = eet_open(file, EET_FILE_MODE_READ);
|
ef = _edje_edit_eet_open(ed, EET_FILE_MODE_READ);
|
||||||
efl_del(file_obj);
|
efl_del(file_obj);
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "edje/scripts/embryo/source/%i",
|
snprintf(buf, sizeof(buf), "edje/scripts/embryo/source/%i",
|
||||||
|
@ -233,7 +264,7 @@ _edje_edit_efl_file_file_set(Eo *obj, Edje_Edit *eed, const char *file, const ch
|
||||||
}
|
}
|
||||||
free(keys);
|
free(keys);
|
||||||
}
|
}
|
||||||
eet_close(ef);
|
_edje_edit_eet_close(ef);
|
||||||
|
|
||||||
ret = EINA_TRUE;
|
ret = EINA_TRUE;
|
||||||
|
|
||||||
|
@ -423,12 +454,9 @@ _edje_edit_file_import(Edje *ed, const char *path, const char *entry, int compre
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Write file data to edje file */
|
/* Write file data to edje file */
|
||||||
eetf = eet_open(ed->path, EET_FILE_MODE_READ_WRITE);
|
eetf = _edje_edit_eet_open(ed, EET_FILE_MODE_READ_WRITE);
|
||||||
if (!eetf)
|
if (!eetf)
|
||||||
{
|
|
||||||
ERR("Unable to open \"%s\" for writing output", ed->path);
|
|
||||||
goto on_error;
|
goto on_error;
|
||||||
}
|
|
||||||
|
|
||||||
if (eet_write(eetf, entry, fdata, fsize, compress) <= 0)
|
if (eet_write(eetf, entry, fdata, fsize, compress) <= 0)
|
||||||
{
|
{
|
||||||
|
@ -441,7 +469,7 @@ _edje_edit_file_import(Edje *ed, const char *path, const char *entry, int compre
|
||||||
if (!_edje_edit_edje_file_save(eetf, ed->file))
|
if (!_edje_edit_edje_file_save(eetf, ed->file))
|
||||||
goto on_error;
|
goto on_error;
|
||||||
|
|
||||||
eet_close(eetf);
|
_edje_edit_eet_close(eetf);
|
||||||
|
|
||||||
eina_file_map_free(f, fdata);
|
eina_file_map_free(f, fdata);
|
||||||
eina_file_close(f);
|
eina_file_close(f);
|
||||||
|
@ -449,7 +477,7 @@ _edje_edit_file_import(Edje *ed, const char *path, const char *entry, int compre
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
|
|
||||||
on_error:
|
on_error:
|
||||||
if (eetf) eet_close(eetf);
|
if (eetf) _edje_edit_eet_close(eetf);
|
||||||
eina_file_map_free(f, fdata);
|
eina_file_map_free(f, fdata);
|
||||||
eina_file_close(f);
|
eina_file_close(f);
|
||||||
|
|
||||||
|
@ -494,10 +522,9 @@ _edje_import_image_file(Edje *ed, const char *path, int id)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* open the eet file */
|
/* open the eet file */
|
||||||
eetf = eet_open(ed->path, EET_FILE_MODE_READ_WRITE);
|
eetf = _edje_edit_eet_open(ed, EET_FILE_MODE_READ_WRITE);
|
||||||
if (!eetf)
|
if (!eetf)
|
||||||
{
|
{
|
||||||
ERR("Unable to open \"%s\" for writing output", ed->path);
|
|
||||||
evas_object_del(im);
|
evas_object_del(im);
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
@ -513,7 +540,7 @@ _edje_import_image_file(Edje *ed, const char *path, int id)
|
||||||
{
|
{
|
||||||
ERR("Unable to write image part \"%s\" part entry to %s",
|
ERR("Unable to write image part \"%s\" part entry to %s",
|
||||||
entry, ed->path);
|
entry, ed->path);
|
||||||
eet_close(eetf);
|
_edje_edit_eet_close(eetf);
|
||||||
evas_object_del(im);
|
evas_object_del(im);
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
@ -524,11 +551,11 @@ _edje_import_image_file(Edje *ed, const char *path, int id)
|
||||||
if (!_edje_edit_edje_file_save(eetf, ed->file))
|
if (!_edje_edit_edje_file_save(eetf, ed->file))
|
||||||
{
|
{
|
||||||
eet_delete(eetf, entry);
|
eet_delete(eetf, entry);
|
||||||
eet_close(eetf);
|
_edje_edit_eet_close(eetf);
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
eet_close(eetf);
|
_edje_edit_eet_close(eetf);
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1243,19 +1270,16 @@ edje_edit_sound_sample_del(Evas_Object *obj, const char *name)
|
||||||
Eet_File *eetf;
|
Eet_File *eetf;
|
||||||
Edje_Sound_Sample *sound_sample_last;
|
Edje_Sound_Sample *sound_sample_last;
|
||||||
|
|
||||||
eetf = eet_open(ed->path, EET_FILE_MODE_READ_WRITE);
|
eetf = _edje_edit_eet_open(ed, EET_FILE_MODE_READ_WRITE);
|
||||||
if (!eetf)
|
if (!eetf)
|
||||||
{
|
|
||||||
WRN("Unable to open \"%s\" for writing output", ed->path);
|
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
|
||||||
|
|
||||||
snprintf(sample, sizeof(sample), "edje/sounds/%i", sound_sample->id);
|
snprintf(sample, sizeof(sample), "edje/sounds/%i", sound_sample->id);
|
||||||
|
|
||||||
if (eet_delete(eetf, sample) <= 0)
|
if (eet_delete(eetf, sample) <= 0)
|
||||||
{
|
{
|
||||||
WRN("Unable to delete \"%s\" sound", sample);
|
WRN("Unable to delete \"%s\" sound", sample);
|
||||||
eet_close(eetf);
|
_edje_edit_eet_close(eetf);
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1277,16 +1301,16 @@ edje_edit_sound_sample_del(Evas_Object *obj, const char *name)
|
||||||
|
|
||||||
if (!_delete_play_actions(obj, name, EDJE_ACTION_TYPE_SOUND_SAMPLE, eetf))
|
if (!_delete_play_actions(obj, name, EDJE_ACTION_TYPE_SOUND_SAMPLE, eetf))
|
||||||
{
|
{
|
||||||
eet_close(eetf);
|
_edje_edit_eet_close(eetf);
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_edje_edit_edje_file_save(eetf, ed->file))
|
if (!_edje_edit_edje_file_save(eetf, ed->file))
|
||||||
{
|
{
|
||||||
eet_close(eetf);
|
_edje_edit_eet_close(eetf);
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
eet_close(eetf);
|
_edje_edit_eet_close(eetf);
|
||||||
}
|
}
|
||||||
|
|
||||||
GET_EED_OR_RETURN(EINA_FALSE);
|
GET_EED_OR_RETURN(EINA_FALSE);
|
||||||
|
@ -1365,12 +1389,9 @@ edje_edit_sound_tone_del(Evas_Object *obj, const char *name)
|
||||||
{
|
{
|
||||||
Eet_File *eetf;
|
Eet_File *eetf;
|
||||||
|
|
||||||
eetf = eet_open(ed->path, EET_FILE_MODE_READ_WRITE);
|
eetf = _edje_edit_eet_open(ed, EET_FILE_MODE_READ_WRITE);
|
||||||
if (!eetf)
|
if (!eetf)
|
||||||
{
|
|
||||||
WRN("Unable to open file \"%s\" for writing output", ed->path);
|
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
|
||||||
|
|
||||||
_edje_if_string_free(ed, &sound_tone->name);
|
_edje_if_string_free(ed, &sound_tone->name);
|
||||||
--ed->file->sound_dir->tones_count;
|
--ed->file->sound_dir->tones_count;
|
||||||
|
@ -1390,16 +1411,16 @@ edje_edit_sound_tone_del(Evas_Object *obj, const char *name)
|
||||||
|
|
||||||
if (!_delete_play_actions(obj, name, EDJE_ACTION_TYPE_SOUND_TONE, eetf))
|
if (!_delete_play_actions(obj, name, EDJE_ACTION_TYPE_SOUND_TONE, eetf))
|
||||||
{
|
{
|
||||||
eet_close(eetf);
|
_edje_edit_eet_close(eetf);
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_edje_edit_edje_file_save(eetf, ed->file))
|
if (!_edje_edit_edje_file_save(eetf, ed->file))
|
||||||
{
|
{
|
||||||
eet_close(eetf);
|
_edje_edit_eet_close(eetf);
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
eet_close(eetf);
|
_edje_edit_eet_close(eetf);
|
||||||
}
|
}
|
||||||
|
|
||||||
GET_EED_OR_RETURN(EINA_FALSE);
|
GET_EED_OR_RETURN(EINA_FALSE);
|
||||||
|
@ -1562,21 +1583,18 @@ edje_edit_sound_samplebuffer_get(Evas_Object *obj, const char *sample_name)
|
||||||
sample = &ed->file->sound_dir->samples[i];
|
sample = &ed->file->sound_dir->samples[i];
|
||||||
if (!strcmp(sample->name, sample_name))
|
if (!strcmp(sample->name, sample_name))
|
||||||
{
|
{
|
||||||
ef = eet_mmap(ed->file->f);
|
ef = _edje_edit_eet_open(ed, EET_FILE_MODE_READ);
|
||||||
if (!ef)
|
if (!ef)
|
||||||
{
|
|
||||||
ERR("Cannot open edje file '%s' for samples", ed->path);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
snprintf(snd_id_str, sizeof(snd_id_str), "edje/sounds/%i", sample->id);
|
snprintf(snd_id_str, sizeof(snd_id_str), "edje/sounds/%i", sample->id);
|
||||||
data = eet_read_direct(ef, snd_id_str, &len);
|
data = eet_read_direct(ef, snd_id_str, &len);
|
||||||
if (len <= 0)
|
if (len <= 0)
|
||||||
{
|
{
|
||||||
ERR("Sample from edj file '%s' has 0 length", ed->path);
|
ERR("Sample from edj file '%s' has 0 length", ed->path);
|
||||||
eet_close(ef);
|
_edje_edit_eet_close(ef);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
eet_close(ef);
|
_edje_edit_eet_close(ef);
|
||||||
return eina_binbuf_manage_new(data, len, EINA_TRUE);
|
return eina_binbuf_manage_new(data, len, EINA_TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1684,18 +1702,15 @@ edje_edit_group_copy(Evas_Object *obj, const char *group_name, const char *copy_
|
||||||
if (eina_hash_find(ed->file->collection, copy_name))
|
if (eina_hash_find(ed->file->collection, copy_name))
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
|
|
||||||
eetf = eet_open(ed->file->path, EET_FILE_MODE_READ_WRITE);
|
eetf = _edje_edit_eet_open(ed, EET_FILE_MODE_READ_WRITE);
|
||||||
if (!eetf)
|
if (!eetf)
|
||||||
{
|
|
||||||
ERR("Edje_Edit: Error. unable to open \"%s\" "
|
|
||||||
"for writing output", ed->file->path);
|
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
|
||||||
snprintf(buf, sizeof(buf), "edje/collections/%d", e->id);
|
snprintf(buf, sizeof(buf), "edje/collections/%d", e->id);
|
||||||
epc = eet_data_read(eetf, _edje_edd_edje_part_collection, buf);
|
epc = eet_data_read(eetf, _edje_edd_edje_part_collection, buf);
|
||||||
if (!epc)
|
if (!epc)
|
||||||
{
|
{
|
||||||
eet_close(eetf);
|
_edje_edit_eet_close(eetf);
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1728,7 +1743,7 @@ edje_edit_group_copy(Evas_Object *obj, const char *group_name, const char *copy_
|
||||||
de = _alloc(sizeof(Edje_Part_Collection_Directory_Entry));
|
de = _alloc(sizeof(Edje_Part_Collection_Directory_Entry));
|
||||||
if (!de)
|
if (!de)
|
||||||
{
|
{
|
||||||
eet_close(eetf);
|
_edje_edit_eet_close(eetf);
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1778,7 +1793,7 @@ edje_edit_group_copy(Evas_Object *obj, const char *group_name, const char *copy_
|
||||||
save_status = _edje_edit_edje_file_save(eetf, ed->file);
|
save_status = _edje_edit_edje_file_save(eetf, ed->file);
|
||||||
|
|
||||||
_edje_collection_free(ed->file, epc, de);
|
_edje_collection_free(ed->file, epc, de);
|
||||||
eet_close(eetf);
|
_edje_edit_eet_close(eetf);
|
||||||
|
|
||||||
return save_status;
|
return save_status;
|
||||||
}
|
}
|
||||||
|
@ -1897,13 +1912,10 @@ edje_edit_group_del(Evas_Object *obj, const char *group_name)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Remove collection/id from eet file */
|
/* Remove collection/id from eet file */
|
||||||
eetf = eet_open(ed->file->path, EET_FILE_MODE_READ_WRITE);
|
eetf = _edje_edit_eet_open(ed, EET_FILE_MODE_READ_WRITE);
|
||||||
if (!eetf)
|
if (!eetf)
|
||||||
{
|
|
||||||
ERR("Edje_Edit: Error. unable to open \"%s\" "
|
|
||||||
"for writing output", ed->file->path);
|
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
|
||||||
snprintf(buf, sizeof(buf), "edje/collections/%d", e->id);
|
snprintf(buf, sizeof(buf), "edje/collections/%d", e->id);
|
||||||
eet_delete(eetf, buf);
|
eet_delete(eetf, buf);
|
||||||
snprintf(buf, sizeof(buf), "edje/scripts/embryo/compiled/%d", e->id);
|
snprintf(buf, sizeof(buf), "edje/scripts/embryo/compiled/%d", e->id);
|
||||||
|
@ -1922,7 +1934,7 @@ edje_edit_group_del(Evas_Object *obj, const char *group_name)
|
||||||
while (count);
|
while (count);
|
||||||
free(keys);
|
free(keys);
|
||||||
}
|
}
|
||||||
eet_close(eetf);
|
_edje_edit_eet_close(eetf);
|
||||||
|
|
||||||
l = NULL; g = NULL;
|
l = NULL; g = NULL;
|
||||||
/* Free Group and all it's Aliases */
|
/* Free Group and all it's Aliases */
|
||||||
|
@ -8639,29 +8651,26 @@ edje_edit_font_del(Evas_Object *obj, const char *alias)
|
||||||
Eet_File *eetf;
|
Eet_File *eetf;
|
||||||
|
|
||||||
/* open the eet file */
|
/* open the eet file */
|
||||||
eetf = eet_open(ed->path, EET_FILE_MODE_READ_WRITE);
|
eetf = _edje_edit_eet_open(ed, EET_FILE_MODE_READ_WRITE);
|
||||||
if (!eetf)
|
if (!eetf)
|
||||||
{
|
|
||||||
ERR("Unable to open \"%s\" for writing output", ed->path);
|
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
|
||||||
|
|
||||||
snprintf(entry, sizeof(entry), "edje/fonts/%s", alias);
|
snprintf(entry, sizeof(entry), "edje/fonts/%s", alias);
|
||||||
|
|
||||||
if (eet_delete(eetf, entry) <= 0)
|
if (eet_delete(eetf, entry) <= 0)
|
||||||
{
|
{
|
||||||
ERR("Unable to delete \"%s\" font entry", entry);
|
ERR("Unable to delete \"%s\" font entry", entry);
|
||||||
eet_close(eetf);
|
_edje_edit_eet_close(eetf);
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* write the edje_file */
|
/* write the edje_file */
|
||||||
if (!_edje_edit_edje_file_save(eetf, ed->file))
|
if (!_edje_edit_edje_file_save(eetf, ed->file))
|
||||||
{
|
{
|
||||||
eet_close(eetf);
|
_edje_edit_eet_close(eetf);
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
eet_close(eetf);
|
_edje_edit_eet_close(eetf);
|
||||||
}
|
}
|
||||||
|
|
||||||
eina_hash_del(ed->file->fonts, alias, fnt);
|
eina_hash_del(ed->file->fonts, alias, fnt);
|
||||||
|
@ -9292,12 +9301,9 @@ edje_edit_image_set_del(Evas_Object *obj, const char *name)
|
||||||
--ed->file->image_dir->sets_count;
|
--ed->file->image_dir->sets_count;
|
||||||
|
|
||||||
/* open the eet file */
|
/* open the eet file */
|
||||||
eetf = eet_open(ed->path, EET_FILE_MODE_READ_WRITE);
|
eetf = _edje_edit_eet_open(ed, EET_FILE_MODE_READ_WRITE);
|
||||||
if (!eetf)
|
if (!eetf)
|
||||||
{
|
|
||||||
ERR("Unable to open \"%s\" for writing output", ed->path);
|
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
|
||||||
|
|
||||||
if (de_last->id != de->id)
|
if (de_last->id != de->id)
|
||||||
{
|
{
|
||||||
|
@ -9335,7 +9341,7 @@ edje_edit_image_set_del(Evas_Object *obj, const char *name)
|
||||||
}
|
}
|
||||||
if (!_edje_edit_collection_save(eetf, pce->ref))
|
if (!_edje_edit_collection_save(eetf, pce->ref))
|
||||||
{
|
{
|
||||||
eet_close(eetf);
|
_edje_edit_eet_close(eetf);
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9345,7 +9351,7 @@ edje_edit_image_set_del(Evas_Object *obj, const char *name)
|
||||||
sizeof(Edje_Image_Directory_Set_Entry) *
|
sizeof(Edje_Image_Directory_Set_Entry) *
|
||||||
ed->file->image_dir->sets_count);
|
ed->file->image_dir->sets_count);
|
||||||
|
|
||||||
eet_close(eetf);
|
_edje_edit_eet_close(eetf);
|
||||||
|
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
@ -9720,10 +9726,9 @@ edje_edit_image_replace(Evas_Object *obj, const char *name, const char *new_name
|
||||||
it = eina_hash_iterator_data_new(ed->file->collection);
|
it = eina_hash_iterator_data_new(ed->file->collection);
|
||||||
|
|
||||||
/* open the eet file */
|
/* open the eet file */
|
||||||
eetf = eet_open(ed->path, EET_FILE_MODE_READ_WRITE);
|
eetf = _edje_edit_eet_open(ed, EET_FILE_MODE_READ_WRITE);
|
||||||
if (!eetf)
|
if (!eetf)
|
||||||
{
|
{
|
||||||
ERR("Unable to open \"%s\" for writing output", ed->path);
|
|
||||||
eina_iterator_free(it);
|
eina_iterator_free(it);
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
@ -9753,7 +9758,7 @@ edje_edit_image_replace(Evas_Object *obj, const char *name, const char *new_name
|
||||||
}
|
}
|
||||||
if (!_edje_edit_collection_save(eetf, pce->ref))
|
if (!_edje_edit_collection_save(eetf, pce->ref))
|
||||||
{
|
{
|
||||||
eet_close(eetf);
|
_edje_edit_eet_close(eetf);
|
||||||
eina_iterator_free(it);
|
eina_iterator_free(it);
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
@ -9761,7 +9766,7 @@ edje_edit_image_replace(Evas_Object *obj, const char *name, const char *new_name
|
||||||
}
|
}
|
||||||
eina_iterator_free(it);
|
eina_iterator_free(it);
|
||||||
|
|
||||||
eet_close(eetf);
|
_edje_edit_eet_close(eetf);
|
||||||
|
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
@ -9958,19 +9963,16 @@ edje_edit_image_del(Evas_Object *obj, const char *name)
|
||||||
int size = 0;
|
int size = 0;
|
||||||
|
|
||||||
/* open the eet file */
|
/* open the eet file */
|
||||||
eetf = eet_open(ed->path, EET_FILE_MODE_READ_WRITE);
|
eetf = _edje_edit_eet_open(ed, EET_FILE_MODE_READ_WRITE);
|
||||||
if (!eetf)
|
if (!eetf)
|
||||||
{
|
|
||||||
ERR("Unable to open \"%s\" for writing output", ed->path);
|
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
|
||||||
|
|
||||||
snprintf(entry, sizeof(entry), "edje/images/%i", de->id);
|
snprintf(entry, sizeof(entry), "edje/images/%i", de->id);
|
||||||
|
|
||||||
if (eet_delete(eetf, entry) <= 0)
|
if (eet_delete(eetf, entry) <= 0)
|
||||||
{
|
{
|
||||||
ERR("Unable to delete \"%s\" font entry", entry);
|
ERR("Unable to delete \"%s\" font entry", entry);
|
||||||
eet_close(eetf);
|
_edje_edit_eet_close(eetf);
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
if (de_last->id != de->id)
|
if (de_last->id != de->id)
|
||||||
|
@ -10020,7 +10022,7 @@ edje_edit_image_del(Evas_Object *obj, const char *name)
|
||||||
}
|
}
|
||||||
if (!_edje_edit_collection_save(eetf, pce->ref))
|
if (!_edje_edit_collection_save(eetf, pce->ref))
|
||||||
{
|
{
|
||||||
eet_close(eetf);
|
_edje_edit_eet_close(eetf);
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10032,11 +10034,11 @@ edje_edit_image_del(Evas_Object *obj, const char *name)
|
||||||
/* write the edje_file */
|
/* write the edje_file */
|
||||||
if (!_edje_edit_edje_file_save(eetf, ed->file))
|
if (!_edje_edit_edje_file_save(eetf, ed->file))
|
||||||
{
|
{
|
||||||
eet_close(eetf);
|
_edje_edit_eet_close(eetf);
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
eet_close(eetf);
|
_edje_edit_eet_close(eetf);
|
||||||
}
|
}
|
||||||
_edje_edit_flag_script_dirty(eed, EINA_TRUE);
|
_edje_edit_flag_script_dirty(eed, EINA_TRUE);
|
||||||
|
|
||||||
|
@ -15533,7 +15535,7 @@ _edje_generate_source_of_group(Edje *ed, Edje_Part_Collection_Directory_Entry *p
|
||||||
obj = edje_edit_object_add(ed->base->evas);
|
obj = edje_edit_object_add(ed->base->evas);
|
||||||
if (!edje_object_file_set(obj, ed->file->path, group)) return EINA_FALSE;
|
if (!edje_object_file_set(obj, ed->file->path, group)) return EINA_FALSE;
|
||||||
|
|
||||||
ef = eet_open(ed->file->path, EET_FILE_MODE_READ);
|
ef = _edje_edit_eet_open(ed, EET_FILE_MODE_READ);
|
||||||
if (!ef)
|
if (!ef)
|
||||||
{
|
{
|
||||||
evas_object_del(obj);
|
evas_object_del(obj);
|
||||||
|
@ -15654,7 +15656,7 @@ _edje_generate_source_of_group(Edje *ed, Edje_Part_Collection_Directory_Entry *p
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
eet_close(ef);
|
_edje_edit_eet_close(ef);
|
||||||
evas_object_del(obj);
|
evas_object_del(obj);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -16053,13 +16055,9 @@ _edje_edit_internal_save(Evas_Object *obj, int current_only, Eina_Bool generate_
|
||||||
INF("** path: %s", ef->path);
|
INF("** path: %s", ef->path);
|
||||||
|
|
||||||
/* Open the eet file */
|
/* Open the eet file */
|
||||||
eetf = eet_open(ef->path, EET_FILE_MODE_READ_WRITE);
|
eetf = _edje_edit_eet_open(ed, EET_FILE_MODE_READ_WRITE);
|
||||||
if (!eetf)
|
if (!eetf)
|
||||||
{
|
|
||||||
ERR("Error. unable to open \"%s\" for writing output",
|
|
||||||
ef->path);
|
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
|
||||||
|
|
||||||
/* Set compiler name */
|
/* Set compiler name */
|
||||||
if (strcmp(ef->compiler, "edje_edit"))
|
if (strcmp(ef->compiler, "edje_edit"))
|
||||||
|
@ -16067,7 +16065,7 @@ _edje_edit_internal_save(Evas_Object *obj, int current_only, Eina_Bool generate_
|
||||||
|
|
||||||
if (!_edje_edit_edje_file_save(eetf, ef))
|
if (!_edje_edit_edje_file_save(eetf, ef))
|
||||||
{
|
{
|
||||||
eet_close(eetf);
|
_edje_edit_eet_close(eetf);
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16079,7 +16077,7 @@ _edje_edit_internal_save(Evas_Object *obj, int current_only, Eina_Bool generate_
|
||||||
"[id: %d]", ed->collection->id);
|
"[id: %d]", ed->collection->id);
|
||||||
if (!_edje_edit_collection_save(eetf, ed->collection))
|
if (!_edje_edit_collection_save(eetf, ed->collection))
|
||||||
{
|
{
|
||||||
eet_close(eetf);
|
_edje_edit_eet_close(eetf);
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16099,7 +16097,7 @@ _edje_edit_internal_save(Evas_Object *obj, int current_only, Eina_Bool generate_
|
||||||
"[id: %d]", edc->id);
|
"[id: %d]", edc->id);
|
||||||
if (!_edje_edit_collection_save(eetf, edc))
|
if (!_edje_edit_collection_save(eetf, edc))
|
||||||
{
|
{
|
||||||
eet_close(eetf);
|
_edje_edit_eet_close(eetf);
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16113,7 +16111,7 @@ _edje_edit_internal_save(Evas_Object *obj, int current_only, Eina_Bool generate_
|
||||||
"[id: %d]", ce->id);
|
"[id: %d]", ce->id);
|
||||||
if (!_edje_edit_collection_save(eetf, ce->ref))
|
if (!_edje_edit_collection_save(eetf, ce->ref))
|
||||||
{
|
{
|
||||||
eet_close(eetf);
|
_edje_edit_eet_close(eetf);
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16175,11 +16173,11 @@ _edje_edit_internal_save(Evas_Object *obj, int current_only, Eina_Bool generate_
|
||||||
if (generate_source)
|
if (generate_source)
|
||||||
if (!_edje_edit_source_save(eetf, obj))
|
if (!_edje_edit_source_save(eetf, obj))
|
||||||
{
|
{
|
||||||
eet_close(eetf);
|
_edje_edit_eet_close(eetf);
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
eet_close(eetf);
|
_edje_edit_eet_close(eetf);
|
||||||
|
|
||||||
/* Update mtime */
|
/* Update mtime */
|
||||||
{
|
{
|
||||||
|
@ -16208,26 +16206,22 @@ edje_edit_clean_save_as(Evas_Object *obj, const char *new_file_name)
|
||||||
new_file_name);
|
new_file_name);
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
ef = eet_open(ed->file->path, EET_FILE_MODE_READ);
|
ef = _edje_edit_eet_open(ed, EET_FILE_MODE_READ);
|
||||||
if (!ef)
|
if (!ef)
|
||||||
{
|
|
||||||
ERR("Error. unable to open \"%s\" for reading",
|
|
||||||
ed->file->path);
|
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
|
||||||
ef_out = eet_open(new_file_name, EET_FILE_MODE_WRITE);
|
ef_out = eet_open(new_file_name, EET_FILE_MODE_WRITE);
|
||||||
if (!ef_out)
|
if (!ef_out)
|
||||||
{
|
{
|
||||||
ERR("Error. unable to open \"%s\" for writing output",
|
ERR("Error. unable to open \"%s\" for writing output",
|
||||||
new_file_name);
|
new_file_name);
|
||||||
eet_close(ef);
|
_edje_edit_eet_close(ef);
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* copying file structure */
|
/* copying file structure */
|
||||||
if (!_edje_edit_edje_file_save(ef_out, ed->file))
|
if (!_edje_edit_edje_file_save(ef_out, ed->file))
|
||||||
{
|
{
|
||||||
eet_close(ef);
|
_edje_edit_eet_close(ef);
|
||||||
eet_close(ef_out);
|
eet_close(ef_out);
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
@ -16277,7 +16271,7 @@ edje_edit_clean_save_as(Evas_Object *obj, const char *new_file_name)
|
||||||
/* generating source code */
|
/* generating source code */
|
||||||
_edje_edit_source_save(ef_out, obj);
|
_edje_edit_source_save(ef_out, obj);
|
||||||
|
|
||||||
eet_close(ef);
|
_edje_edit_eet_close(ef);
|
||||||
eet_close(ef_out);
|
eet_close(ef_out);
|
||||||
|
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
|
@ -16315,10 +16309,9 @@ edje_edit_without_source_save(Evas_Object *obj, Eina_Bool current_group)
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
sfl->list = NULL;
|
sfl->list = NULL;
|
||||||
eetf = eet_open(ed->file->path, EET_FILE_MODE_READ_WRITE);
|
eetf = _edje_edit_eet_open(ed, EET_FILE_MODE_READ_WRITE);
|
||||||
if (!eetf)
|
if (!eetf)
|
||||||
{
|
{
|
||||||
ERR("Error. Unable to open \"%s\" for cleaning source", ed->file->path);
|
|
||||||
free(sfl);
|
free(sfl);
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
@ -16327,12 +16320,12 @@ edje_edit_without_source_save(Evas_Object *obj, Eina_Bool current_group)
|
||||||
{
|
{
|
||||||
ERR("Unable to clean edc source from edj file");
|
ERR("Unable to clean edc source from edj file");
|
||||||
free(sfl);
|
free(sfl);
|
||||||
eet_close(eetf);
|
_edje_edit_eet_close(eetf);
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
free(sfl);
|
free(sfl);
|
||||||
eet_close(eetf);
|
_edje_edit_eet_close(eetf);
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue