From: Tae-Hwan Kim Date: Mon, 25 Mar 2013 10:22:44 +0000 (+0900) Subject: [Genlist] Fix genlist index get bug X-Git-Tag: 2.1b_release~99 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a8a6bb82c000cc94b5f6ae3fcc7041df1bff153a;p=framework%2Fuifw%2Felementary.git [Genlist] Fix genlist index get bug Because not all item block have "max_items_per_block" number of items in it's block. So the calculation is not correct when items are added & removed in each block. Because genlist uses inlinst, there is a performance problem to get index of genlist item. Change-Id: Ib5b557fbb194a6f94e45d8c918100c21de42c3a2 --- diff --git a/src/lib/elm_genlist.c b/src/lib/elm_genlist.c index 9a24f27..721efae 100644 --- a/src/lib/elm_genlist.c +++ b/src/lib/elm_genlist.c @@ -6491,14 +6491,18 @@ elm_genlist_item_cursor_engine_only_get(const Elm_Object_Item *it) EAPI int elm_genlist_item_index_get(const Elm_Object_Item *item) { + int cnt = 0; + Elm_Gen_Item *tmp; Elm_Gen_Item *it = (Elm_Gen_Item *)item; ELM_GENLIST_ITEM_CHECK_OR_RETURN(item, -1); - if (it->item->block) - return it->position + (it->item->block->position * - GL_IT(it)->wsd->max_items_per_block); - return -1; + EINA_INLIST_FOREACH(GL_IT(it)->wsd->items, tmp) + { + if (tmp == it) break; + cnt++; + } + return cnt; } EAPI void