elm_image: keep backword compatibility for elm_image_file_set API when setting url... 99/236499/1
authorTaehyub Kim <taehyub.kim@samsung.com>
Wed, 17 Jun 2020 12:04:08 +0000 (21:04 +0900)
committerTaehyub Kim <taehyub.kim@samsung.com>
Wed, 17 Jun 2020 12:23:06 +0000 (21:23 +0900)
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

Change-Id: If64d8d58424b559ea07dba14efb36996484c2fd5

src/lib/elementary/efl_ui_image.c

index a470c8f..2f6fb82 100644 (file)
@@ -2465,6 +2465,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;