Genlist: reset item tree expanded state when putting item in cache
authorDave Andreoli <dave@gurumeditation.it>
Thu, 27 Aug 2015 19:37:50 +0000 (21:37 +0200)
committerDave Andreoli <dave@gurumeditation.it>
Thu, 27 Aug 2015 19:40:08 +0000 (21:40 +0200)
Item expandend state need to be resetted (contracted) when the
item goes in the items cache, otherwise when the item will be reused
it will have unwanted state (expanded).

Quite visible in the "Genlist Tree and Decorate All Mode" test

@fix

src/lib/elm_genlist.c

index 6e1563e..49afbd8 100644 (file)
@@ -1522,7 +1522,12 @@ _item_cache_add(Elm_Gen_Item *it)
    itc->spacer = it->spacer;
    itc->base_view = VIEW(it);
    itc->item_style = eina_stringshare_add(it->itc->item_style);
-   if (it->item->type & ELM_GENLIST_ITEM_TREE) itc->tree = 1;
+   if (it->item->type & ELM_GENLIST_ITEM_TREE)
+     {
+        itc->tree = 1;
+        if (it->item->expanded)
+          edje_object_signal_emit(itc->base_view, SIGNAL_CONTRACTED, "elm");
+     }
 
    if (it->selected)
      edje_object_signal_emit(itc->base_view, SIGNAL_UNSELECTED, "elm");