cedric pushed a commit to branch master.

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

commit 06c15035b4f6541fe9f2fc60934287cb2e413c25
Author: Youngbok Shin <youngb.s...@samsung.com>
Date:   Mon Nov 9 12:25:04 2015 -0800

    toolbar: reduce changing widget parent-child relationship when an item is 
added.
    
    Summary:
    It is an legacy of old code. When the view object of item was edje,
    I think there was no meaningless parent-child relationship changes.
    But, now, the view object is elm_layout and if we add object in proper 
order,
    we don't need to make an useless parent-child realationship in any moments.
    
    Test Plan: None
    
    Reviewers: woohyun, cedric
    
    Reviewed By: cedric
    
    Differential Revision: https://phab.enlightenment.org/D3254
    
    Signed-off-by: Cedric BAIL <ced...@osg.samsung.com>
---
 src/lib/elm_toolbar.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/src/lib/elm_toolbar.c b/src/lib/elm_toolbar.c
index c68a287..0244939 100644
--- a/src/lib/elm_toolbar.c
+++ b/src/lib/elm_toolbar.c
@@ -2354,16 +2354,10 @@ _item_new(Evas_Object *obj,
 
    ELM_TOOLBAR_DATA_GET(obj, sd);
 
-   icon_obj = elm_icon_add(obj);
-   elm_icon_order_lookup_set(icon_obj, sd->lookup_order);
-   if (!icon_obj) return NULL;
-
    Eo *eo_it = eo_add(ELM_TOOLBAR_ITEM_CLASS, obj);
-   if (!eo_it)
-     {
-        evas_object_del(icon_obj);
-        return NULL;
-     }
+
+   if (!eo_it) return NULL;
+
    ELM_TOOLBAR_ITEM_DATA_GET(eo_it, it);
 
    it->label = eina_stringshare_add(label);
@@ -2377,6 +2371,9 @@ _item_new(Evas_Object *obj,
    VIEW(it) = elm_layout_add(obj);
    evas_object_data_set(VIEW(it), "item", it);
 
+   icon_obj = elm_icon_add(VIEW(it));
+   elm_icon_order_lookup_set(icon_obj, sd->lookup_order);
+
    if (_elm_config->access_mode == ELM_ACCESS_MODE_ON)
      _access_widget_item_register(it);
 
@@ -2411,7 +2408,6 @@ _item_new(Evas_Object *obj,
      it);
    evas_object_event_callback_add
      (VIEW(it), EVAS_CALLBACK_MOUSE_UP, (Evas_Object_Event_Cb)_mouse_up_cb, 
it);
-   elm_widget_sub_object_add(obj, VIEW(it));
 
    if (it->icon)
      {

-- 


Reply via email to