From: Daniel Juyung Seo <juyung.seo@samsung.com>
authorDaniel Juyung Seo <juyung.seo@samsung.com>
Wed, 5 Jan 2011 05:59:30 +0000 (05:59 +0000)
committerCarsten Haitzler <raster@rasterman.com>
Wed, 5 Jan 2011 05:59:30 +0000 (05:59 +0000)
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

src/lib/elm_genlist.c

index 4c60536..a872133 100644 (file)
@@ -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;