From 4c08c2b43fc4b4f2f2ddc7630794138e60b6e80b Mon Sep 17 00:00:00 2001 From: Jung Chanwook Date: Mon, 16 Jan 2012 17:47:23 +0900 Subject: [PATCH] [Genlist] Calculate expanded_depth in _item_new Change-Id: I00ec57742d522cd3b630b68a0e930a824a1b7448 --- src/lib/elm_genlist.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/lib/elm_genlist.c b/src/lib/elm_genlist.c index 387d33c..159562c 100644 --- a/src/lib/elm_genlist.c +++ b/src/lib/elm_genlist.c @@ -2044,11 +2044,10 @@ _item_realize(Elm_Genlist_Item *it, int in, Eina_Bool calc) { - Elm_Genlist_Item *it2; const char *stacking; const char *treesize; char buf[1024]; - int depth, tsize = 20; + int tsize = 20; Item_Cache *itc = NULL; if ((it->realized) || (it->delete_me)) return; @@ -2094,15 +2093,11 @@ _item_realize(Elm_Genlist_Item *it, evas_object_color_set(it->spacer, 0, 0, 0, 0); elm_widget_sub_object_add(WIDGET(it), it->spacer); } - for (it2 = it, depth = 0; it2->parent; it2 = it2->parent) - { - if (it2->parent->flags != ELM_GENLIST_ITEM_GROUP) depth += 1; - } - it->expanded_depth = depth; + treesize = edje_object_data_get(VIEW(it), "treesize"); if (treesize) tsize = atoi(treesize); evas_object_size_hint_min_set(it->spacer, - (depth * tsize) * _elm_config->scale, 1); + (it->expanded_depth * tsize) * _elm_config->scale, 1); edje_object_part_swallow(VIEW(it), "elm.swallow.pad", it->spacer); if (!calc) { @@ -3591,7 +3586,8 @@ _item_new(Widget_Data *wd, Evas_Smart_Cb func, const void *func_data) { - Elm_Genlist_Item *it; + Elm_Genlist_Item *it, *it2; + int depth = 0; it = elm_widget_item_new(wd->obj, Elm_Genlist_Item); if (!it) return NULL; @@ -3615,6 +3611,11 @@ _item_new(Widget_Data *wd, else if (it->parent->group_item) it->group_item = it->parent->group_item; } + for (it2 = it, depth = 0; it2->parent; it2 = it2->parent) + { + if (it2->parent->flags != ELM_GENLIST_ITEM_GROUP) depth += 1; + } + it->expanded_depth = depth; return it; } -- 2.7.4