jackdanielz pushed a commit to branch master.

http://git.enlightenment.org/tools/erigo.git/commit/?id=210e83fcc925da9597c55218a03a5377e829be6c

commit 210e83fcc925da9597c55218a03a5377e829be6c
Author: Daniel Zaoui <daniel.za...@samsung.com>
Date:   Tue Nov 3 16:45:01 2015 +0200

    ObjTree: clean code
---
 src/bin/gui/objtree.c | 38 ++++++++++++++++----------------------
 1 file changed, 16 insertions(+), 22 deletions(-)

diff --git a/src/bin/gui/objtree.c b/src/bin/gui/objtree.c
index 4bb1030..ff05af5 100644
--- a/src/bin/gui/objtree.c
+++ b/src/bin/gui/objtree.c
@@ -33,16 +33,22 @@ _objtree_filter_entry_string_get()
 static char *
 _item_label_get(void *data, Evas_Object *obj EINA_UNUSED, const char *part)
 {
-   char buf[256];
-   const char *name;
-   Gui_Widget *wdg = data;
-
-   name = wdg_name_get(wdg);
-
    if (!strcmp(part, "elm.text"))
-     snprintf(buf, sizeof(buf), "%s",name);
+      return strdup(wdg_name_get(data));
 
-   return strdup(buf);
+   return NULL;
+}
+
+static Eina_Bool
+_wdg_has_real_children(const Gui_Widget *wdg)
+{
+   Eid *wid;
+   const Eina_List *list = wdg_children_list_get(wdg), *itr;
+   EINA_LIST_FOREACH(list, itr, wid)
+     {
+        if (eid_exists(wid) && !eid_is_dummy(wid)) return EINA_TRUE;
+     }
+   return EINA_FALSE;
 }
 
 static Evas_Object *
@@ -53,7 +59,7 @@ _item_content_get(void *data, Evas_Object *obj, const char 
*part)
 
    if (!strcmp(part, "elm.swallow.icon"))
      {
-        const char *icname = (!wdg || wdg_children_list_get(wdg)) ? "folder" : 
"file";
+        const char *icname = (!wdg || _wdg_has_real_children(wdg)) ? "folder" 
: "file";
         elm_icon_standard_set(ic, icname);
      }
 
@@ -75,18 +81,6 @@ _contract_request_cb(void *data EINA_UNUSED, Evas_Object *o 
EINA_UNUSED, void *e
    elm_genlist_item_expanded_set(glit, EINA_FALSE);
 }
 
-static Eina_Bool
-_wdg_has_real_children(const Gui_Widget *wdg)
-{
-   Eid *wid;
-   const Eina_List *list = wdg_children_list_get(wdg), *itr;
-   EINA_LIST_FOREACH(list, itr, wid)
-     {
-        if (eid_exists(wid) && !eid_is_dummy(wid)) return EINA_TRUE;
-     }
-   return EINA_FALSE;
-}
-
 static void
 _item_expand(Gui_Widget *wdg, Elm_Object_Item *parent)
 {
@@ -266,7 +260,7 @@ objtree_item_selected_set(const Gui_Widget *wdg)
    /* If filter was active, need to drop filter and clear open items hash. */
    if (_objtree_filter_entry_string_get())
      {
-        ERR("strane but we are here");
+        ERR("strange but we are here");
         objtree_filtering_reset();
         elm_genlist_clear(lst);
         _item_expand(NULL, NULL);

-- 


Reply via email to