gengrid : add all_contents_unset API in gengrid for reusing contents.
authorSangHyeon Lee <sh10233.lee@samsung.com>
Mon, 12 Oct 2015 05:41:44 +0000 (14:41 +0900)
committerSangHyeon Lee <sh10233.lee@samsung.com>
Mon, 12 Oct 2015 05:42:37 +0000 (14:42 +0900)
Summary:
Add elm_gengrid_item_all_contents_unset API for reusing contents in application side.
User can unset all contents or re-use their contents for increase scrolling performance.
genlist already support this API.

@feature

Test Plan: Need to add test in elementary_test.

Reviewers: raster, singh.amitesh, cedric

Subscribers: woohyun, Hermet, seoz

Differential Revision: https://phab.enlightenment.org/D3066

src/lib/elm_gengrid.c
src/lib/elm_gengrid_item.eo

index 01c72ccef658f47ecd6a6018b3dcc3c59140225d..c3dead7c501154bc5764d027080345c08d470772 100644 (file)
@@ -4584,6 +4584,22 @@ elm_gengrid_item_object_get(const Elm_Object_Item *eo_it)
    return VIEW(it);
 }
 
+EOLIAN static void
+_elm_gengrid_item_all_contents_unset(Eo *eo_item EINA_UNUSED, Elm_Gen_Item *it, Eina_List **l)
+{
+   Evas_Object *content;
+
+   ELM_GENGRID_ITEM_CHECK_OR_RETURN(it);
+
+   EINA_LIST_FREE(it->contents, content)
+     {
+        elm_widget_sub_object_del(WIDGET(it), content);
+        edje_object_part_unswallow(VIEW(it), content);
+        evas_object_hide(content);
+        if (l) *l = eina_list_append(*l, content);
+     }
+}
+
 EOLIAN static void
 _elm_gengrid_item_update(Eo *eo_item EINA_UNUSED, Elm_Gen_Item *it)
 {
index 95a079c79aefc851f6a78a1cbe5fd8a78756875e..7da7ff53dca7df10881063a471ba38cacccbc28d 100644 (file)
@@ -154,6 +154,18 @@ class Elm.Gengrid_Item(Elm.Widget_Item)
                      @in type: Elm_Gengrid_Item_Scrollto_Type; [[Where to position the item in the viewport.]]
                 }
            }
+           all_contents_unset {
+                [[Unset all contents fetched by the item class.
+
+                  This instructs gengrid to release references to contents
+                  in the item, meaning that they will no longer be managed
+                  by gengrid and are floating "orphans" that can be re-used
+                  elsewhere if the user wants to.
+                ]]
+                params {
+                     @out l: own(list<own(Evas.Object *)> *); [[The contents list to return.]]
+                }
+           }
            update {
                 [[Update the contents of a given gengrid item