From c18254de7fae0de0f5e10b69bb93838182d6d4b0 Mon Sep 17 00:00:00 2001 From: Daniel Juyung Seo Date: Wed, 5 Jan 2011 05:59:30 +0000 Subject: [PATCH] From: Daniel Juyung Seo Subject: [E-devel] [Patch] Tree support for elm_genlist_item_prepend() API. I added tree feature support to elm_genlist_item_prepend() API. (elm_genlist_item_append() already supports tree.) This patch is tested with elementary_test -> Genlist Tree. Please review this and apply it to upstream. SVN revision: 55868 --- legacy/elementary/src/lib/elm_genlist.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/legacy/elementary/src/lib/elm_genlist.c b/legacy/elementary/src/lib/elm_genlist.c index 4c605362d0..a87213393f 100644 --- a/legacy/elementary/src/lib/elm_genlist.c +++ b/legacy/elementary/src/lib/elm_genlist.c @@ -2688,12 +2688,23 @@ elm_genlist_item_prepend(Evas_Object *obj, if (!wd) return NULL; if (!it) return NULL; if (!it->parent) - wd->items = eina_inlist_prepend(wd->items, EINA_INLIST_GET(it)); + { + wd->items = eina_inlist_prepend(wd->items, EINA_INLIST_GET(it)); + it->rel = NULL; + } else { - printf("FIXME: 12 tree not handled yet\n"); + Elm_Genlist_Item *it2 = NULL; + Eina_List *ll = it->parent->items; + if (ll) it2 = ll->data; + it->parent->items = eina_list_prepend(it->parent->items, it); + if (!it2) it2 = it->parent; + wd->items = + eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it), + EINA_INLIST_GET(it2)); + it->rel = it2; + it->rel->relcount++; } - it->rel = NULL; it->before = EINA_TRUE; _item_queue(wd, it); return it;