cedric pushed a commit to branch master.

http://git.enlightenment.org/core/elementary.git/commit/?id=fb050ab650348a3bdd370c81f0b9ca911a904f9f

commit fb050ab650348a3bdd370c81f0b9ca911a904f9f
Author: Marcel Hollerbach <marcel-hollerb...@t-online.de>
Date:   Wed Jun 17 14:53:37 2015 +0200

    elm_icon_external: cleanup ERR msg in error case
    
    Summary:
    Setting the group without checking it exists causes a errormessage, this
    is pretty annoying for people which want to set a standart icon. And
    give a better errormessage if the standart setting failed.
    
    Reviewers: raster, cedric
    
    Reviewed By: cedric
    
    Differential Revision: https://phab.enlightenment.org/D2686
    
    Signed-off-by: Cedric BAIL <ced...@osg.samsung.com>
---
 src/edje_externals/elm_icon.c | 24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/src/edje_externals/elm_icon.c b/src/edje_externals/elm_icon.c
index 1ac65b5..979cc0b 100644
--- a/src/edje_externals/elm_icon.c
+++ b/src/edje_externals/elm_icon.c
@@ -84,8 +84,16 @@ external_icon_state_set(void *data EINA_UNUSED, Evas_Object 
*obj,
         edje = evas_object_smart_parent_get(obj);
         edje_object_file_get(edje, &file, NULL);
 
-        if (!elm_image_file_set(obj, file, p->icon))
-          elm_icon_standard_set(obj, p->icon);
+        if (!edje_file_group_exists(file, p->icon))
+          {
+            if (!elm_icon_standard_set(obj, p->icon))
+              ERR("Failed to set standard icon! (%s)", p->icon);
+          }
+        else if (!elm_image_file_set(obj, file, p->icon))
+          {
+            if (!elm_icon_standard_set(obj, p->icon))
+              ERR("Failed to set standard icon! (%s)", p->icon);
+          }
      }
 }
 
@@ -153,8 +161,16 @@ external_icon_param_set(void *data EINA_UNUSED, 
Evas_Object *obj,
              edje = evas_object_smart_parent_get(obj);
              edje_object_file_get(edje, &file, NULL);
 
-             if (!elm_image_file_set(obj, file, param->s))
-               elm_icon_standard_set(obj, param->s);
+             if (!edje_file_group_exists(file, param->s))
+               {
+                 if (!elm_icon_standard_set(obj, param->s))
+                   ERR("Failed to set standard icon! (%s)", param->s);
+               }
+             else if (!elm_image_file_set(obj, file, param->s))
+               {
+                 if (!elm_icon_standard_set(obj, param->s))
+                   ERR("Failed to set standard icon as fallback! (%s)", 
param->s);
+               }
              return EINA_TRUE;
           }
      }

-- 


Reply via email to