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
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