entry: move a point to do 'auto_save' to another place

Summary:
By reworking on efl_file, logic flow for entry has been changed.
and it causes autosave making a file that is passed to elm_entry_file_set empty.

Test Plan:
1. call elm_entry_file_set for a file.
2. check the file is not empty after calling the function.

Reviewers: zmike, bu5hm4n

Reviewed By: zmike

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D8362
This commit is contained in:
Wonki Kim 2019-03-27 10:18:33 -04:00 committed by Mike Blumenkrantz
parent 9367dcc755
commit 8e8aa74751
1 changed files with 5 additions and 4 deletions

View File

@ -284,7 +284,7 @@ _save_do(Evas_Object *obj)
{
ELM_ENTRY_DATA_GET(obj, sd);
if (!sd->file) return;
if (!efl_file_loaded_get(obj)) return;
switch (sd->format)
{
case ELM_TEXT_FORMAT_PLAIN_UTF8:
@ -4983,6 +4983,9 @@ EAPI Eina_Bool
elm_entry_file_set(Evas_Object *obj, const char *file, Elm_Text_Format format)
{
Eina_Bool ret;
ELM_ENTRY_DATA_GET(obj, sd);
ELM_SAFE_FREE(sd->delay_write, ecore_timer_del);
if (sd->auto_save) _save_do(obj);
elm_obj_entry_file_text_format_set(obj, format);
ret = efl_file_simple_load(obj, file, NULL);
return ret;
@ -4996,15 +4999,13 @@ _elm_entry_efl_file_unload(Eo *obj, Elm_Entry_Data *sd EINA_UNUSED)
}
EOLIAN static Eina_Error
_elm_entry_efl_file_load(Eo *obj, Elm_Entry_Data *sd)
_elm_entry_efl_file_load(Eo *obj, Elm_Entry_Data *sd EINA_UNUSED)
{
Eina_Error err;
if (efl_file_loaded_get(obj)) return 0;
err = efl_file_load(efl_super(obj, MY_CLASS));
if (err) return err;
ELM_SAFE_FREE(sd->delay_write, ecore_timer_del);
if (sd->auto_save) _save_do(obj);
return _load_do(obj);
}