From a74c497ffb7dd965236af4ecb9945b9357d071ac Mon Sep 17 00:00:00 2001 From: Michael BOUCHAUD Date: Wed, 14 Nov 2012 15:46:14 +0000 Subject: [PATCH] elmentary: add elm_genlist_nth_item_get SVN revision: 79295 --- legacy/elementary/ChangeLog | 6 +++++- legacy/elementary/NEWS | 1 + legacy/elementary/src/lib/elm_genlist.c | 20 ++++++++++++++++++++ legacy/elementary/src/lib/elm_genlist.h | 17 +++++++++++++++++ 4 files changed, 43 insertions(+), 1 deletion(-) diff --git a/legacy/elementary/ChangeLog b/legacy/elementary/ChangeLog index c0dcad4ea2..95aa6f814d 100644 --- a/legacy/elementary/ChangeLog +++ b/legacy/elementary/ChangeLog @@ -675,6 +675,10 @@ * Add elm_toolbar_item_show/bring_in. It show or bring a specific item, when the toolbar can be scrolled. -2012-10-25 Michael Bouchaud (yoz) +2012-11-12 Michael Bouchaud (yoz) * Add missing selected event in elm_index (elm_index_item_selected_set) + +2012-11-14 Michael Bouchaud (yoz) + + * Add elm_genlist_nth_item_get diff --git a/legacy/elementary/NEWS b/legacy/elementary/NEWS index baf0e8b69b..3ec8b7a78e 100644 --- a/legacy/elementary/NEWS +++ b/legacy/elementary/NEWS @@ -14,6 +14,7 @@ Additions: * Add elm_notify_align_set/get * Add virtualkeypad, clipboard state change signals from conformant. * Add elm_toolbar_item_show/bring_in. + * Add elm_genlist_nth_item_get Improvements: diff --git a/legacy/elementary/src/lib/elm_genlist.c b/legacy/elementary/src/lib/elm_genlist.c index 01c6710d18..a5c9899c8d 100644 --- a/legacy/elementary/src/lib/elm_genlist.c +++ b/legacy/elementary/src/lib/elm_genlist.c @@ -6761,3 +6761,23 @@ elm_genlist_tree_effect_enabled_get(const Evas_Object *obj) return sd->tree_effect_enabled; } +EAPI Elm_Object_Item * +elm_genlist_nth_item_get(const Evas_Object *obj, unsigned int nth) +{ + Elm_Gen_Item *it = NULL; + Eina_Accessor *a; + void *data; + + ELM_GENLIST_CHECK(obj) NULL; + ELM_GENLIST_DATA_GET(obj, sd); + + if (!sd->items) return NULL; + + a = eina_inlist_accessor_new(sd->items); + if (!a) return NULL; + if (eina_accessor_data_get(a, nth, &data)) + it = ELM_GEN_ITEM_FROM_INLIST(data); + eina_accessor_free(a); + return (Elm_Object_Item *)it; +} + diff --git a/legacy/elementary/src/lib/elm_genlist.h b/legacy/elementary/src/lib/elm_genlist.h index 65559dc4cf..cd850cbacb 100644 --- a/legacy/elementary/src/lib/elm_genlist.h +++ b/legacy/elementary/src/lib/elm_genlist.h @@ -1913,6 +1913,23 @@ elm_genlist_item_select_mode_set(Elm_Object_Item *it, EAPI Elm_Object_Select_Mode elm_genlist_item_select_mode_get(const Elm_Object_Item *it); + +/** + * Get the nth item, in a given genlist widget, placed at position @p nth, in + * its internal items list + * + * @param obj The genlist object + * @param nth The number of the item to grab (0 being the first) + * + * @return The item stored in @p obj at position @p nth or @c NULL, if there's + * no item with that index (and on errors) + * + * @ingroup Genilst + * @since 1.8 + */ +EAPI Elm_Object_Item * +elm_genlist_nth_item_get(const Evas_Object *obj, unsigned int nth); + /** * @} */