From 9f71107690ab3f38c9cfdd5d4d4e410c0f861329 Mon Sep 17 00:00:00 2001 From: seoz Date: Tue, 2 Aug 2011 06:59:45 +0000 Subject: [PATCH] elm genlist: Refactoring. Moved code for the readability. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@61983 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/elm_genlist.c | 82 +++++++++++++++++++++++++-------------------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/src/lib/elm_genlist.c b/src/lib/elm_genlist.c index 4031c58..2145459 100644 --- a/src/lib/elm_genlist.c +++ b/src/lib/elm_genlist.c @@ -3454,6 +3454,47 @@ elm_genlist_item_prepend(Evas_Object *obj, } EAPI Elm_Genlist_Item * +elm_genlist_item_insert_after(Evas_Object *obj, + const Elm_Genlist_Item_Class *itc, + const void *data, + Elm_Genlist_Item *parent, + Elm_Genlist_Item *after, + Elm_Genlist_Item_Flags flags, + Evas_Smart_Cb func, + const void *func_data) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + EINA_SAFETY_ON_NULL_RETURN_VAL(after, NULL); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func, + func_data); + if (!it) return NULL; + /* It makes no sense to insert after in an empty list with after != NULL, something really bad is happening in your app. */ + EINA_SAFETY_ON_NULL_RETURN_VAL(wd->items, NULL); + + if (!it->parent) + { + if ((flags & ELM_GENLIST_ITEM_GROUP) && + (after->flags & ELM_GENLIST_ITEM_GROUP)) + wd->group_items = eina_list_append_relative(wd->group_items, it, + after); + } + else + { + it->parent->items = eina_list_append_relative(it->parent->items, it, + after); + } + wd->items = eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it), + EINA_INLIST_GET(after)); + it->rel = after; + it->rel->relcount++; + it->before = EINA_FALSE; + _item_queue(wd, it); + return it; +} + +EAPI Elm_Genlist_Item * elm_genlist_item_insert_before(Evas_Object *obj, const Elm_Genlist_Item_Class *itc, const void *data, @@ -3587,47 +3628,6 @@ elm_genlist_item_sorted_insert(Evas_Object *obj, _elm_genlist_item_compare_data, func, func_data); } -EAPI Elm_Genlist_Item * -elm_genlist_item_insert_after(Evas_Object *obj, - const Elm_Genlist_Item_Class *itc, - const void *data, - Elm_Genlist_Item *parent, - Elm_Genlist_Item *after, - Elm_Genlist_Item_Flags flags, - Evas_Smart_Cb func, - const void *func_data) -{ - ELM_CHECK_WIDTYPE(obj, widtype) NULL; - EINA_SAFETY_ON_NULL_RETURN_VAL(after, NULL); - Widget_Data *wd = elm_widget_data_get(obj); - if (!wd) return NULL; - Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func, - func_data); - if (!it) return NULL; - /* It makes no sense to insert after in an empty list with after != NULL, something really bad is happening in your app. */ - EINA_SAFETY_ON_NULL_RETURN_VAL(wd->items, NULL); - - if (!it->parent) - { - if ((flags & ELM_GENLIST_ITEM_GROUP) && - (after->flags & ELM_GENLIST_ITEM_GROUP)) - wd->group_items = eina_list_append_relative(wd->group_items, it, - after); - } - else - { - it->parent->items = eina_list_append_relative(it->parent->items, it, - after); - } - wd->items = eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it), - EINA_INLIST_GET(after)); - it->rel = after; - it->rel->relcount++; - it->before = EINA_FALSE; - _item_queue(wd, it); - return it; -} - EAPI void elm_genlist_clear(Evas_Object *obj) { -- 2.7.4