From babc6c8ab3a9c48cbb72f35d11f616bbe861bb21 Mon Sep 17 00:00:00 2001 From: raster Date: Mon, 31 Jan 2011 10:33:22 +0000 Subject: [PATCH] From: Daniel Juyung Seo Subject: [E-devel] [Patch] genlist item cache exception handling patch I added "no cached item" handling. In some case, items should not be cached and should not use caches. For example, if there was a state change in item style, it should not be cached because it remembers the state changes. And if we use elm_genlist_item_item_class_update() API, item should not be cached as well. It needs to be a fresh item style without remembering the state changes. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@56585 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/elm_genlist.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/lib/elm_genlist.c b/src/lib/elm_genlist.c index b1af5f8..224d1ff 100644 --- a/src/lib/elm_genlist.c +++ b/src/lib/elm_genlist.c @@ -413,6 +413,7 @@ struct _Elm_Genlist_Item Eina_Bool down : 1; Eina_Bool dragging : 1; Eina_Bool updateme : 1; + Eina_Bool nocache : 1; }; struct _Item_Cache @@ -1610,12 +1611,15 @@ _item_realize(Elm_Genlist_Item *it, const char *treesize; char buf[1024]; int depth, tsize = 20; - Item_Cache *itc; + Item_Cache *itc = NULL; if ((it->realized) || (it->delete_me)) return; it->order_num_in = in; - itc = _item_cache_find(it); + if (it->nocache) + it->nocache = EINA_FALSE; + else + itc = _item_cache_find(it); if (itc) { it->base.view = itc->base_view; @@ -1859,7 +1863,15 @@ _item_unrealize(Elm_Genlist_Item *it) ecore_timer_del(it->long_timer); it->long_timer = NULL; } - _item_cache_add(it); + if (it->nocache) + { + evas_object_del(it->base.view); + it->base.view = NULL; + evas_object_del(it->spacer); + it->spacer = NULL; + } + else + _item_cache_add(it); elm_widget_stringlist_free(it->labels); it->labels = NULL; elm_widget_stringlist_free(it->icons); @@ -4137,6 +4149,7 @@ elm_genlist_item_item_class_update(Elm_Genlist_Item *it, EINA_SAFETY_ON_NULL_RETURN(itc); if (it->delete_me) return; it->itc = itc; + it->nocache = EINA_TRUE; elm_genlist_item_update(it); } -- 2.7.4