sanghyeonlee pushed a commit to branch master.

http://git.enlightenment.org/core/elementary.git/commit/?id=ee70e7fcbccbd93ac70892af1eb425c56f510e1a

commit ee70e7fcbccbd93ac70892af1eb425c56f510e1a
Author: SangHyeon Lee <sh10233....@samsung.com>
Date:   Tue Feb 16 15:28:45 2016 +0900

    gengrid: add all contents unset API for content unset and reusing
    
    Add elm_gengrid_item_all_contents_unset API for support content reuse
    and unset. User can get back content objects in unrealized smart callback 
in item.
    see elm_genlist_item_all_contents_unset also.
    
    @feature
---
 src/lib/elm_gengrid.c       | 18 ++++++++++++++++++
 src/lib/elm_gengrid_item.eo | 12 ++++++++++++
 2 files changed, 30 insertions(+)

diff --git a/src/lib/elm_gengrid.c b/src/lib/elm_gengrid.c
index 729f9cd..3d93480 100644
--- a/src/lib/elm_gengrid.c
+++ b/src/lib/elm_gengrid.c
@@ -984,6 +984,24 @@ _view_clear(Evas_Object *view, Eina_List **texts, 
Eina_List **contents)
      evas_object_del(c);
 }
 
+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)
+     {
+        evas_object_smart_member_del(content);
+        // edje can be reused by item caching,
+        // content should be un-swallowed from edje
+        edje_object_part_unswallow(VIEW(it), content);
+        evas_object_hide(content);
+        if (l) *l = eina_list_append(*l, content);
+     }
+}
+
 static void
 _elm_gengrid_item_unrealize(Elm_Gen_Item *it,
                             Eina_Bool calc)
diff --git a/src/lib/elm_gengrid_item.eo b/src/lib/elm_gengrid_item.eo
index efc8c4c..8bfc4e1 100644
--- a/src/lib/elm_gengrid_item.eo
+++ b/src/lib/elm_gengrid_item.eo
@@ -191,6 +191,18 @@ class Elm.Gengrid_Item(Elm.Widget_Item)
                      @in itc: const (Elm.Gengrid.Item.Class) *; [[The gengrid 
item class describing the function pointers and the item style.]]
                 }
            }
+           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.]]
+                }
+           }
       }
       implements {
            Eo.Base.constructor;

-- 


Reply via email to