elm genlist: Fixed item addition routine for group child items.
authorseoz <seoz@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 2 Aug 2011 06:50:34 +0000 (06:50 +0000)
committerseoz <seoz@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 2 Aug 2011 06:50:34 +0000 (06:50 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@61980 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/elm_genlist.c

index b7f6830..b7c129b 100644 (file)
@@ -3054,6 +3054,14 @@ _item_new(Widget_Data                  *wd,
    it->func.data = func_data;
    it->mouse_cursor = NULL;
    it->expanded_depth = 0;
+
+   if (it->parent)
+     {
+        if (it->parent->flags & ELM_GENLIST_ITEM_GROUP)
+          it->group_item = parent;
+        else if (it->parent->group_item)
+          it->group_item = it->parent->group_item;
+     }
    return it;
 }
 
@@ -3399,11 +3407,6 @@ elm_genlist_item_append(Evas_Object                  *obj,
                                       EINA_INLIST_GET(it2));
         it->rel = it2;
         it->rel->relcount++;
-
-        if (it->parent->flags & ELM_GENLIST_ITEM_GROUP)
-          it->group_item = parent;
-        else if (it->parent->group_item)
-          it->group_item = it->parent->group_item;
      }
    it->before = EINA_FALSE;
    _item_queue(wd, it);
@@ -3467,7 +3470,14 @@ elm_genlist_item_insert_before(Evas_Object                  *obj,
    Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func,
                                     func_data);
    if (!it) return NULL;
-   if (it->parent)
+   if (!it->parent)
+     {
+        if ((flags & ELM_GENLIST_ITEM_GROUP) &&
+            (before->flags & ELM_GENLIST_ITEM_GROUP))
+          wd->group_items = eina_list_prepend_relative(wd->group_items, it,
+                                                       before);
+     }
+   else
      {
         it->parent->items = eina_list_prepend_relative(it->parent->items, it,
                                                        before);
@@ -3526,11 +3536,6 @@ elm_genlist_item_direct_sorted_insert(Evas_Object                  *obj,
              wd->items = eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(rel));
              it->before = EINA_TRUE;
           }
-
-        if (it->parent->flags & ELM_GENLIST_ITEM_GROUP)
-          it->group_item = parent;
-        else if (it->parent->group_item)
-          it->group_item = it->parent->group_item;
      }
    else
      {
@@ -3601,7 +3606,14 @@ elm_genlist_item_insert_after(Evas_Object                  *obj,
 
    wd->items = eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it),
                                            EINA_INLIST_GET(after));
-   if (it->parent)
+   if (!it->parent)
+     {
+        if ((flags & ELM_GENLIST_ITEM_GROUP) &&
+            (after->flags & ELM_GENLIST_ITEM_GROUP))
+          wd->group_items = eina_list_append_relative(wd->group_items, it,
+                                                      after);
+     }
+   else
      {
         it->parent->items = eina_list_append_relative(it->parent->items, it,
                                                       after);