well, that means you have expectations to this feature.
that's very good for me and thanks.
revised version is attached.

On Fri, Feb 17, 2012 at 8:53 PM, Carsten Haitzler <ras...@rasterman.com> wrote:
> On Thu, 16 Feb 2012 15:10:16 +0900 Hyoyoung Chang <hyoyo...@gmail.com> said:
>
> can you adjust elc_fileselector.c to use the new creation/free of smart
> classes. also test_store.c as well? :) (i know - the requests keep coming!) :)
>
>> oops i miss that. thanks.
>> attaching improved version
>>
>> On Thu, Feb 16, 2012 at 2:59 PM, Daniel Juyung Seo <seojuyu...@gmail.com>
>> wrote:
>> > Great!
>> > But add NULL check for itc.
>> > Thanks.
>> >
>> > Daniel Juyung Seo (SeoZ)
>> >
>> > On Wed, Feb 15, 2012 at 7:09 PM, Hyoyoung Chang <hyoyo...@gmail.com> wrote:
>> >
>> >> yeah, it's right.
>> >> added free and ref to examples.
>> >>
>> >> On Tue, Feb 14, 2012 at 2:47 PM, Carsten Haitzler <ras...@rasterman.com>
>> >> wrote:
>> >> > On Mon, 13 Feb 2012 19:07:07 +0900 Hyoyoung Chang <hyoyo...@gmail.com>
>> >> said:
>> >> >
>> >> > ooh something i didn't realize - you should free item class in test
>> >> examples
>> >> > after u are done filling genlist with items - so the example is good.
>> >> > (otherwise they will leak) :)
>> >> >
>> >> >> So it's revised version.
>> >> >> I changed for 1~4.
>> >> >> And one more thing is changed.
>> >> >> ref/unref functions are public.
>> >> >> Because refcount start from 1.
>> >> >> Thank you.
>> >> >>
>> >> >> On Mon, Feb 13, 2012 at 5:11 PM, Carsten Haitzler <ras...@rasterman.com
>> >> >
>> >> >> wrote:
>> >> >> > On Fri, 10 Feb 2012 18:26:08 +0900 Hyoyoung Chang 
>> >> >> > <hyoyo...@gmail.com>
>> >> said:
>> >> >> >
>> >> >> > 1. your patch has your "minw ... wd->w" stuff (bugfix at genlist
>> >> rotation)
>> >> >> > 2. refcount should start at 1 imho.
>> >> >> > 3. delete_me -> use bitfield (delete_me : 1)
>> >> >> > 4. i'd prefer the version field to be at the start, not end of class.
>> >> i kn-w
>> >> >> > this breaks abi with current apps, but we have to do this to make
>> >> things
>> >> >> > work into the future. also move refcount and delete_me flag to the
>> >> start
>> >> >> > too. keep func at the end please :)
>> >> >> >
>> >> >> > fix these and then thumbs up :)
>> >> >> >
>> >> >> >> Dear all.
>> >> >> >>
>> >> >> >> I make controversial apis for item class management.
>> >> >> >> As raster and other guys suggest, I simplify APIs and its behaviors.
>> >> >> >>
>> >> >> >> First, Two public apis and two internal apis are introduced
>> >> >> >>
>> >> >> >> +EAPI Elm_Genlist_Item_Class *
>> >> >> >> +elm_genlist_item_class_new(void)
>> >> >> >>
>> >> >> >> +EAPI void
>> >> >> >> +elm_genlist_item_class_free(Elm_Genlist_Item_Class *itc)
>> >> >> >>
>> >> >> >> +void
>> >> >> >> +_elm_genlist_item_class_ref(Elm_Genlist_Item_Class *itc)
>> >> >> >>
>> >> >> >> +void
>> >> >> >> +_elm_genlist_item_class_unref(Elm_Genlist_Item_Class *itc)
>> >> >> >>
>> >> >> >> genlist item class is maintained by genlist in automatic manner.
>> >> >> >>
>> >> >> >> And three fields are introduced in genlist item class.
>> >> >> >> +   int version;
>> >> >> >> +   unsigned int refcount;
>> >> >> >> +   Eina_Bool delete_me;
>> >> >> >>
>> >> >> >> Normally a user add a elm_genlist_item_class by
>> >> elm_genlist_item_class_new
>> >> >> >> (). Then its reference counter is automatic maintained.
>> >> >> >> If the user wanna to remove the elm_genlist_item_class, then call
>> >> >> >> elm_genlist_item_class_free()
>> >> >> >> After refcount reaches to 0, it will be removed.
>> >> >> >>
>> >> >> >> Thank you.
>> >> >> >>
>> >> >> >> PS: I made those apis in genlist. If its accepted i'll make a new
>> >> >> >> patch for gengrid.
>> >> >> >
>> >> >> >
>> >> >> > --
>> >> >> > ------------- Codito, ergo sum - "I code, therefore I am"
>> >> --------------
>> >> >> > The Rasterman (Carsten Haitzler)    ras...@rasterman.com
>> >> >> >
>> >> >
>> >> >
>> >> > --
>> >> > ------------- Codito, ergo sum - "I code, therefore I am" --------------
>> >> > The Rasterman (Carsten Haitzler)    ras...@rasterman.com
>> >> >
>> >>
>> >>
>> >> ------------------------------------------------------------------------------
>> >> Virtualization & Cloud Management Using Capacity Planning
>> >> Cloud computing makes use of virtualization - but cloud computing
>> >> also focuses on allowing computing to be delivered as a service.
>> >> http://www.accelacomm.com/jaw/sfnl/114/51521223/
>> >> _______________________________________________
>> >> enlightenment-devel mailing list
>> >> enlightenment-devel@lists.sourceforge.net
>> >> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
>> >>
>> >>
>> > ------------------------------------------------------------------------------
>> > Virtualization & Cloud Management Using Capacity Planning
>> > Cloud computing makes use of virtualization - but cloud computing
>> > also focuses on allowing computing to be delivered as a service.
>> > http://www.accelacomm.com/jaw/sfnl/114/51521223/
>> > _______________________________________________
>> > enlightenment-devel mailing list
>> > enlightenment-devel@lists.sourceforge.net
>> > https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
>
>
> --
> ------------- Codito, ergo sum - "I code, therefore I am" --------------
> The Rasterman (Carsten Haitzler)    ras...@rasterman.com
>
Index: elementary/src/lib/elm_genlist.c
===================================================================
--- elementary/src/lib/elm_genlist.c    (리비전 68075)
+++ elementary/src/lib/elm_genlist.c    (작업 사본)
@@ -796,6 +796,7 @@
      it->parent->item->items = eina_list_remove(it->parent->item->items, it);
    if (it->item->swipe_timer) ecore_timer_del(it->item->swipe_timer);
    _elm_genlist_item_del_serious(it);
+   elm_genlist_item_class_unref((Elm_Genlist_Item_Class *)it->itc);
    evas_event_thaw(evas_object_evas_get(obj));
    evas_event_thaw_eval(evas_object_evas_get(obj));
 }
@@ -3323,6 +3324,7 @@
    it->wd = wd;
    it->generation = wd->generation;
    it->itc = itc;
+   elm_genlist_item_class_ref((Elm_Genlist_Item_Class *)itc);
    it->base.data = data;
    it->parent = parent;
    it->func.func = func;
@@ -5331,6 +5333,57 @@
    return _it->item->flags;
 }
 
+EAPI Elm_Genlist_Item_Class *
+elm_genlist_item_class_new(void)
+{
+   Elm_Genlist_Item_Class *itc;
+
+   itc = calloc(1, sizeof(Elm_Genlist_Item_Class));
+   if (!itc)
+     return NULL;
+   itc->version = ELM_GENLIST_ITEM_CLASS_VERSION;
+   itc->refcount = 1;
+   itc->delete_me = EINA_FALSE;
+
+   return itc;
+}
+
+EAPI void
+elm_genlist_item_class_free(Elm_Genlist_Item_Class *itc)
+{
+   if (itc && (itc->version == ELM_GENLIST_ITEM_CLASS_VERSION))
+     {
+        if (!itc->delete_me) itc->delete_me = EINA_TRUE;
+        if (itc->refcount > 0) elm_genlist_item_class_unref(itc);
+        else
+          {
+             itc->version = 0;
+             free(itc);
+          }
+     }
+}
+
+EAPI void
+elm_genlist_item_class_ref(Elm_Genlist_Item_Class *itc)
+{
+   if (itc && (itc->version == ELM_GENLIST_ITEM_CLASS_VERSION))
+     {
+        itc->refcount++;
+        if (itc->refcount == 0) itc->refcount--;
+     }
+}
+
+EAPI void
+elm_genlist_item_class_unref(Elm_Genlist_Item_Class *itc)
+{
+   if (itc && (itc->version == ELM_GENLIST_ITEM_CLASS_VERSION))
+     {
+        if (itc->refcount > 0) itc->refcount--;
+        if (itc->delete_me && (!itc->refcount))
+          elm_genlist_item_class_free(itc);
+     }
+}
+
 /* for gengrid as of now */
 void
 _elm_genlist_page_relative_set(Evas_Object *obj,
Index: elementary/src/lib/elc_fileselector.c
===================================================================
--- elementary/src/lib/elc_fileselector.c       (리비전 68075)
+++ elementary/src/lib/elc_fileselector.c       (작업 사본)
@@ -78,15 +78,11 @@
   ELM_FILE_LAST
 } Elm_Fileselector_Type;
 
-static Elm_Genlist_Item_Class list_itc[ELM_FILE_LAST] = {
-  { "default", { NULL, NULL, NULL, NULL } },
-  { "default", { NULL, NULL, NULL, NULL } },
-  { "default", { NULL, NULL, NULL, NULL } }
-};
+static Elm_Genlist_Item_Class *list_itc[ELM_FILE_LAST];
 static Elm_Gengrid_Item_Class grid_itc[ELM_FILE_LAST] = {
-  { "default", { NULL, NULL, NULL, NULL } },
-  { "default", { NULL, NULL, NULL, NULL } },
-  { "default", { NULL, NULL, NULL, NULL } }
+       { 0, 0, 0, "default", { NULL, NULL, NULL, NULL } },
+       { 0, 0, 0, "default", { NULL, NULL, NULL, NULL } },
+       { 0, 0, 0, "default", { NULL, NULL, NULL, NULL } },
 };
 
 static const char *widtype = NULL;
@@ -131,6 +127,10 @@
    wd = elm_widget_data_get(obj);
    if (!wd) return;
 
+   elm_genlist_item_class_free(list_itc[ELM_DIRECTORY]);
+   elm_genlist_item_class_free(list_itc[ELM_FILE_IMAGE]);
+   elm_genlist_item_class_free(list_itc[ELM_FILE_UNKNOW]);
+
 #ifdef HAVE_EIO
    if (wd->current)
      eio_file_cancel(wd->current);
@@ -562,19 +562,19 @@
    if (info->type == EINA_FILE_DIR)
      {
         eio_file_associate_direct_add(handler, "type/grid", 
&grid_itc[ELM_DIRECTORY], NULL);
-        eio_file_associate_direct_add(handler, "type/list", 
&list_itc[ELM_DIRECTORY], NULL);
+        eio_file_associate_direct_add(handler, "type/list", 
list_itc[ELM_DIRECTORY], NULL);
      }
    else
      {
         if (evas_object_image_extension_can_load_get(info->path + 
info->name_start))
           {
              eio_file_associate_direct_add(handler, "type/grid", 
&grid_itc[ELM_FILE_IMAGE], NULL);
-             eio_file_associate_direct_add(handler, "type/list", 
&list_itc[ELM_FILE_IMAGE], NULL);
+             eio_file_associate_direct_add(handler, "type/list", 
list_itc[ELM_FILE_IMAGE], NULL);
           }
         else
           {
              eio_file_associate_direct_add(handler, "type/grid", 
&grid_itc[ELM_FILE_UNKNOW], NULL);
-             eio_file_associate_direct_add(handler, "type/list", 
&list_itc[ELM_FILE_UNKNOW], NULL);
+             eio_file_associate_direct_add(handler, "type/list", 
list_itc[ELM_FILE_UNKNOW], NULL);
           }
      }
 
@@ -610,12 +610,12 @@
    const Elm_Genlist_Item_Class *ca = elm_genlist_item_item_class_get(la);
    const Elm_Genlist_Item_Class *cb = elm_genlist_item_item_class_get(lb);
 
-   if (ca == &list_itc[ELM_DIRECTORY])
+   if (ca == list_itc[ELM_DIRECTORY])
      {
-        if (cb != &list_itc[ELM_DIRECTORY])
+        if (cb != list_itc[ELM_DIRECTORY])
           return -1;
      }
-   else if (cb == &list_itc[ELM_DIRECTORY])
+   else if (cb == list_itc[ELM_DIRECTORY])
      {
         return 1;
      }
@@ -658,7 +658,7 @@
 
    if (wr->wd->mode == ELM_FILESELECTOR_LIST)
      {
-        Eina_Bool is_dir = (eio_file_associate_find(handler, "type/list") == 
&list_itc[ELM_DIRECTORY]);
+        Eina_Bool is_dir = (eio_file_associate_find(handler, "type/list") == 
list_itc[ELM_DIRECTORY]);
 
         elm_genlist_item_direct_sorted_insert(wr->wd->files_list, 
eio_file_associate_find(handler, "type/list"),
                                               
eina_stringshare_ref(eio_file_associate_find(handler, "filename")),
@@ -755,7 +755,7 @@
    EINA_LIST_FREE(dirs, real)
      {
         if (wd->mode == ELM_FILESELECTOR_LIST)
-          elm_genlist_item_append(wd->files_list, &list_itc[ELM_DIRECTORY],
+          elm_genlist_item_append(wd->files_list, list_itc[ELM_DIRECTORY],
                                   real, /* item data */
                                   parent,
                                   wd->expand ? ELM_GENLIST_ITEM_SUBITEMS :
@@ -773,7 +773,7 @@
           ELM_FILE_IMAGE : ELM_FILE_UNKNOW;
 
         if (wd->mode == ELM_FILESELECTOR_LIST)
-          elm_genlist_item_append(wd->files_list, &list_itc[type],
+          elm_genlist_item_append(wd->files_list, list_itc[type],
                                   real, /* item data */
                                   parent, ELM_GENLIST_ITEM_NONE,
                                   NULL, NULL);
@@ -863,15 +863,20 @@
    elm_widget_sub_object_add(obj, bt);
    wd->home_button = bt;
 
-   list_itc[ELM_DIRECTORY].func.content_get = 
grid_itc[ELM_DIRECTORY].func.content_get = _itc_icon_folder_get;
-   list_itc[ELM_FILE_IMAGE].func.content_get = 
grid_itc[ELM_FILE_IMAGE].func.content_get = _itc_icon_image_get;
-   list_itc[ELM_FILE_UNKNOW].func.content_get = 
grid_itc[ELM_FILE_UNKNOW].func.content_get = _itc_icon_file_get;
+   list_itc[ELM_DIRECTORY] = elm_genlist_item_class_new();
+   list_itc[ELM_FILE_IMAGE] = elm_genlist_item_class_new();
+   list_itc[ELM_FILE_UNKNOW] = elm_genlist_item_class_new();
 
+   list_itc[ELM_DIRECTORY]->func.content_get = 
grid_itc[ELM_DIRECTORY].func.content_get = _itc_icon_folder_get;
+   list_itc[ELM_FILE_IMAGE]->func.content_get = 
grid_itc[ELM_FILE_IMAGE].func.content_get = _itc_icon_image_get;
+   list_itc[ELM_FILE_UNKNOW]->func.content_get = 
grid_itc[ELM_FILE_UNKNOW].func.content_get = _itc_icon_file_get;
+
    for (i = 0; i < ELM_FILE_LAST; ++i)
      {
-        list_itc[i].func.text_get = grid_itc[i].func.text_get = _itc_text_get;
-        list_itc[i].func.state_get = grid_itc[i].func.state_get = 
_itc_state_get;
-        list_itc[i].func.del = grid_itc[i].func.del = _itc_del;
+                list_itc[i]->item_style = "default";
+                list_itc[i]->func.text_get = grid_itc[i].func.text_get = 
_itc_text_get;
+                list_itc[i]->func.state_get = grid_itc[i].func.state_get = 
_itc_state_get;
+                list_itc[i]->func.del = grid_itc[i].func.del = _itc_del;
      }
 
    li = elm_genlist_add(parent);
Index: elementary/src/lib/elm_genlist.h
===================================================================
--- elementary/src/lib/elm_genlist.h    (리비전 68075)
+++ elementary/src/lib/elm_genlist.h    (작업 사본)
@@ -1846,6 +1846,71 @@
  */
 EAPI Elm_Genlist_Item_Flags        elm_genlist_item_flags_get(const 
Elm_Object_Item *it);
 
+#define ELM_GENLIST_ITEM_CLASS_VERSION 2 /* current version number */
+
 /**
+ * Add a new genlist item class in a given genlist widget.
+ *
+ * @return New allocated a genlist item class.
+ *
+ * This adds genlist item class for the genlist widget. When adding a item,
+ * genlist_item_{append, prepend, insert} function needs item class of the 
item.
+ * Given callback paramters are used at retrieving {text, content} of
+ * added item. Set as NULL if it's not used.
+ * If there's no available memory, return can be NULL.
+ *
+ * @see elm_genlist_item_class_free()
+ * @see elm_genlist_item_append()
+ *
+ * @ingroup Genlist
+ */
+EAPI Elm_Genlist_Item_Class *elm_genlist_item_class_new(void);
+
+/**
+ * Remove a item class in a given genlist widget.
+ *
+ * @param itc The itc to be removed.
+ *
+ * This removes item class from the genlist widget.
+ * Whenever it has no more references to it, item class is going to be freed.
+ * Otherwise it just decreases its reference count.
+ *
+ * @see elm_genlist_item_class_new()
+ * @see elm_genlist_item_class_ref()
+ * @see elm_genlist_item_class_unref()
+ *
+ * @ingroup Genlist
+ */
+EAPI void elm_genlist_item_class_free(Elm_Genlist_Item_Class *itc);
+
+/**
+ * Increments object reference count for the item class.
+ *
+ * @param itc The given item class object to reference
+ *
+ * This API just increases its reference count for item class management.
+ *
+ * @see elm_genlist_item_class_unref()
+ *
+ * @ingroup Genlist
+ */
+EAPI void elm_genlist_item_class_ref(Elm_Genlist_Item_Class *itc);
+
+/**
+ * Decrements object reference count for the item class.
+ *
+ * @param itc The given item class object to reference
+ *
+ * This API just decreases its reference count for item class management.
+ * Reference count can't be less than 0.
+ *
+ * @see elm_genlist_item_class_ref()
+ * @see elm_genlist_item_class_free()
+ *
+ * @ingroup Genlist
+ */
+EAPI void elm_genlist_item_class_unref(Elm_Genlist_Item_Class *itc);
+
+/**
  * @}
  */
Index: elementary/src/lib/elm_deprecated_before.h
===================================================================
--- elementary/src/lib/elm_deprecated_before.h  (리비전 68075)
+++ elementary/src/lib/elm_deprecated_before.h  (작업 사본)
@@ -9,6 +9,9 @@
 typedef void                          (*Elm_Gen_Item_Del_Cb)(void *data, 
Evas_Object *obj); /**< Deletion class function for gen item classes. */
 struct _Elm_Gen_Item_Class
 {
+   int version;
+   unsigned int refcount;
+   Eina_Bool delete_me : 1;
    const char *item_style;
    struct _Elm_Gen_Item_Class_Func
    {
Index: elementary/src/bin/test_store.c
===================================================================
--- elementary/src/bin/test_store.c     (리비전 68075)
+++ elementary/src/bin/test_store.c     (작업 사본)
@@ -39,10 +39,7 @@
 }
 
 // store callbacks to handle loading/parsing/freeing of store items from src
-static Elm_Genlist_Item_Class itc1 =
-{
-  "message", { NULL, NULL, NULL, NULL}
-};
+static Elm_Genlist_Item_Class *itc1;
 
 static const Elm_Store_Item_Mapping it1_mapping[] =
 {
@@ -112,7 +109,7 @@
    // choose the item genlist item class to use (only item style should be
    // provided by the app, store will fill everything else in, so it also
    // has to be writable
-   info->base.item_class = &itc1; // based on item info - return the item 
class wanted (only style field used - rest reset to internal funcs store sets 
up to get label/icon etc)
+   info->base.item_class = itc1; // based on item info - return the item class 
wanted (only style field used - rest reset to internal funcs store sets up to 
get label/icon etc)
    info->base.mapping = it1_mapping;
    info->base.data = NULL; // if we can already parse and load all of item 
here and want to - set this
    return EINA_TRUE; // return true to include this, false not to
@@ -260,6 +257,9 @@
    elm_box_pack_end(bx, gl);
    evas_object_show(gl);
 
+   itc1 = elm_genlist_item_class_new();
+   itc1->item_style = "message";
+
    st = elm_store_filesystem_new();
    elm_store_list_func_set(st, _st_store_list, NULL);
    elm_store_fetch_func_set(st, _st_store_fetch, NULL);
@@ -269,6 +269,10 @@
    elm_store_target_genlist_set(st, gl);
    elm_store_filesystem_directory_set(st, "./store");
 
+   /* item_class_ref is needed for itc1. some items can be added in callbacks 
*/
+   elm_genlist_item_class_ref(itc1);
+   elm_genlist_item_class_free(itc1);
+
    evas_object_resize(win, 480, 800);
    evas_object_show(win);
 }
Index: elementary/src/bin/test_genlist.c
===================================================================
--- elementary/src/bin/test_genlist.c   (리비전 68075)
+++ elementary/src/bin/test_genlist.c   (작업 사본)
@@ -20,7 +20,7 @@
 } Testitem;
 
 
-static Elm_Genlist_Item_Class itc1;
+static Elm_Genlist_Item_Class *itc1;
 char *gl_text_get(void *data, Evas_Object *obj __UNUSED__, const char *part 
__UNUSED__)
 {
    char buf[256];
@@ -140,11 +140,12 @@
    evas_object_size_hint_weight_set(over, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    elm_win_resize_object_add(win, over);
 
-   itc1.item_style     = "default";
-   itc1.func.text_get = gl_text_get;
-   itc1.func.content_get  = gl_content_get;
-   itc1.func.state_get = gl_state_get;
-   itc1.func.del       = gl_del;
+   itc1 = elm_genlist_item_class_new();
+   itc1->item_style     = "default";
+   itc1->func.text_get = gl_text_get;
+   itc1->func.content_get  = gl_content_get;
+   itc1->func.state_get = gl_state_get;
+   itc1->func.del       = gl_del;
 
    bt_50 = elm_button_add(win);
    elm_object_text_set(bt_50, "Go to 50");
@@ -158,7 +159,7 @@
 
    for (i = 0; i < 2000; i++)
      {
-        gli = elm_genlist_item_append(gl, &itc1,
+        gli = elm_genlist_item_append(gl, itc1,
                                       (void *)(long)i/* item data */,
                                       NULL/* parent */,
                                       ELM_GENLIST_ITEM_NONE,
@@ -169,6 +170,8 @@
         else if (i == 1500)
           evas_object_smart_callback_add(bt_1500, "clicked", _bt1500_cb, gli);
      }
+   elm_genlist_item_class_free(itc1);
+
    evas_object_resize(win, 480, 800);
    evas_object_show(win);
 }
@@ -188,13 +191,13 @@
    Evas_Object *gl = data;
    static int i = 0;
 
-   itc1.item_style     = "default";
-   itc1.func.text_get = gl_text_get;
-   itc1.func.content_get  = gl_content_get;
-   itc1.func.state_get = gl_state_get;
-   itc1.func.del       = gl_del;
+   itc1->item_style     = "default";
+   itc1->func.text_get = gl_text_get;
+   itc1->func.content_get  = gl_content_get;
+   itc1->func.state_get = gl_state_get;
+   itc1->func.del       = gl_del;
 
-   elm_genlist_item_append(gl, &itc1,
+   elm_genlist_item_append(gl, itc1,
                            (void *)(long)i/* item data */,
                            NULL/* parent */,
                            ELM_GENLIST_ITEM_NONE,
@@ -210,11 +213,11 @@
    static int i = 0;
    Elm_Object_Item *gli_selected;
 
-   itc1.item_style     = "default";
-   itc1.func.text_get = gl_text_get;
-   itc1.func.content_get  = gl_content_get;
-   itc1.func.state_get = gl_state_get;
-   itc1.func.del       = gl_del;
+   itc1->item_style     = "default";
+   itc1->func.text_get = gl_text_get;
+   itc1->func.content_get  = gl_content_get;
+   itc1->func.state_get = gl_state_get;
+   itc1->func.del       = gl_del;
 
    gli_selected = elm_genlist_selected_item_get(gl);
    if (!gli_selected)
@@ -223,7 +226,7 @@
         return ;
      }
 
-   elm_genlist_item_insert_before(gl, &itc1,
+   elm_genlist_item_insert_before(gl, itc1,
                                   (void *)(long)i/* item data */,
                                   NULL/* parent */,
                                   gli_selected /* item before */,
@@ -240,11 +243,11 @@
    static int i = 0;
    Elm_Object_Item *gli_selected;
 
-   itc1.item_style     = "default";
-   itc1.func.text_get = gl_text_get;
-   itc1.func.content_get  = gl_content_get;
-   itc1.func.state_get = gl_state_get;
-   itc1.func.del       = gl_del;
+   itc1->item_style     = "default";
+   itc1->func.text_get = gl_text_get;
+   itc1->func.content_get  = gl_content_get;
+   itc1->func.state_get = gl_state_get;
+   itc1->func.del       = gl_del;
 
    gli_selected = elm_genlist_selected_item_get(gl);
    if (!gli_selected)
@@ -253,7 +256,7 @@
         return ;
      }
 
-   elm_genlist_item_insert_after(gl, &itc1,
+   elm_genlist_item_insert_after(gl, itc1,
                                  (void *)(long)i/* item data */,
                                  NULL/* parent */,
                                  gli_selected /* item after */,
@@ -367,34 +370,34 @@
    evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    evas_object_show(gl);
 
-   itc1.item_style     = "default";
-   itc1.func.text_get = gl_text_get;
-   itc1.func.content_get  = gl_content_get;
-   itc1.func.state_get = gl_state_get;
-   itc1.func.del       = gl_del;
+   itc1 = elm_genlist_item_class_new();
+   itc1->item_style     = "default";
+   itc1->func.text_get = gl_text_get;
+   itc1->func.content_get  = gl_content_get;
+   itc1->func.state_get = gl_state_get;
+   itc1->func.del       = gl_del;
 
-   gli[0] = elm_genlist_item_append(gl, &itc1,
+   gli[0] = elm_genlist_item_append(gl, itc1,
                                     (void *)1001/* item data */, NULL/* parent 
*/, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
                                     (void *)1001/* func data */);
-   gli[1] = elm_genlist_item_append(gl, &itc1,
+   gli[1] = elm_genlist_item_append(gl, itc1,
                                     (void *)1002/* item data */, NULL/* parent 
*/, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
                                     (void *)1002/* func data */);
-   gli[2] = elm_genlist_item_append(gl, &itc1,
+   gli[2] = elm_genlist_item_append(gl, itc1,
                                     (void *)1003/* item data */, NULL/* parent 
*/, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
                                     (void *)1003/* func data */);
-   gli[3] = elm_genlist_item_prepend(gl, &itc1,
+   gli[3] = elm_genlist_item_prepend(gl, itc1,
                                      (void *)1004/* item data */, NULL/* 
parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
                                      (void *)1004/* func data */);
-   gli[4] = elm_genlist_item_prepend(gl, &itc1,
+   gli[4] = elm_genlist_item_prepend(gl, itc1,
                                      (void *)1005/* item data */, NULL/* 
parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
                                      (void *)1005/* func data */);
-   gli[5] = elm_genlist_item_insert_before(gl, &itc1,
+   gli[5] = elm_genlist_item_insert_before(gl, itc1,
                                            (void *)1006/* item data */, NULL/* 
parent */, gli[2]/* rel */, ELM_GENLIST_ITEM_NONE,
                                            gl_sel/* func */, (void *)1006/* 
func data */);
-   gli[6] = elm_genlist_item_insert_after(gl, &itc1,
+   gli[6] = elm_genlist_item_insert_after(gl, itc1,
                                           (void *)1007/* item data */, NULL/* 
parent */, gli[2]/* rel */, ELM_GENLIST_ITEM_NONE,
                                           gl_sel/* func */, (void *)1007/* 
func data */);
-
    elm_box_pack_end(bx, gl);
 
    bx2 = elm_box_add(win);
@@ -504,6 +507,9 @@
    elm_box_pack_end(bx, bx3);
    evas_object_show(bx3);
 
+   /* item_class_ref is needed for itc1. some items can be added in callbacks 
*/
+   elm_genlist_item_class_ref(itc1);
+   elm_genlist_item_class_free(itc1);
 
    evas_object_resize(win, 320, 320);
    evas_object_show(win);
@@ -1390,11 +1396,12 @@
    elm_box_pack_end(bx, gl);
    evas_object_show(gl);
 
-   itc1.item_style     = "default";
-   itc1.func.text_get = gl_text_get;
-   itc1.func.content_get  = gl_content_get;
-   itc1.func.state_get = gl_state_get;
-   itc1.func.del       = gl_del;
+   itc1 = elm_genlist_item_class_new();
+   itc1->item_style     = "default";
+   itc1->func.text_get = gl_text_get;
+   itc1->func.content_get  = gl_content_get;
+   itc1->func.state_get = gl_state_get;
+   itc1->func.del       = gl_del;
 
    itc_group.item_style     = "group_index";
    itc_group.func.text_get = gl8_text_get;
@@ -1491,7 +1498,7 @@
           }
         else if (git)
           {
-             gli = elm_genlist_item_append(gl, &itc1,
+             gli = elm_genlist_item_append(gl, itc1,
                                            (void *)(long)i/* item data */,
                                            git/* parent */,
                                            ELM_GENLIST_ITEM_NONE,
@@ -1524,6 +1531,7 @@
               break;
           }
      }
+   elm_genlist_item_class_free(itc1);
 
    evas_object_resize(win, 480, 800);
    evas_object_show(win);
@@ -1538,17 +1546,17 @@
    Evas_Object *gl = elm_object_item_widget_get(glit);
    int val = (int)(long) elm_object_item_data_get(glit);
    val *= 10;
-   elm_genlist_item_append(gl, &itc1,
+   elm_genlist_item_append(gl, itc1,
                            (void *)(long) (val + 1)/* item data */,
                            glit/* parent */,
                            ELM_GENLIST_ITEM_NONE, gl4_sel/* func */,
                            NULL/* func data */);
-   elm_genlist_item_append(gl, &itc1,
+   elm_genlist_item_append(gl, itc1,
                            (void *)(long) (val + 2)/* item data */,
                            glit/* parent */,
                            ELM_GENLIST_ITEM_NONE, gl4_sel/* func */,
                            NULL/* func data */);
-   elm_genlist_item_append(gl, &itc1,
+   elm_genlist_item_append(gl, itc1,
                            (void *)(long) (val + 3)/* item data */,
                            glit/* parent */,
                            ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */,
@@ -1603,11 +1611,12 @@
    elm_box_pack_end(bx, gl);
    evas_object_show(gl);
 
-   itc1.item_style     = "default";
-   itc1.func.text_get = gl_text_get;
-   itc1.func.content_get  = gl_content_get;
-   itc1.func.state_get = gl_state_get;
-   itc1.func.del       = gl_del;
+   itc1 = elm_genlist_item_class_new();
+   itc1->item_style     = "default";
+   itc1->func.text_get = gl_text_get;
+   itc1->func.content_get  = gl_content_get;
+   itc1->func.state_get = gl_state_get;
+   itc1->func.del       = gl_del;
 
    itc_group.item_style     = "group_index";
    itc_group.func.text_get = gl8_text_get;
@@ -1619,28 +1628,29 @@
                                  (void *)0/* item data */, NULL/* parent */, 
ELM_GENLIST_ITEM_GROUP, gl4_sel/* func */,
                                  NULL/* func data */);
    elm_genlist_item_display_only_set(git, EINA_TRUE);
-   elm_genlist_item_append(gl, &itc1,
+   elm_genlist_item_append(gl, itc1,
                            (void *)1/* item data */, git/* parent */, 
ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */,
                            NULL/* func data */);
-   elm_genlist_item_append(gl, &itc1,
+   elm_genlist_item_append(gl, itc1,
                            (void *)2/* item data */, git/* parent */, 
ELM_GENLIST_ITEM_NONE, gl4_sel/* func */,
                            NULL/* func data */);
-   elm_genlist_item_append(gl, &itc1,
+   elm_genlist_item_append(gl, itc1,
                            (void *)3/* item data */, git/* parent */, 
ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */,
                            NULL/* func data */);
    git = elm_genlist_item_append(gl, &itc_group,
                                  (void *)4/* item data */, NULL/* parent */, 
ELM_GENLIST_ITEM_GROUP, gl4_sel/* func */,
                                  NULL/* func data */);
    elm_genlist_item_display_only_set(git, EINA_TRUE);
-   elm_genlist_item_append(gl, &itc1,
+   elm_genlist_item_append(gl, itc1,
                            (void *)5/* item data */, git/* parent */, 
ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */,
                            NULL/* func data */);
-   elm_genlist_item_append(gl, &itc1,
+   elm_genlist_item_append(gl, itc1,
                            (void *)6/* item data */, git/* parent */, 
ELM_GENLIST_ITEM_NONE, gl4_sel/* func */,
                            NULL/* func data */);
-   elm_genlist_item_append(gl, &itc1,
+   elm_genlist_item_append(gl, itc1,
                            (void *)7/* item data */, git/* parent */, 
ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */,
                            NULL/* func data */);
+   elm_genlist_item_class_free(itc1);
 
    evas_object_smart_callback_add(gl, "expand,request", gl9_exp_req, gl);
    evas_object_smart_callback_add(gl, "contract,request", gl9_con_req, gl);
@@ -1875,22 +1885,25 @@
    elm_box_pack_end(bx, tg);
    evas_object_show(tg);
 
-   itc1.item_style     = "default";
-   itc1.func.text_get = gl_text_get;
-   itc1.func.content_get  = gl_content_get;
-   itc1.func.state_get = gl_state_get;
-   itc1.func.del       = gl_del;
+   itc1 = elm_genlist_item_class_new();
+   itc1->item_style     = "default";
+   itc1->func.text_get = gl_text_get;
+   itc1->func.content_get  = gl_content_get;
+   itc1->func.state_get = gl_state_get;
+   itc1->func.del       = gl_del;
    evas_object_smart_callback_add(gl, "moved", (Evas_Smart_Cb)gl_moved, gl);
 
    for (i = 0; i < 50; i++)
      elm_genlist_item_append(gl,
-                             &itc1,
+                             itc1,
                              (void *)(1 + i)/* item data */,
                              NULL/* parent */,
                              ELM_GENLIST_ITEM_NONE/* flags */,
                              NULL/* func */,
                              NULL/* func data */);
 
+   elm_genlist_item_class_free(itc1);
+
    elm_box_pack_end(bx, gl);
 
    evas_object_resize(win, 400, 500);
@@ -1929,21 +1942,22 @@
    elm_box_pack_end(bx, gl);
    evas_object_show(gl);
 
-   itc1.item_style     = "message";
-   itc1.func.text_get = gl12_text_get;
-   itc1.func.content_get  = gl_content_get;
-   itc1.func.state_get = gl_state_get;
-   itc1.func.del       = gl_del;
+   itc1->item_style     = "message";
+   itc1->func.text_get = gl12_text_get;
+   itc1->func.content_get  = gl_content_get;
+   itc1->func.state_get = gl_state_get;
+   itc1->func.del       = gl_del;
 
    for (i = 0; i < 1000; i++)
      {
-        elm_genlist_item_append(gl, &itc1,
+        elm_genlist_item_append(gl, itc1,
                                 (void *)(long)i/* item data */,
                                 NULL/* parent */,
                                 ELM_GENLIST_ITEM_NONE,
                                 gl_sel/* func */,
                                 (void *)(long)(i * 10)/* func data */);
      }
+   elm_genlist_item_class_free(itc1);
 
    evas_object_resize(win, 400, 500);
    evas_object_show(win);
@@ -2047,11 +2061,11 @@
    static int i = 1000;
    Elm_Object_Item *gli_selected;
 
-   itc1.item_style = "default";
-   itc1.func.text_get = gl_text_get;
-   itc1.func.content_get = NULL;
-   itc1.func.state_get = NULL;
-   itc1.func.del = NULL;
+   itc1->item_style = "default";
+   itc1->func.text_get = gl_text_get;
+   itc1->func.content_get = NULL;
+   itc1->func.state_get = NULL;
+   itc1->func.del = NULL;
 
    gli_selected = elm_genlist_selected_item_get(gl);
    if (!gli_selected)
@@ -2060,7 +2074,7 @@
         return;
      }
 
-   elm_genlist_item_insert_before(gl, &itc1,
+   elm_genlist_item_insert_before(gl, itc1,
                                   (void *)(long)i/* item data */,
                                   elm_genlist_item_parent_get(gli_selected),
                                   gli_selected/* item before */,
@@ -2076,11 +2090,11 @@
    static int i = 0;
    Elm_Object_Item *gli_selected;
 
-   itc1.item_style = "default";
-   itc1.func.text_get = gl_text_get;
-   itc1.func.content_get = NULL;
-   itc1.func.state_get = NULL;
-   itc1.func.del = NULL;
+   itc1->item_style = "default";
+   itc1->func.text_get = gl_text_get;
+   itc1->func.content_get = NULL;
+   itc1->func.state_get = NULL;
+   itc1->func.del = NULL;
 
    gli_selected = elm_genlist_selected_item_get(gl);
    if (!gli_selected)
@@ -2089,7 +2103,7 @@
         return;
      }
 
-   elm_genlist_item_insert_after(gl, &itc1,
+   elm_genlist_item_insert_after(gl, itc1,
                                   (void *)(long)i/* item data */,
                                   elm_genlist_item_parent_get(gli_selected),
                                   gli_selected/* item after */,
@@ -2137,6 +2151,8 @@
    evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    evas_object_show(gl);
 
+   itc1 = elm_genlist_item_class_new();
+
    itc4.item_style = "default";
    itc4.func.text_get = gl4_text_get;
    itc4.func.content_get = NULL;
@@ -2259,6 +2275,10 @@
    elm_box_pack_end(bx, bx2);
    evas_object_show(bx2);
 
+   /* item_class_ref is needed for itc1. some items can be added in callbacks 
*/
+   elm_genlist_item_class_ref(itc1);
+   elm_genlist_item_class_free(itc1);
+
    evas_object_resize(win, 320, 320);
    evas_object_show(win);
 }
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to