yakov pushed a commit to branch master.

http://git.enlightenment.org/tools/erigo.git/commit/?id=23d1d42e090645fecd1318f410bee993a3bc2d77

commit 23d1d42e090645fecd1318f410bee993a3bc2d77
Author: Yakov Goldberg <yako...@samsung.com>
Date:   Tue May 19 17:01:18 2015 +0300

    Refactor objtree
    
    Put objects in objtree in proper order (as in container)
---
 src/bin/gui/objtree.c | 37 +++++++++++++++++++++++++++++++++----
 1 file changed, 33 insertions(+), 4 deletions(-)

diff --git a/src/bin/gui/objtree.c b/src/bin/gui/objtree.c
index 42556f4..64d0c36 100644
--- a/src/bin/gui/objtree.c
+++ b/src/bin/gui/objtree.c
@@ -83,14 +83,42 @@ _item_expand(Gui_Widget *wdg, Elm_Object_Item *parent)
 
    Eid *wid;
    Elm_Object_Item *nitem;
-   const Eina_List *w_list, *l;
+   Eina_List *w_list = NULL, *l;
 
    if (wdg) eina_hash_set(_openned_items_set, wdg_name_get(wdg), (void *) 1);
 
    /* if wdg == NULL, this is root item, so add items for windows;
-    * or add items for child widgets. */
-   w_list = wdg ? wdg_children_list_get(wdg) :
-                  gui_context_main_widgets_get(active_ctx);
+    * or add items for child widgets and content. */
+   if (wdg)
+     {
+        /* clone children list */
+        w_list = eina_list_clone(wdg_children_list_get(wdg));
+
+        /* If widget is container, and content widget is already in w_list,
+         * move it at the end.
+         * So content objects in objtree will be ordered as they are in 
container. */
+        if (IS_CONTAINER(wdg))
+          {
+             Object_Container_Item *ci;
+             EINA_LIST_FOREACH(wdg_obj_container_contents_list_get(wdg), l, ci)
+               {
+                  Eid *i_eid = obj_container_item_eid_get(ci);
+                  Eina_List *l_data = NULL;
+                  if ((l_data = eina_list_data_find_list(w_list, i_eid)))
+                    {
+                       w_list = eina_list_demote_list(w_list, l_data);
+                    }
+                  else
+                    {
+                       w_list = eina_list_append(w_list, i_eid);
+                    }
+               }
+          }
+     }
+   else
+     {
+        w_list = eina_list_clone(gui_context_main_widgets_get(active_ctx));
+     }
 
    /* If filter_entry in not empty, we are in filter mode*/
    const char *filter_str = _objtree_filter_entry_string_get();
@@ -130,6 +158,7 @@ _item_expand(Gui_Widget *wdg, Elm_Object_Item *parent)
                elm_genlist_item_expanded_set(nitem, EINA_TRUE);
           }
      }
+   eina_list_free(w_list);
 }
 
 static void

-- 


Reply via email to