On Tue, Jan 10, 2012 at 10:21 PM, Gustavo Sverzut Barbieri
<barbi...@profusion.mobi> wrote:
> On Tue, Jan 10, 2012 at 11:03 AM, Iván Briano (Sachiel)
> <sachi...@gmail.com> wrote:
>> 2012/1/10 Daniel Juyung Seo <seojuyu...@gmail.com>:
>>> On Fri, Jan 6, 2012 at 11:34 PM, Gustavo Sverzut Barbieri
>>> <barbi...@profusion.mobi> wrote:
>>>> On Fri, Jan 6, 2012 at 6:48 AM, Hyoyoung Chang <hyoyo...@gmail.com> wrote:
>>>>> 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);
>>>>
>>>> I dislike it, one can easily do this kind of stuff using item_del_cb().
>>>
>>>>
>>>> And really, majority of developers should NEVER use this, the global
>>>> static-const is the correct way to go, making sure memory is live,
>>>> unchanged, no mallocs, etc.
>>>
>>> Thanks for your reply. This patch has an assumption that application
>>> can alloc itc memory dynamically.
>>> If itc-dynamic-allocation is not recommended, do you have to use
>>> global variable for itc?
>>> For a huge app that uses many c sources, we can't force them to use
>>> global static :(
>>>
>>

Ok thanks for the reply

>> You are making a function to return a pre-made class for others to use?
>> Keep the class static to the function, return a pointer to it.
>
> exactly, it just need to be static, not global. It is also recommended
> to be "const", but it is not mandatory.

So I can guide apps to declare item class static to the function and
export the pointer.
Is this the only good way to do this?
In my experience, many application developers alloc item class memory
dynamically.

Daniel Juyung Seo (SeoZ)

>
> --
> Gustavo Sverzut Barbieri
> http://profusion.mobi embedded systems
> --------------------------------------
> MSN: barbi...@gmail.com
> Skype: gsbarbieri
> Mobile: +55 (19) 9225-2202
>
> ------------------------------------------------------------------------------
> Write once. Port to many.
> Get the SDK and tools to simplify cross-platform app development. Create
> new or port existing apps to sell to consumers worldwide. Explore the
> Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
> http://p.sf.net/sfu/intel-appdev
> _______________________________________________
> enlightenment-devel mailing list
> enlightenment-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create 
new or port existing apps to sell to consumers worldwide. Explore the 
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to