From: Enlightenment S. <no-...@en...> - 2012-01-27 11:59:29
|
Log: elementary/genlist - deprecated elm_genlist_item_del() now let's use elm_object_item_del() API. and deprecated elm_genlist_horizontal_get() APIS also. Author: hermet Date: 2012-01-27 03:59:22 -0800 (Fri, 27 Jan 2012) New Revision: 67566 Trac: http://trac.enlightenment.org/e/changeset/67566 Modified: trunk/elementary/src/bin/test_genlist.c trunk/elementary/src/edje_externals/elm_genlist.c trunk/elementary/src/examples/genlist_example_05.c trunk/elementary/src/lib/elm_deprecated.h trunk/elementary/src/lib/elm_genlist.c trunk/elementary/src/lib/elm_genlist.h Modified: trunk/elementary/src/bin/test_genlist.c =================================================================== --- trunk/elementary/src/bin/test_genlist.c 2012-01-27 11:56:14 UTC (rev 67565) +++ trunk/elementary/src/bin/test_genlist.c 2012-01-27 11:59:22 UTC (rev 67566) @@ -126,7 +126,7 @@ evas_object_smart_callback_add(gl, "longpressed", _gl_longpress, NULL); // FIXME: This causes genlist to resize the horiz axis very slowly :( // Reenable this and resize the window horizontally, then try to resize it back - //elm_genlist_horizontal_mode_set(gl, ELM_LIST_LIMIT); + //elm_genlist_mode_set(gl, ELM_LIST_LIMIT); evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_box_pack_end(bx, gl); @@ -273,7 +273,7 @@ printf("no item selected\n"); return; } - elm_genlist_item_del(gli); + elm_object_item_del(gli); } static void Modified: trunk/elementary/src/edje_externals/elm_genlist.c =================================================================== --- trunk/elementary/src/edje_externals/elm_genlist.c 2012-01-27 11:56:14 UTC (rev 67565) +++ trunk/elementary/src/edje_externals/elm_genlist.c 2012-01-27 11:59:22 UTC (rev 67566) @@ -53,7 +53,7 @@ Elm_List_Mode set = _list_horizontal_setting_get(p->horizontal); if (set != ELM_LIST_LAST) - elm_genlist_horizontal_set(obj, set); + elm_genlist_mode_set(obj, set); } if (p->multi_exists) elm_genlist_multi_select_set(obj, p->multi); @@ -89,7 +89,7 @@ Elm_List_Mode set = _list_horizontal_setting_get(param->s); if (set == ELM_LIST_LAST) return EINA_FALSE; - elm_genlist_horizontal_set(obj, set); + elm_genlist_mode_set(obj, set); return EINA_TRUE; } } @@ -167,7 +167,7 @@ { if (param->type == EDJE_EXTERNAL_PARAM_TYPE_CHOICE) { - Elm_List_Mode list_horizontal_set = elm_genlist_horizontal_get(obj); + Elm_List_Mode list_horizontal_set = elm_genlist_mode_get(obj); if (list_horizontal_set == ELM_LIST_LAST) return EINA_FALSE; Modified: trunk/elementary/src/examples/genlist_example_05.c =================================================================== --- trunk/elementary/src/examples/genlist_example_05.c 2012-01-27 11:56:14 UTC (rev 67565) +++ trunk/elementary/src/examples/genlist_example_05.c 2012-01-27 11:59:22 UTC (rev 67566) @@ -180,7 +180,7 @@ // Changing leaf item to parent item if (change_item) { - elm_genlist_item_del(glit); + elm_object_item_del(glit); if (glit_prev != glit_parent) glit = elm_genlist_item_insert_after(list, &_itp, d, glit_parent, @@ -226,7 +226,7 @@ Node_Data *pdata, *d = elm_object_item_data_get(glit); glit_parent = elm_genlist_item_parent_get(glit); elm_genlist_item_subitems_clear(glit); - elm_genlist_item_del(glit); + elm_object_item_del(glit); _clear_list(d); Modified: trunk/elementary/src/lib/elm_deprecated.h =================================================================== --- trunk/elementary/src/lib/elm_deprecated.h 2012-01-27 11:56:14 UTC (rev 67565) +++ trunk/elementary/src/lib/elm_deprecated.h 2012-01-27 11:59:22 UTC (rev 67566) @@ -1738,7 +1738,7 @@ * @deprecated use elm_genlist_mode_get() * @ingroup Genlist */ -EAPI Elm_List_Mode elm_genlist_horizontal_get(const Evas_Object *obj); +EINA_DEPRECATED EAPI Elm_List_Mode elm_genlist_horizontal_get(const Evas_Object *obj); /** * Return the data associated to a given genlist item @@ -1807,6 +1807,20 @@ */ EINA_DEPRECATED EAPI Eina_Bool elm_genlist_item_disabled_get(const Elm_Object_Item *it); +/** + * Remove a genlist item from the its parent, deleting it. + * + * @param it The item to be removed. + * @return @c EINA_TRUE on success or @c EINA_FALSE, otherwise. + * + * @see elm_genlist_clear(), to remove all items in a genlist at + * once. + * + * @deprecated Use elm_object_item_del() instead + * @ingroup Genlist + */ +EINA_DEPRECATED EAPI void elm_genlist_item_del(Elm_Object_Item *it); + #define ELM_IMAGE_ROTATE_90_CW 1 #define ELM_IMAGE_ROTATE_180_CW 2 #define ELM_IMAGE_ROTATE_90_CCW 3 Modified: trunk/elementary/src/lib/elm_genlist.c =================================================================== --- trunk/elementary/src/lib/elm_genlist.c 2012-01-27 11:56:14 UTC (rev 67565) +++ trunk/elementary/src/lib/elm_genlist.c 2012-01-27 11:59:22 UTC (rev 67566) @@ -3202,7 +3202,11 @@ { if ((!it->walking) && (it->generation < it->wd->generation)) { - if (!it->relcount) it->del_cb(it); + if (!it->relcount) + { + it->del_cb(it); + elm_widget_item_free(it); + } } else it->wd->last_selected_item = it; @@ -3263,6 +3267,36 @@ } } +static Eina_Bool +_item_del_pre_hook(Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE); + Elm_Gen_Item *_it = (Elm_Gen_Item *) it; + + if ((_it->relcount > 0) || (_it->walking > 0)) + { + elm_genlist_item_subitems_clear(it); + if (_it->wd->show_item == _it) _it->wd->show_item = NULL; + _elm_genlist_item_del_notserious(_it); + if (_it->item->block) + { + if (_it->realized) _elm_genlist_item_unrealize(_it, EINA_FALSE); + _it->item->block->changed = EINA_TRUE; + if (_it->wd->calc_job) ecore_job_del(_it->wd->calc_job); + _it->wd->calc_job = ecore_job_add(_calc_job, _it->wd); + } + if (_it->parent) + { + _it->parent->item->items = + eina_list_remove(_it->parent->item->items, it); + _it->parent = NULL; + } + return EINA_FALSE; + } + _item_del(_it); + return EINA_TRUE; +} + Elm_Gen_Item * _elm_genlist_item_new(Widget_Data *wd, const Elm_Gen_Item_Class *itc, @@ -3286,6 +3320,7 @@ elm_widget_item_content_set_hook_set(it, _item_content_set_hook); elm_widget_item_content_unset_hook_set(it, _item_content_unset_hook); elm_widget_item_disable_hook_set(it, _item_disable_hook); + elm_widget_item_del_pre_hook_set(it, _item_del_pre_hook); /* TEMPORARY */ it->sel_cb = (Ecore_Cb)_item_select; @@ -3504,7 +3539,10 @@ { it->item->rel->relcount--; if ((it->item->rel->generation < it->wd->generation) && (!it->item->rel->relcount)) - _item_del(it->item->rel); + { + _item_del(it->item->rel); + elm_widget_item_free(it->item->rel); + } it->item->rel = NULL; } if (itb->count > itb->wd->max_items_per_block) @@ -4065,6 +4103,7 @@ if (next) itn = ELM_GEN_ITEM_FROM_INLIST(next); if (itn) itn->walking++; /* prevent early death of subitem */ it->del_cb(it); + elm_widget_item_free(it); if (itn) itn->walking--; } } @@ -4295,7 +4334,7 @@ EINA_LIST_FOREACH(_it->item->items, l, it2) tl = eina_list_append(tl, it2); EINA_LIST_FREE(tl, it2) - elm_genlist_item_del(it2); + elm_object_item_del(it2); } EAPI void @@ -4613,30 +4652,7 @@ EAPI void elm_genlist_item_del(Elm_Object_Item *it) { - ELM_OBJ_ITEM_CHECK_OR_RETURN(it); - Elm_Gen_Item *_it = (Elm_Gen_Item *) it; - - if ((_it->relcount > 0) || (_it->walking > 0)) - { - elm_genlist_item_subitems_clear(it); - if (_it->wd->show_item == _it) _it->wd->show_item = NULL; - _elm_genlist_item_del_notserious(_it); - if (_it->item->block) - { - if (_it->realized) _elm_genlist_item_unrealize(_it, EINA_FALSE); - _it->item->block->changed = EINA_TRUE; - if (_it->wd->calc_job) ecore_job_del(_it->wd->calc_job); - _it->wd->calc_job = ecore_job_add(_calc_job, _it->wd); - } - if (_it->parent) - { - _it->parent->item->items = - eina_list_remove(_it->parent->item->items, it); - _it->parent = NULL; - } - return; - } - _item_del(_it); + elm_object_item_del(it); } EAPI void @@ -5473,5 +5489,4 @@ it->item = NULL; if (it->wd->last_selected_item == it) it->wd->last_selected_item = NULL; - elm_widget_item_del(it); } Modified: trunk/elementary/src/lib/elm_genlist.h =================================================================== --- trunk/elementary/src/lib/elm_genlist.h 2012-01-27 11:56:14 UTC (rev 67565) +++ trunk/elementary/src/lib/elm_genlist.h 2012-01-27 11:59:22 UTC (rev 67566) @@ -131,7 +131,7 @@ * the indicated item. * * The application can clear the list with elm_genlist_clear() which deletes - * all the items in the list and elm_genlist_item_del() will delete a specific + * all the items in the list and elm_object_item_del() will delete a specific * item. elm_genlist_item_subitems_clear() will clear all items that are * children of the indicated parent item. * @@ -420,7 +420,7 @@ * This function inserts a new genlist widget on the canvas. * * @see elm_genlist_item_append() - * @see elm_genlist_item_del() + * @see elm_object_item_del() * @see elm_genlist_clear() * * @ingroup Genlist @@ -434,7 +434,7 @@ * * This removes (and deletes) all items in @p obj, leaving it empty. * - * @see elm_genlist_item_del(), to remove just one item. + * @see elm_object_item_del(), to remove just one item. * * @ingroup Genlist */ @@ -782,7 +782,7 @@ * @see elm_genlist_item_prepend() * @see elm_genlist_item_insert_before() * @see elm_genlist_item_insert_after() - * @see elm_genlist_item_del() + * @see elm_object_item_del() * * @ingroup Genlist */ @@ -806,7 +806,7 @@ * @see elm_genlist_item_append() * @see elm_genlist_item_insert_before() * @see elm_genlist_item_insert_after() - * @see elm_genlist_item_del() + * @see elm_object_item_del() * * @ingroup Genlist */ @@ -830,7 +830,7 @@ * @see elm_genlist_item_append() * @see elm_genlist_item_prepend() * @see elm_genlist_item_insert_after() - * @see elm_genlist_item_del() + * @see elm_object_item_del() * * @ingroup Genlist */ @@ -854,7 +854,7 @@ * @see elm_genlist_item_append() * @see elm_genlist_item_prepend() * @see elm_genlist_item_insert_before() - * @see elm_genlist_item_del() + * @see elm_object_item_del() * * @ingroup Genlist */ @@ -1118,7 +1118,7 @@ * given item @p it. * * @see elm_genlist_clear() - * @see elm_genlist_item_del() + * @see elm_object_item_del() * * @ingroup Genlist */ @@ -1345,19 +1345,6 @@ EAPI void elm_genlist_item_middle_bring_in(Elm_Object_Item *it); /** - * Remove a genlist item from the its parent, deleting it. - * - * @param it The item to be removed. - * @return @c EINA_TRUE on success or @c EINA_FALSE, otherwise. - * - * @see elm_genlist_clear(), to remove all items in a genlist at - * once. - * - * @ingroup Genlist - */ -EAPI void elm_genlist_item_del(Elm_Object_Item *it); - -/** * Tells genlist to "orphan" contents fetchs by the item class * * @param it The item |