diff options
author | Daniel Juyung Seo <seojuyung2@gmail.com> | 2014-07-27 01:19:57 -0700 |
---|---|---|
committer | Daniel Juyung Seo <seojuyung2@gmail.com> | 2014-07-27 01:19:57 -0700 |
commit | 8c526e7f8b7dc4dcfefc30e78577d45677e6cf97 (patch) | |
tree | 0c739b985f13b47ac9cf951a5392698e7bd0aacf | |
parent | faaeccc15f79a3ea69ccc7c77167c1d77cc16981 (diff) | |
download | elementary-devs/seoz/D788.tar.gz |
genlist: added internal function _view_clear() for common codes.devs/seoz/D788
Use this function for normal items, decorate items, and decorate all
items.
-rw-r--r-- | src/lib/elm_genlist.c | 56 |
1 files changed, 29 insertions, 27 deletions
diff --git a/src/lib/elm_genlist.c b/src/lib/elm_genlist.c index 16afabf8e..e0617d7c0 100644 --- a/src/lib/elm_genlist.c +++ b/src/lib/elm_genlist.c @@ -445,6 +445,25 @@ _view_create(Elm_Gen_Item *it, const char *style) } static void +_view_clear(Evas_Object *view, Eina_List **texts, Eina_List **contents, + Eina_List **states, Eina_List **content_objs) +{ + const char *part; + Evas_Object *c; + const Eina_List *l; + + EINA_LIST_FOREACH(*texts, l, part) + edje_object_part_text_set(view, part, NULL); + + ELM_SAFE_FREE(*texts, elm_widget_stringlist_free); + ELM_SAFE_FREE(*contents, elm_widget_stringlist_free); + ELM_SAFE_FREE(*states, elm_widget_stringlist_free); + + EINA_LIST_FREE(*content_objs, c) + evas_object_del(c); +} + +static void _item_scroll(Elm_Genlist_Data *sd) { Evas_Coord gith = 0; @@ -510,10 +529,6 @@ static void _elm_genlist_item_unrealize(Elm_Gen_Item *it, Eina_Bool calc) { - Evas_Object *content; - Eina_List *l; - const char *part; - if (!it->realized) return; if (GL_IT(it)->wsd->reorder_it == it) return; @@ -522,15 +537,7 @@ _elm_genlist_item_unrealize(Elm_Gen_Item *it, evas_object_smart_callback_call(WIDGET(it), SIG_UNREALIZED, it); ELM_SAFE_FREE(it->long_timer, ecore_timer_del); - EINA_LIST_FOREACH(it->texts, l, part) - edje_object_part_text_set(VIEW(it), part, NULL); - - ELM_SAFE_FREE(it->texts, elm_widget_stringlist_free); - ELM_SAFE_FREE(it->contents, elm_widget_stringlist_free); - ELM_SAFE_FREE(it->states, elm_widget_stringlist_free); - - EINA_LIST_FREE(it->content_objs, content) - evas_object_del(content); + _view_clear(VIEW(it), &(it->texts), &(it->contents), &(it->states), &(it->content_objs)); ELM_SAFE_FREE(it->item_focus_chain, eina_list_free); @@ -3286,8 +3293,6 @@ _item_block_del(Elm_Gen_Item *it) static void _decorate_all_item_unrealize(Elm_Gen_Item *it) { - Evas_Object *icon; - if ((!it) || (!it->item->decorate_all_item_realized)) return; edje_object_part_unswallow(it->deco_all_view, VIEW(it)); @@ -3304,17 +3309,16 @@ _decorate_all_item_unrealize(Elm_Gen_Item *it) (it->deco_all_view, "elm,state,reorder,mode_unset", "elm"); } - ELM_SAFE_FREE(it->deco_all_view, evas_object_del); - ELM_SAFE_FREE(it->item->deco_all_texts, elm_widget_stringlist_free); - ELM_SAFE_FREE(it->item->deco_all_contents, elm_widget_stringlist_free); - ELM_SAFE_FREE(it->item->deco_all_states, elm_widget_stringlist_free); + _view_clear(it->deco_all_view, &(GL_IT(it)->deco_all_texts), + &(GL_IT(it)->deco_all_contents), &(GL_IT(it)->deco_all_states), + &(GL_IT(it)->deco_all_content_objs)); - EINA_LIST_FREE(it->item->deco_all_content_objs, icon) - evas_object_del(icon); edje_object_message_signal_process(it->deco_all_view); _item_mouse_callbacks_del(it, it->deco_all_view); _item_mouse_callbacks_add(it, VIEW(it)); + ELM_SAFE_FREE(it->deco_all_view, evas_object_del); + it->item->decorate_all_item_realized = EINA_FALSE; } @@ -4624,17 +4628,15 @@ static void _decorate_item_unrealize(Elm_Gen_Item *it) { ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd); - Evas_Object *content, *obj = sd->obj; + Evas_Object *obj = sd->obj; if (!it->item->deco_it_view) return; evas_event_freeze(evas_object_evas_get(obj)); - ELM_SAFE_FREE(it->item->deco_it_texts, elm_widget_stringlist_free); - ELM_SAFE_FREE(it->item->deco_it_contents, elm_widget_stringlist_free); - ELM_SAFE_FREE(it->item->deco_it_states, elm_widget_stringlist_free); - EINA_LIST_FREE(it->item->deco_it_content_objs, content) - evas_object_del(content); + _view_clear(GL_IT(it)->deco_it_view, &(GL_IT(it)->deco_it_texts), + &(GL_IT(it)->deco_it_contents), &(GL_IT(it)->deco_it_states), + &(GL_IT(it)->deco_it_content_objs)); edje_object_part_unswallow(it->item->deco_it_view, VIEW(it)); evas_object_smart_member_add(VIEW(it), sd->pan_obj); |