[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[core/elementary] master 01/01: elementary/elm_object_item - delete the track objects when genlist/gengrid items are unrealized.



hermet pushed a commit to branch master.

commit e380efe41deb856a4b208df54377cdeb2785cdb7
Author: ChunEon Park <hermet@hermet.pe.kr>
Date:   Fri Sep 13 14:19:41 2013 +0900

    elementary/elm_object_item - delete the track objects when genlist/gengrid items are unrealized.
---
 src/lib/elm_gengrid.c |  3 +++
 src/lib/elm_genlist.c |  3 +++
 src/lib/elm_widget.c  | 13 +++++++++++++
 src/lib/elm_widget.h  | 10 +++++++++-
 4 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/src/lib/elm_gengrid.c b/src/lib/elm_gengrid.c
index f4fcb06..913dc50 100644
--- a/src/lib/elm_gengrid.c
+++ b/src/lib/elm_gengrid.c
@@ -548,6 +548,9 @@ _elm_gengrid_item_unrealize(Elm_Gen_Item *it,
 
    it->realized = EINA_FALSE;
    it->want_unrealize = EINA_FALSE;
+
+   elm_widget_item_track_cancel(it);
+
    evas_event_thaw(evas_object_evas_get(WIDGET(it)));
    evas_event_thaw_eval(evas_object_evas_get(WIDGET(it)));
 }
diff --git a/src/lib/elm_genlist.c b/src/lib/elm_genlist.c
index 99da991..5c1a756 100644
--- a/src/lib/elm_genlist.c
+++ b/src/lib/elm_genlist.c
@@ -347,6 +347,9 @@ _elm_genlist_item_unrealize(Elm_Gen_Item *it,
 
    it->realized = EINA_FALSE;
    it->want_unrealize = EINA_FALSE;
+
+   elm_widget_item_track_cancel(it);
+
    evas_event_thaw(evas_object_evas_get(WIDGET(it)));
    evas_event_thaw_eval(evas_object_evas_get(WIDGET(it)));
 }
diff --git a/src/lib/elm_widget.c b/src/lib/elm_widget.c
index 4705412..9cd945c 100644
--- a/src/lib/elm_widget.c
+++ b/src/lib/elm_widget.c
@@ -5266,6 +5266,19 @@ _elm_widget_item_domain_part_text_translatable_set(Elm_Widget_Item *item,
    item->on_translate = EINA_FALSE;
 }
 
+EAPI void
+_elm_widget_item_track_cancel(Elm_Widget_Item *item)
+{
+   ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
+
+   if (!item->track_obj) return;
+
+   while (evas_object_ref_get(item->track_obj) > 0)
+     evas_object_unref(item->track_obj);
+
+   evas_object_del(item->track_obj);
+}
+
 EAPI Evas_Object *
 elm_widget_item_track(Elm_Widget_Item *item)
 {
diff --git a/src/lib/elm_widget.h b/src/lib/elm_widget.h
index 6b65601..fb85c2a 100644
--- a/src/lib/elm_widget.h
+++ b/src/lib/elm_widget.h
@@ -776,6 +776,7 @@ EAPI void             _elm_widget_item_domain_part_text_translatable_set(Elm_Wid
 EAPI Evas_Object     *elm_widget_item_track(Elm_Widget_Item *item);
 EAPI void             elm_widget_item_untrack(Elm_Widget_Item *item);
 EAPI int              elm_widget_item_track_get(const Elm_Widget_Item *item);
+EAPI void             _elm_widget_item_track_cancel(Elm_Widget_Item *item);
 
 /**
  * Function to operate on a given widget's scrollabe children when necessary.
@@ -1000,8 +1001,15 @@ EAPI void             elm_widget_tree_dot_dump(const Evas_Object *top, FILE *out
   _elm_widget_item_del_pre_hook_set((Elm_Widget_Item *)item, (Elm_Widget_Del_Pre_Cb)func)
 
 /**
+ * Convenience function to query track_cancel.
+ * @see _elm_widget_item_del_pre_hook_set()
+ */
+#define elm_widget_item_track_cancel(item) \
+  _elm_widget_item_track_cancel((Elm_Widget_Item *)item)
+
+/**
  * Convenience function to query translate hook.
- * @see _elm_widget_item_translate()
+ * @see _elm_widget_item_track_cancel()
  */
 #define elm_widget_item_translate(item) \
   _elm_widget_item_translate((Elm_Widget_Item *)item)

--