On Sun, Nov 14, 2010 at 8:48 AM, Gustavo Sverzut Barbieri
<barbi...@profusion.mobi> wrote:
> On Sun, Nov 14, 2010 at 8:28 AM, Viktor Kojouharov
> <vkojouha...@gmail.com> wrote:
>> That doesn't seem right.
>>
>> elm_gengrid_item_data_set effectively calls elm_widget_item_data_set, which
>> sets the data in Elm_Widget_Item->data, whereas the data that is passed to
>> all the append|prepend functions is stored in Elm_Gengrid_Item->func.data.
>> To me, they look like totally different places, unless I'm missing
>> something.
>
> there are 2 data. One for the item as a whole, and another to be given
> to the func callback that is called when item is selected.
>
> Usually, they are the same, or the first contains the second, as you
> need to delete the second when the item dies.
>
> As raster and others said, you're likely trying to do a strange thing.
> You have 3 steps for genlist/gengrid:
> - view death (use evas_object_event_callback_add with EVAS_CALLBACK_DEL)
> - item unrealize (use evas_object_smart_callback_add with "unrealized")
> - item death (use item_del_cb_set[1])
>
> The first one is called more than unrealize, because when item is
> updated it may destroy the existing view and create a new one,
> repopulating it with new labels, icons and state.
>
> The second is called whenever the object goes off screen and thus is
> not necessary anymore, the container widget (genlist/gengrid) may
> choose a point to kill the view to save memory. Right now this is
> immediate, but may be changed in future to reduce deletion/creation of
> items.
>
> The third one is, for some weird reason, not available. I really don't
> know/remember why there are no
> elm_{gengrid,genlist}_item_del_cb_set(). Similarly to others it would
> be a simple wrapper around elm_widget_item_del_cb_set(). I'll wait
> for dudes at ProFUSION (bdilly? tiagofalcao?) to refresh my memory and
> tell why we did not add them, or if we just forgot and they should be
> added.
I'm enjoying something else today.
But looking quickly at these widgets code, looks like func.del is
intended for use when items are deleted.
I believe these item classes stuff was added
before then widget_item generalization, so maybe we can remove
func.del and use del_cb_set?
Or am I missing something and they are intended to be used under
different circumstances?
If you need to add del_cb_set urgently, use the attached patch.
> With this third case you'd get the call even on elm_*_clear(), and
> as parameter you get the item data.
>
> --
> Gustavo Sverzut Barbieri
> http://profusion.mobi embedded systems
> --------------------------------------
> MSN: barbi...@gmail.com
> Skype: gsbarbieri
> Mobile: +55 (19) 9225-2202
>
> ------------------------------------------------------------------------------
> Centralized Desktop Delivery: Dell and VMware Reference Architecture
> Simplifying enterprise desktop deployment and management using
> Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
> client virtualization framework. Read more!
> http://p.sf.net/sfu/dell-eql-dev2dev
> _______________________________________________
> enlightenment-devel mailing list
> enlightenment-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
>
commit 213d398f74c8cb82d884dbcdb9139ad5414635e4
Author: Bruno Dilly <bdi...@profusion.mobi>
Date: Tue Nov 16 11:53:22 2010 -0200
Add missing elm_gen(grid|list)_item_del_cb_set funcs
diff --git a/src/lib/Elementary.h.in b/src/lib/Elementary.h.in
index 95b1d69..2ad0b09 100644
--- a/src/lib/Elementary.h.in
+++ b/src/lib/Elementary.h.in
@@ -805,6 +805,7 @@ extern "C" {
EAPI Elm_Gengrid_Item *elm_gengrid_item_prev_get(const Elm_Gengrid_Item *item);
EAPI Evas_Object *elm_gengrid_item_gengrid_get(const Elm_Gengrid_Item *item);
EAPI void elm_gengrid_item_del(Elm_Gengrid_Item *item);
+ EAPI void elm_gengrid_item_del_cb_set(Elm_Gengrid_Item *it, Evas_Smart_Cb func);
EAPI void elm_gengrid_item_update(Elm_Gengrid_Item *item);
EAPI void *elm_gengrid_item_data_get(const Elm_Gengrid_Item *item);
EAPI void elm_gengrid_item_data_set(Elm_Gengrid_Item *item, const void *data);
@@ -1660,6 +1661,7 @@ extern "C" {
EAPI void elm_genlist_item_middle_show(Elm_Genlist_Item *it);
EAPI void elm_genlist_item_middle_bring_in(Elm_Genlist_Item *it);
EAPI void elm_genlist_item_del(Elm_Genlist_Item *item);
+ EAPI void elm_genlist_item_del_cb_set(Elm_Genlist_Item *it, Evas_Smart_Cb func);
EAPI void *elm_genlist_item_data_get(const Elm_Genlist_Item *item);
EAPI void elm_genlist_item_data_set(Elm_Genlist_Item *it, const void *data);
EAPI void elm_genlist_item_icons_orphan(Elm_Genlist_Item *it);
diff --git a/src/lib/elm_gengrid.c b/src/lib/elm_gengrid.c
index 082e5c6..a3215b8 100644
--- a/src/lib/elm_gengrid.c
+++ b/src/lib/elm_gengrid.c
@@ -1766,6 +1766,21 @@ elm_gengrid_item_del(Elm_Gengrid_Item *item)
}
/**
+ * Set the function called when a gengrid item is freed.
+ *
+ * @param item The item to set the callback on
+ * @param func The function called
+ *
+ * @ingroup Gengrid
+ */
+EAPI void
+elm_gengrid_item_del_cb_set(Elm_Gengrid_Item *item, Evas_Smart_Cb func)
+{
+ ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
+ elm_widget_item_del_cb_set(item, func);
+}
+
+/**
* Set for what direction the Gengrid will expand.
*
* @param obj The Gengrid object.
diff --git a/src/lib/elm_genlist.c b/src/lib/elm_genlist.c
index 8953244..71e74ef 100644
--- a/src/lib/elm_genlist.c
+++ b/src/lib/elm_genlist.c
@@ -3447,6 +3447,21 @@ elm_genlist_item_del(Elm_Genlist_Item *it)
}
/**
+ * Set the function called when a genlist item is freed.
+ *
+ * @param item The item to set the callback on
+ * @param func The function called
+ *
+ * @ingroup Genlist
+ */
+EAPI void
+elm_genlist_item_del_cb_set(Elm_Genlist_Item *item, Evas_Smart_Cb func)
+{
+ ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
+ elm_widget_item_del_cb_set(item, func);
+}
+
+/**
* Set the data item from the genlist item
*
* This set the data value passed on the elm_genlist_item_append() and
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
Spend less time writing and rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel