summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChunEon Park <hermet@hermet.pe.kr>2015-01-05 20:43:58 +0900
committerChunEon Park <hermet@hermet.pe.kr>2015-01-05 20:43:58 +0900
commit692e28fe74bed71b34de863f32384f7d2076c9ee (patch)
tree1437bec6fc15f703b7ccad74ed83de1e901e6904
parenta691057f05a98c8bda0916fd4be26006fcd7d1e9 (diff)
downloadelementary-692e28fe74bed71b34de863f32384f7d2076c9ee.tar.gz
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. Anyhow, we need more efficient way for this API because genlist uses inlinst.
-rw-r--r--src/lib/elm_genlist.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/lib/elm_genlist.c b/src/lib/elm_genlist.c
index 8d54e94a9..2c938517e 100644
--- a/src/lib/elm_genlist.c
+++ b/src/lib/elm_genlist.c
@@ -7159,12 +7159,16 @@ elm_genlist_item_cursor_engine_only_get(const Elm_Object_Item *eo_it)
EOLIAN static int
_elm_genlist_item_index_get(Eo *eo_it EINA_UNUSED, Elm_Gen_Item *it)
{
+ int cnt = 0;
+ Elm_Gen_Item *tmp;
ELM_GENLIST_ITEM_CHECK_OR_RETURN(it, -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;
}
EOLIAN static void