From a4b3535f78e9dd33cecab1b969ca5a45dcc418dc Mon Sep 17 00:00:00 2001 From: cedric Date: Mon, 5 Sep 2011 20:31:51 +0000 Subject: [PATCH] elementary: use sorted state to improve gengrid and genlist. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@63217 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/elm_gengrid.c | 13 +++++++++++-- src/lib/elm_genlist.c | 15 +++++++++++++-- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/lib/elm_gengrid.c b/src/lib/elm_gengrid.c index 1a09a2b..5475cf7 100644 --- a/src/lib/elm_gengrid.c +++ b/src/lib/elm_gengrid.c @@ -59,6 +59,7 @@ struct _Widget_Data { + Eina_Inlist_Sorted_State *state; Evas_Object *self, *scr; Evas_Object *pan_smart; Pan *pan; @@ -1901,9 +1902,12 @@ elm_gengrid_item_direct_sorted_insert(Evas_Object *obj, item = _item_create(wd, gic, data, func, func_data); if (!item) return NULL; + if (!wd->state) + wd->state = eina_inlist_sorted_state_new(); + _elm_gengrid_item_compare_cb = comp; - wd->items = eina_inlist_sorted_insert(wd->items, EINA_INLIST_GET(item), - _elm_gengrid_item_compare); + wd->items = eina_inlist_sorted_state_insert(wd->items, EINA_INLIST_GET(item), + _elm_gengrid_item_compare, wd->state); if (wd->calc_job) ecore_job_del(wd->calc_job); wd->calc_job = ecore_job_add(_calc_job, wd); @@ -1972,6 +1976,11 @@ elm_gengrid_clear(Evas_Object *obj) Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; + if (wd->state) + { + eina_inlist_sorted_state_free(wd->state); + wd->state = NULL; + } if (wd->calc_job) { ecore_job_del(wd->calc_job); diff --git a/src/lib/elm_genlist.c b/src/lib/elm_genlist.c index ba14c96..15d5eab 100644 --- a/src/lib/elm_genlist.c +++ b/src/lib/elm_genlist.c @@ -15,6 +15,7 @@ typedef struct _Item_Cache Item_Cache; struct _Widget_Data { + Eina_Inlist_Sorted_State *state; Evas_Object *obj, *scr, *pan_smart; Eina_Inlist *items, *blocks; Eina_List *group_items; @@ -3652,11 +3653,16 @@ elm_genlist_item_direct_sorted_insert(Evas_Object *obj, } else { + if (!wd->state) + { + wd->state = eina_inlist_sorted_state_new(); + } + if (flags & ELM_GENLIST_ITEM_GROUP) wd->group_items = eina_list_append(wd->group_items, it); - wd->items = eina_inlist_sorted_insert(wd->items, EINA_INLIST_GET(it), - _elm_genlist_item_compare); + wd->items = eina_inlist_sorted_state_insert(wd->items, EINA_INLIST_GET(it), + _elm_genlist_item_compare, wd->state); if (EINA_INLIST_GET(it)->next) { @@ -3703,6 +3709,11 @@ elm_genlist_clear(Evas_Object *obj) ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; + if (wd->state) + { + eina_inlist_sorted_state_free(wd->state); + wd->state = NULL; + } if (wd->walking > 0) { Elm_Genlist_Item *it; -- 2.7.4