From 794c52d2009b603b89eb4da53afc7ab8f9c5547d Mon Sep 17 00:00:00 2001 From: Taehyub Kim Date: Wed, 17 Jun 2020 21:04:08 +0900 Subject: [PATCH] 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 --- src/lib/elementary/efl_ui_image.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/lib/elementary/efl_ui_image.c b/src/lib/elementary/efl_ui_image.c index 5bf297854c..d9166ee7fd 100644 --- a/src/lib/elementary/efl_ui_image.c +++ b/src/lib/elementary/efl_ui_image.c @@ -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;