yakov pushed a commit to branch master.

http://git.enlightenment.org/tools/erigo.git/commit/?id=001f08408201ce32ac959d94aa11e3ae37686b9e

commit 001f08408201ce32ac959d94aa11e3ae37686b9e
Author: Yakov Goldberg <yako...@samsung.com>
Date:   Sun Aug 2 18:22:33 2015 +0300

    Fix creation of item's content
    
    Item of Naviframe holds some content, e.g. box with button.
    Fix to recursively create box and all its content.
---
 src/bin/gui/editor.c | 19 ++++++++++++++++++-
 src/lib/ffi_glue.c   | 24 ++++--------------------
 src/lib/generator.c  | 22 ++++++++++++++++++++++
 src/lib/simulator.c  | 20 ++++++++++++++++++++
 4 files changed, 64 insertions(+), 21 deletions(-)

diff --git a/src/bin/gui/editor.c b/src/bin/gui/editor.c
index c783bad..59a9c84 100644
--- a/src/bin/gui/editor.c
+++ b/src/bin/gui/editor.c
@@ -1567,10 +1567,27 @@ _widget_item_add(Gui_Session *session, const Gui_Widget 
*wdg, const Item_Contain
    Elm_Object_Item *it = NULL;
    Eina_List *itr;
    const Gui_Widget_Property *prop = item_container_item_prop_get(wit);
+
+   Gui_Value *val;
+   Eina_List *values_lst = prop_value_get(prop);
+   EINA_LIST_FOREACH(values_lst, itr, val)
+     {
+        if (gui_value_type_get(val) == GUI_TYPE_OBJECT)
+          {
+             Eid *wid = EID_ID_GET(val);
+             Gui_Widget *w = wdg_get(wid);
+             /* Check for Eo object only if widget is active, */
+             if (w && !session_wdg_exists(session, w))
+               {
+                  /* Creation of the child widgets of the item. */
+                  _iter_widget_create(w, session_eo_get(session, wdg));
+               }
+          }
+     }
    /* Replace NULL ids with dummy for naviframe */
    if (IS_NAVIFRAME(wdg) && !strcmp(prop_name_get(prop), ITEM_PUSH))
      {
-        Gui_Value *val = prop_value_nth_get(prop, 1);
+        val = prop_value_nth_get(prop, 1);
         Eid *wid = EID_ID_GET(val);
         if (!wid) gui_value_name_id_set(val, GUI_TYPE_OBJECT, DUMMY_ID);
 
diff --git a/src/lib/ffi_glue.c b/src/lib/ffi_glue.c
index 312bb22..97e5337 100644
--- a/src/lib/ffi_glue.c
+++ b/src/lib/ffi_glue.c
@@ -243,34 +243,17 @@ _widget_delayed_properties_add(Gui_Session *session, 
const Gui_Widget *wdg, Acti
 Eina_Bool
 manager_widget_items_add(Gui_Session *session, const Gui_Widget *wdg, const 
Item_Container_Item *spec_item, Action_Mode mode, void *data)
 {
-   Eina_List *itr1, *itr2;
+   Eina_List *itr;
    const Item_Container_Item *root_it = wdg_item_container_root_get(wdg);
    Eid *item_id;
    Eina_Bool ret = EINA_TRUE;
    Eina_List *items = item_container_item_subitems_get(root_it);
-   EINA_LIST_FOREACH(items, itr1, item_id)
+   EINA_LIST_FOREACH(items, itr, item_id)
      {
         /* FIXME: Delete together with recursion call in _widget_item_add() 
func in editor.*/
         Item_Container_Item *item = item_container_item_get_from_id(item_id);
         if (spec_item && spec_item != item) continue;
-        const Gui_Widget_Property *prop = item_container_item_prop_get(item);
-        Eina_List *values_lst = prop_value_get(prop);
-        Gui_Value *val;
-        EINA_LIST_FOREACH(values_lst, itr2, val)
-          {
-             if (gui_value_type_get(val) == GUI_TYPE_OBJECT)
-               {
-                  Eid *wid = EID_ID_GET(val);
-                  Gui_Widget *w = wdg_get(wid);
-                  /* Check for Eo object only if widget is active, */
-                  if (w && !session_wdg_exists(session, w))
-                    {
-                       /* Creation of the child widgets of the item. */
-                       manager_widget_create(session, w, mode, data);
-                       manager_widget_configure(session, w, mode, data);
-                    }
-               }
-          }
+
         if (_modes_functions[mode].item_add)
           {
              ret &= _modes_functions[mode].item_add(session, wdg, item, data);
@@ -309,6 +292,7 @@ manager_widget_configure(Gui_Session *session, const 
Gui_Widget *wdg, Action_Mod
      {
         Eid *item_id = 
eina_list_data_get(item_container_item_subitems_get(wdg_item_container_root_get(wdg)));
         Item_Container_Item *item = item_container_item_get_from_id(item_id);
+        /* item != NULL, guaranteers, that only first item will be added.  */
         manager_widget_items_add(session, wdg, item, mode, data);
      }
    else
diff --git a/src/lib/generator.c b/src/lib/generator.c
index 68d637d..19da09a 100644
--- a/src/lib/generator.c
+++ b/src/lib/generator.c
@@ -397,10 +397,32 @@ _item_iterate(Gui_Session *session, Widget_Context 
*wdg_ctx, const Gui_Widget *w
      }
 }
 
+static void
+_iter_widget(Gui_Session *session, Global_Gen_Context *gl_ctx, Widget_Context 
*wdg_ctx, Gui_Widget *wdg);
+
 static Eina_Bool
 _item_add_generate(Gui_Session *session, const Gui_Widget *wdg, const 
Item_Container_Item *wit, void *data EINA_UNUSED)
 {
    Widget_Context *wdg_ctx = data;
+   Global_Gen_Context *gl_ctx = wdg_ctx->gl_ctx;
+
+   const Gui_Widget_Property *prop = item_container_item_prop_get(wit);
+   Eina_List *values_lst = prop_value_get(prop), *itr2;
+   Gui_Value *val;
+   EINA_LIST_FOREACH(values_lst, itr2, val)
+     {
+        if (gui_value_type_get(val) == GUI_TYPE_OBJECT)
+          {
+             Eid *wid = EID_ID_GET(val);
+             Gui_Widget *w = wdg_get(wid);
+             /* Check for Eo object only if widget is active, */
+             if (w && !session_wdg_exists(session, w))
+               {
+                  /* Creation of the child widgets of the item. */
+                  _iter_widget(session, gl_ctx, wdg_ctx, w);
+               }
+          }
+     }
 
    _item_iterate(session, wdg_ctx, wdg, wit);
 
diff --git a/src/lib/simulator.c b/src/lib/simulator.c
index 955e05d..53277ed 100644
--- a/src/lib/simulator.c
+++ b/src/lib/simulator.c
@@ -290,6 +290,26 @@ _item_add(Gui_Session *session, const Gui_Widget *wdg, 
const Item_Container_Item
         eo_do(session_eo_get(session, wdg), it = 
elm_obj_menu_item_add(parent_it, icon, label, cb_func, NULL));
         goto end;
      }
+
+   /* Create widgets which are content of item. */
+   const Gui_Widget_Property *prop = item_container_item_prop_get(wit);
+   Eina_List *values_lst = prop_value_get(prop);
+   Gui_Value *val;
+   EINA_LIST_FOREACH(values_lst, itr, val)
+     {
+        if (gui_value_type_get(val) == GUI_TYPE_OBJECT)
+          {
+             Eid *wid = EID_ID_GET(val);
+             Gui_Widget *w = wdg_get(wid);
+             /* Check for Eo object only if widget is active, */
+             if (w && !session_wdg_exists(session, w))
+               {
+                  /* Creation of the child widgets of the item. */
+                  _iter_widget(session, w, wdg_eid_get(wdg));
+               }
+          }
+     }
+
    it = _ffi_eo_item_add(session, wdg, wit, data, NULL);
 end:
    session_item_set(session, wit, it);

-- 


Reply via email to