elm_image: keep backword compatibility for elm_image_file_set API when setting url file set twice

Summary:
when trying to set file using url path twice, the second api call's return value is EINA_FALSE
since image obj has already has same file path. After applying Efl.File interface, the behavior is changed compared to before.
both of the return values should be EINA_TRUE.
@fix

ex)
Eina_Bool ret1, ret2;
ret1 = elm_image_file_set(image, "http://sameurl/image.jpg", NULL);
ret2 = elm_image_file_set(image, "http://sameurl/image.jpg", NULL);
ret1 and ret2 should be EINA_TURE

Test Plan:
1. call elm_image_file_set api with same url path
2. see the return value

Reviewers: Hermet, kimcinoo, jsuya

Reviewed By: Hermet

Subscribers: bu5hm4n, cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D11979
This commit is contained in:
Taehyub Kim 2020-06-17 21:04:08 +09:00 committed by Hermet Park
parent b3bc1240a6
commit 794c52d200
1 changed files with 14 additions and 0 deletions

View File

@ -2453,6 +2453,20 @@ elm_image_file_set(Evas_Object *obj, const char *file, const char *group)
Eina_Bool ret = EINA_FALSE;
EFL_UI_IMAGE_CHECK(obj) EINA_FALSE;
/* check if previous path is same with new one.
and return true if they are same */
const char *cur_file_path = efl_file_get(obj);
if ((cur_file_path && file) && !strcmp(cur_file_path, file))
{
const char *cur_group = efl_file_key_get(obj);
if (!(cur_group && group && strcmp(cur_group, group)))
{
if (efl_file_loaded_get(obj)) return EINA_TRUE;
if (_efl_ui_image_is_remote(file)) return EINA_TRUE;
}
}
ret = efl_file_simple_load(obj, file, group);
efl_canvas_group_change(obj);
return ret;