summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Juyung Seo <seojuyung2@gmail.com>2014-07-27 01:19:57 -0700
committerDaniel Juyung Seo <seojuyung2@gmail.com>2014-07-27 01:19:57 -0700
commit8c526e7f8b7dc4dcfefc30e78577d45677e6cf97 (patch)
tree0c739b985f13b47ac9cf951a5392698e7bd0aacf
parentfaaeccc15f79a3ea69ccc7c77167c1d77cc16981 (diff)
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.c56
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)
445} 445}
446 446
447static void 447static void
448_view_clear(Evas_Object *view, Eina_List **texts, Eina_List **contents,
449 Eina_List **states, Eina_List **content_objs)
450{
451 const char *part;
452 Evas_Object *c;
453 const Eina_List *l;
454
455 EINA_LIST_FOREACH(*texts, l, part)
456 edje_object_part_text_set(view, part, NULL);
457
458 ELM_SAFE_FREE(*texts, elm_widget_stringlist_free);
459 ELM_SAFE_FREE(*contents, elm_widget_stringlist_free);
460 ELM_SAFE_FREE(*states, elm_widget_stringlist_free);
461
462 EINA_LIST_FREE(*content_objs, c)
463 evas_object_del(c);
464}
465
466static void
448_item_scroll(Elm_Genlist_Data *sd) 467_item_scroll(Elm_Genlist_Data *sd)
449{ 468{
450 Evas_Coord gith = 0; 469 Evas_Coord gith = 0;
@@ -510,10 +529,6 @@ static void
510_elm_genlist_item_unrealize(Elm_Gen_Item *it, 529_elm_genlist_item_unrealize(Elm_Gen_Item *it,
511 Eina_Bool calc) 530 Eina_Bool calc)
512{ 531{
513 Evas_Object *content;
514 Eina_List *l;
515 const char *part;
516
517 if (!it->realized) return; 532 if (!it->realized) return;
518 if (GL_IT(it)->wsd->reorder_it == it) return; 533 if (GL_IT(it)->wsd->reorder_it == it) return;
519 534
@@ -522,15 +537,7 @@ _elm_genlist_item_unrealize(Elm_Gen_Item *it,
522 evas_object_smart_callback_call(WIDGET(it), SIG_UNREALIZED, it); 537 evas_object_smart_callback_call(WIDGET(it), SIG_UNREALIZED, it);
523 ELM_SAFE_FREE(it->long_timer, ecore_timer_del); 538 ELM_SAFE_FREE(it->long_timer, ecore_timer_del);
524 539
525 EINA_LIST_FOREACH(it->texts, l, part) 540 _view_clear(VIEW(it), &(it->texts), &(it->contents), &(it->states), &(it->content_objs));
526 edje_object_part_text_set(VIEW(it), part, NULL);
527
528 ELM_SAFE_FREE(it->texts, elm_widget_stringlist_free);
529 ELM_SAFE_FREE(it->contents, elm_widget_stringlist_free);
530 ELM_SAFE_FREE(it->states, elm_widget_stringlist_free);
531
532 EINA_LIST_FREE(it->content_objs, content)
533 evas_object_del(content);
534 541
535 ELM_SAFE_FREE(it->item_focus_chain, eina_list_free); 542 ELM_SAFE_FREE(it->item_focus_chain, eina_list_free);
536 543
@@ -3286,8 +3293,6 @@ _item_block_del(Elm_Gen_Item *it)
3286static void 3293static void
3287_decorate_all_item_unrealize(Elm_Gen_Item *it) 3294_decorate_all_item_unrealize(Elm_Gen_Item *it)
3288{ 3295{
3289 Evas_Object *icon;
3290
3291 if ((!it) || (!it->item->decorate_all_item_realized)) return; 3296 if ((!it) || (!it->item->decorate_all_item_realized)) return;
3292 3297
3293 edje_object_part_unswallow(it->deco_all_view, VIEW(it)); 3298 edje_object_part_unswallow(it->deco_all_view, VIEW(it));
@@ -3304,17 +3309,16 @@ _decorate_all_item_unrealize(Elm_Gen_Item *it)
3304 (it->deco_all_view, "elm,state,reorder,mode_unset", "elm"); 3309 (it->deco_all_view, "elm,state,reorder,mode_unset", "elm");
3305 } 3310 }
3306 3311
3307 ELM_SAFE_FREE(it->deco_all_view, evas_object_del); 3312 _view_clear(it->deco_all_view, &(GL_IT(it)->deco_all_texts),
3308 ELM_SAFE_FREE(it->item->deco_all_texts, elm_widget_stringlist_free); 3313 &(GL_IT(it)->deco_all_contents), &(GL_IT(it)->deco_all_states),
3309 ELM_SAFE_FREE(it->item->deco_all_contents, elm_widget_stringlist_free); 3314 &(GL_IT(it)->deco_all_content_objs));
3310 ELM_SAFE_FREE(it->item->deco_all_states, elm_widget_stringlist_free);
3311 3315
3312 EINA_LIST_FREE(it->item->deco_all_content_objs, icon)
3313 evas_object_del(icon);
3314 edje_object_message_signal_process(it->deco_all_view); 3316 edje_object_message_signal_process(it->deco_all_view);
3315 _item_mouse_callbacks_del(it, it->deco_all_view); 3317 _item_mouse_callbacks_del(it, it->deco_all_view);
3316 _item_mouse_callbacks_add(it, VIEW(it)); 3318 _item_mouse_callbacks_add(it, VIEW(it));
3317 3319
3320 ELM_SAFE_FREE(it->deco_all_view, evas_object_del);
3321
3318 it->item->decorate_all_item_realized = EINA_FALSE; 3322 it->item->decorate_all_item_realized = EINA_FALSE;
3319} 3323}
3320 3324
@@ -4624,17 +4628,15 @@ static void
4624_decorate_item_unrealize(Elm_Gen_Item *it) 4628_decorate_item_unrealize(Elm_Gen_Item *it)
4625{ 4629{
4626 ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd); 4630 ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd);
4627 Evas_Object *content, *obj = sd->obj; 4631 Evas_Object *obj = sd->obj;
4628 4632
4629 if (!it->item->deco_it_view) return; 4633 if (!it->item->deco_it_view) return;
4630 4634
4631 evas_event_freeze(evas_object_evas_get(obj)); 4635 evas_event_freeze(evas_object_evas_get(obj));
4632 ELM_SAFE_FREE(it->item->deco_it_texts, elm_widget_stringlist_free);
4633 ELM_SAFE_FREE(it->item->deco_it_contents, elm_widget_stringlist_free);
4634 ELM_SAFE_FREE(it->item->deco_it_states, elm_widget_stringlist_free);
4635 4636
4636 EINA_LIST_FREE(it->item->deco_it_content_objs, content) 4637 _view_clear(GL_IT(it)->deco_it_view, &(GL_IT(it)->deco_it_texts),
4637 evas_object_del(content); 4638 &(GL_IT(it)->deco_it_contents), &(GL_IT(it)->deco_it_states),
4639 &(GL_IT(it)->deco_it_content_objs));
4638 4640
4639 edje_object_part_unswallow(it->item->deco_it_view, VIEW(it)); 4641 edje_object_part_unswallow(it->item->deco_it_view, VIEW(it));
4640 evas_object_smart_member_add(VIEW(it), sd->pan_obj); 4642 evas_object_smart_member_add(VIEW(it), sd->pan_obj);