On Fri, 6 Jan 2012 17:48:59 +0900 Hyoyoung Chang <hyoyo...@gmail.com> said:

ok - i dont like passing all tyhe funcs as params. please do it this way:

EAPI Elm_Genlist_Item_Class *elm_genlist_item_class_new(void);
EAPI void                    elm_genlist_item_class_free(Elm_Genlist_Item_Class
*itc);
EAPI void                    elm_genlist_item_class_ref(Elm_Genlist_Item_Class
*itc);
EAPI void                    elm_genlist_item_class_unref(lm_Genlist_Item_Class
*itc);

now ADD a version field to the top of the current item class and a refcount
number. ref and unref just add and sub from the refcount number - as does free
(free can just call unref - i'm only adding it to pair with new). new just
calloc()'s the item class struct and fills in version # and sets refcount to 1.
if ref goes to 0 then free the class.

now... every genlist item that uses this class should ref() the class.every
item from a genlist thats deleted should unref() it. now the issue ca be solved
by unref or free()ing the item classes u created for use in the gnelist on del
of the genlist obj (u can attach a del callback). they will not be freed then
until refs hit 0, but on obj del they can set func ptr's to null thus making it
safe.

> Dear all
> 
> This patch introduces four new apis about elm_gen{list, grid} item
> class managements.
> itc_add function makes a new item_class for the given widget.
> And itc_del function remove the item_class from the widget.
> 
> Most of elm_gen{list, grid} users declare itc(item_class) as a global
> variable. Because itc should be lived at elm_gen{list,grid} item's life cycle.
> It's inconvenient for users. Even some users pass itc.
> 
> itc_add makes a new itc. if exact one exists in the given widget, it
> return the previous made itc.
> itc_del remove a itc if its reference count reaches at zero.
> 
> Thanks.
> 
> 
> EAPI Elm_Genlist_Item_Class *
> elm_genlist_itc_add(Evas_Object *obj, const char *item_style,
>                     Elm_Genlist_Item_Text_Get_Cb text_cb,
>                     Elm_Genlist_Item_Content_Get_Cb content_cb,
>                     Elm_Genlist_Item_State_Get_Cb state_cb,
>                     Elm_Genlist_Item_Del_Cb del_cb);
> EAPI void
> elm_genlist_itc_del(Evas_Object *obj, Elm_Genlist_Item_Class *itc);
> EAPI Elm_Gengrid_Item_Class *
> elm_gengrid_itc_add(Evas_Object *obj, const char *item_style,
>                     Elm_Gengrid_Item_Text_Get_Cb text_cb,
>                     Elm_Gengrid_Item_Content_Get_Cb content_cb,
>                     Elm_Gengrid_Item_State_Get_Cb state_cb,
>                     Elm_Gengrid_Item_Del_Cb del_cb);
> EAPI void
> elm_gengrid_itc_del(Evas_Object *obj, Elm_Gengrid_Item_Class *itc);


-- 
------------- Codito, ergo sum - "I code, therefore I am" --------------
The Rasterman (Carsten Haitzler)    ras...@rasterman.com


------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to