On Mon, 20 Feb 2012 18:00:58 +0900 Daniel Juyung Seo <seojuyu...@gmail.com> said:
i have no idea what happened there... :/ > nooooo!! > you committed other patches alongside. > > anyhow thanks for the genlist patch review. > On Feb 20, 2012 5:26 PM, "Enlightenment SVN" <no-re...@enlightenment.org> > wrote: > > > Log: > > From: Hyoyoung Chang <hyoyo...@gmail.com> > > Subject: [E-devel] [patch] elm_genlist - add item_class management > > functions > > > > 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. > > > > > > > > Author: raster > > Date: 2012-02-20 00:26:17 -0800 (Mon, 20 Feb 2012) > > New Revision: 68147 > > Trac: http://trac.enlightenment.org/e/changeset/68147 > > > > Modified: > > trunk/elementary/src/bin/test.c trunk/elementary/src/bin/test_box.c > > trunk/elementary/src/bin/test_genlist.c > > trunk/elementary/src/bin/test_store.c > > trunk/elementary/src/lib/elc_fileselector.c > > trunk/elementary/src/lib/elm_deprecated_before.h > > trunk/elementary/src/lib/elm_gengrid.h > > trunk/elementary/src/lib/elm_genlist.c > > trunk/elementary/src/lib/elm_genlist.h > > > > Modified: trunk/elementary/src/bin/test.c > > =================================================================== > > --- trunk/elementary/src/bin/test.c 2012-02-20 08:24:41 UTC (rev 68146) > > +++ trunk/elementary/src/bin/test.c 2012-02-20 08:26:17 UTC (rev 68147) > > @@ -11,7 +11,9 @@ > > void test_icon(void *data, Evas_Object *obj, void *event_info); > > void test_box_vert(void *data, Evas_Object *obj, void *event_info); > > void test_box_vert2(void *data, Evas_Object *obj, void *event_info); > > +void test_box_pack(void *data, Evas_Object *obj, void *event_info); > > void test_box_horiz(void *data, Evas_Object *obj, void *event_info); > > +void test_box_homo(void *data, Evas_Object *obj, void *event_info); > > void test_box_transition(void *data, Evas_Object *obj, void *event_info); > > void test_button(void *data, Evas_Object *obj, void *event_info); > > void test_cnp(void *data, Evas_Object *obj, void *event_info); > > @@ -340,7 +342,9 @@ > > //------------------------------// > > ADD_TEST(NULL, "Containers", "Box Vert", test_box_vert); > > ADD_TEST(NULL, "Containers", "Box Vert 2", test_box_vert2); > > + ADD_TEST(NULL, "Containers", "Box Pack", test_box_pack); > > ADD_TEST(NULL, "Containers", "Box Horiz", test_box_horiz); > > + ADD_TEST(NULL, "Containers", "Box Homogeneous", test_box_homo); > > ADD_TEST(NULL, "Containers", "Box Transition", test_box_transition); > > ADD_TEST(NULL, "Containers", "Table", test_table); > > ADD_TEST(NULL, "Containers", "Table Homogeneous", test_table2); > > > > Modified: trunk/elementary/src/bin/test_box.c > > =================================================================== > > --- trunk/elementary/src/bin/test_box.c 2012-02-20 08:24:41 UTC (rev 68146) > > +++ trunk/elementary/src/bin/test_box.c 2012-02-20 08:26:17 UTC (rev 68147) > > @@ -3,6 +3,15 @@ > > # include "elementary_config.h" > > #endif > > #ifndef ELM_LIB_QUICKLAUNCH > > + > > +typedef enum > > +{ > > + BOX_PACK_POSITION_START, > > + BOX_PACK_POSITION_BEFORE, > > + BOX_PACK_POSITION_AFTER, > > + BOX_PACK_POSITION_END > > +} _Box_Pack_Position; > > + > > void > > test_box_vert(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void > > *event_info __UNUSED__) > > { > > @@ -170,6 +179,323 @@ > > evas_object_show(win); > > } > > > > +static void > > +_unpack_btn_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info > > __UNUSED__) > > +{ > > + Evas_Object *box, *radio; > > + Eina_List *rl, *l; > > + int value, svalue; > > + > > + box = (Evas_Object *) data; > > + > > + rl = (Eina_List *) evas_object_data_get(box, "radio-list"); > > + EINA_LIST_FOREACH(rl, l, radio) > > + { > > + value = elm_radio_value_get(radio); > > + svalue = elm_radio_state_value_get(radio); > > + > > + if (value != svalue) continue; > > + > > + elm_radio_value_set(radio, -1); > > + elm_box_unpack(box, radio); > > + rl = eina_list_remove(rl, radio); > > + evas_object_data_set(box, "radio-list", rl); > > + evas_object_del(radio); > > + } > > +} > > + > > +static void > > +_unpack_all_btn_cb(void *data, Evas_Object *obj __UNUSED__, void > > *event_info __UNUSED__) > > +{ > > + Evas_Object *box, *radio; > > + Eina_List *rl, *l; > > + > > + box = (Evas_Object *) data; > > + elm_box_unpack_all(box); > > + > > + rl = (Eina_List *) evas_object_data_get(box, "radio-list"); > > + EINA_LIST_FOREACH(rl, l, radio) evas_object_del(radio); > > + > > + evas_object_data_del(box, "radio-list"); > > + eina_list_free(rl); > > +} > > + > > +static Evas_Object * > > +_radio_new(Evas_Object *obj, int index) > > +{ > > + Evas_Object *ic, *rd; > > + char buf[PATH_MAX]; > > + > > + ic = elm_icon_add(obj); > > + snprintf(buf, sizeof(buf), "%s/images/icon_0%d.png", > > + elm_app_data_dir_get(), index); > > + elm_icon_file_set(ic, buf, NULL); > > + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, > > 1); > > + > > + rd = elm_radio_add(obj); > > + elm_radio_state_value_set(rd, index); > > + evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, > > EVAS_HINT_EXPAND); > > + evas_object_size_hint_align_set(rd, EVAS_HINT_FILL, 0.5); > > + elm_object_part_content_set(rd, "icon", ic); > > + > > + evas_object_show(rd); > > + evas_object_show(ic); > > + > > + return rd; > > +} > > + > > +static void > > +_pack(Evas_Object *box, _Box_Pack_Position pos) > > +{ > > + Evas_Object *radio; > > + Evas_Object *rd, *rdg = NULL; > > + Eina_List *rl, *l = NULL; > > + int value, svalue, count; > > + > > + rl = (Eina_List *) evas_object_data_get(box, "radio-list"); > > + if (!rl && (pos == BOX_PACK_POSITION_START || pos == > > BOX_PACK_POSITION_END)) > > + { > > + rd = _radio_new(box, 0); > > + if (pos == BOX_PACK_POSITION_START) elm_box_pack_start(box, rd); > > + else elm_box_pack_end(box, rd); > > + > > + l = eina_list_append(l, rd); > > + evas_object_data_set(box, "radio-list", l); > > + > > + rdg = rd; > > + evas_object_data_set(box, "radio-group", rdg); > > + > > + return; > > + } > > + > > + count = eina_list_count(rl); > > + EINA_LIST_FOREACH(rl, l, radio) > > + { > > + value = elm_radio_value_get(radio); > > + svalue = elm_radio_state_value_get(radio); > > + > > + if (value != svalue) continue; > > + > > + rd = _radio_new(box, count); > > + > > + switch(pos) > > + { > > + case BOX_PACK_POSITION_START: > > + elm_box_pack_start(box, rd); > > + break; > > + case BOX_PACK_POSITION_BEFORE: > > + elm_box_pack_before(box, rd, radio); > > + break; > > + case BOX_PACK_POSITION_AFTER: > > + elm_box_pack_after(box, rd, radio); > > + break; > > + case BOX_PACK_POSITION_END: > > + elm_box_pack_end(box, rd); > > + break; > > + } > > + > > + rdg = evas_object_data_get(box, "radio-group"); > > + elm_radio_group_add(rd, rdg); > > + > > + rl = eina_list_append(rl, rd); > > + evas_object_data_set(box, "radio-list", rl); > > + } > > +} > > + > > +static void > > +_pack_start_btn_cb(void *data, Evas_Object *obj __UNUSED__, void > > *event_info __UNUSED__) > > +{ > > + Evas_Object *box; > > + if (!data) return; > > + > > + box = (Evas_Object *) data; > > + _pack(box, BOX_PACK_POSITION_START); > > +} > > + > > +static void > > +_pack_before_btn_cb(void *data, Evas_Object *obj __UNUSED__, void > > *event_info __UNUSED__) > > +{ > > + Evas_Object *box; > > + if (!data) return; > > + > > + box = (Evas_Object *) data; > > + _pack(box, BOX_PACK_POSITION_BEFORE); > > +} > > + > > +static void > > +_pack_after_btn_cb(void *data, Evas_Object *obj __UNUSED__, void > > *event_info __UNUSED__) > > +{ > > + Evas_Object *box; > > + if (!data) return; > > + > > + box = (Evas_Object *) data; > > + _pack(box, BOX_PACK_POSITION_AFTER); > > +} > > + > > +static void > > +_pack_end_btn_cb(void *data, Evas_Object *obj __UNUSED__, void > > *event_info __UNUSED__) > > +{ > > + Evas_Object *box; > > + if (!data) return; > > + > > + box = (Evas_Object *) data; > > + _pack(box, BOX_PACK_POSITION_END); > > +} > > + > > +void > > +test_box_pack(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void > > *event_info __UNUSED__) > > +{ > > + Evas_Object *win, *bg; > > + Evas_Object *box, *lbox, *rbox; > > + Evas_Object *sc; > > + Evas_Object *bt; > > + Evas_Object *rd, *rdg = NULL; > > + Eina_List *l = NULL; > > + int i; > > + > > + win = elm_win_add(NULL, "box-pack", ELM_WIN_BASIC); > > + elm_win_title_set(win, "Box Pack"); > > + elm_win_autodel_set(win, EINA_TRUE); > > + > > + bg = elm_bg_add(win); > > + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, > > EVAS_HINT_EXPAND); > > + elm_win_resize_object_add(win, bg); > > + evas_object_show(bg); > > + > > + box = elm_box_add(win); > > + elm_box_horizontal_set(box, EINA_TRUE); > > + evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, > > EVAS_HINT_EXPAND); > > + evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL); > > + elm_win_resize_object_add(win, box); > > + evas_object_show(box); > > + > > + // left side > > + lbox = elm_box_add(win); > > + evas_object_size_hint_weight_set(lbox, EVAS_HINT_EXPAND, > > EVAS_HINT_EXPAND); > > + evas_object_size_hint_align_set(lbox, EVAS_HINT_FILL, EVAS_HINT_FILL); > > + > > + sc = elm_scroller_add(win); > > + elm_scroller_bounce_set(sc, 0, 1); > > + evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, > > EVAS_HINT_EXPAND); > > + evas_object_size_hint_align_set(sc, EVAS_HINT_FILL, EVAS_HINT_FILL); > > + > > + for(i = 0; i < 3; i++) > > + { > > + rd = _radio_new(win, i); > > + elm_box_pack_end(lbox, rd); > > + l = eina_list_append(l, rd); > > + if (i == 0) rdg = rd; > > + else elm_radio_group_add(rd, rdg); > > + } > > + > > + evas_object_data_set(lbox, "radio-list", l); > > + evas_object_data_set(lbox, "radio-group", rdg); > > + elm_object_content_set(sc, lbox); > > + evas_object_show(lbox); > > + elm_box_pack_end(box, sc); > > + evas_object_show(sc); > > + > > + // right side > > + rbox = elm_box_add(win); > > + evas_object_size_hint_weight_set(rbox, EVAS_HINT_EXPAND, > > EVAS_HINT_EXPAND); > > + evas_object_size_hint_align_set(rbox, EVAS_HINT_FILL, EVAS_HINT_FILL); > > + evas_object_show(rbox); > > + elm_box_pack_end(box, rbox); > > + > > + bt = elm_button_add(win); > > + elm_object_text_set(bt, "Pack Start"); > > + evas_object_show(bt); > > + elm_box_pack_end(rbox, bt); > > + evas_object_smart_callback_add(bt, "clicked", _pack_start_btn_cb, > > lbox); > > + > > + bt = elm_button_add(win); > > + elm_object_text_set(bt, "Pack Before"); > > + evas_object_show(bt); > > + elm_box_pack_end(rbox, bt); > > + evas_object_smart_callback_add(bt, "clicked", _pack_before_btn_cb, > > lbox); > > + > > + bt = elm_button_add(win); > > + elm_object_text_set(bt, "Pack After"); > > + evas_object_show(bt); > > + elm_box_pack_end(rbox, bt); > > + evas_object_smart_callback_add(bt, "clicked", _pack_after_btn_cb, > > lbox); > > + > > + bt = elm_button_add(win); > > + elm_object_text_set(bt, "Pack End"); > > + evas_object_show(bt); > > + elm_box_pack_end(rbox, bt); > > + evas_object_smart_callback_add(bt, "clicked", _pack_end_btn_cb, lbox); > > + > > + bt = elm_button_add(win); > > + elm_object_text_set(bt, "Unpack"); > > + evas_object_show(bt); > > + elm_box_pack_end(rbox, bt); > > + evas_object_smart_callback_add(bt, "clicked", _unpack_btn_cb, lbox); > > + > > + bt = elm_button_add(win); > > + elm_object_text_set(bt, "Unpack All"); > > + evas_object_show(bt); > > + elm_box_pack_end(rbox, bt); > > + evas_object_smart_callback_add(bt, "clicked", _unpack_all_btn_cb, > > lbox); > > + > > + evas_object_resize(win, 320, 320); > > + evas_object_show(win); > > +} > > + > > +static void > > +_cb_check_changed(void *data, Evas_Object *obj, void *event __UNUSED__) > > +{ > > + Eina_Bool homo; > > + Evas_Object *box = data; > > + > > + homo = elm_check_state_get(obj); > > + elm_box_homogeneous_set(box, homo); > > + > > +} > > + > > +void > > +test_box_homo(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void > > *event_info __UNUSED__) > > +{ > > + Evas_Object *win, *bg; > > + Evas_Object *box, *o_bg; > > + Evas_Object *rd; > > + char buf[PATH_MAX]; > > + > > + win = elm_win_add(NULL, "box-homogeneous", ELM_WIN_BASIC); > > + elm_win_title_set(win, "Box Homogeneous"); > > + elm_win_autodel_set(win, EINA_TRUE); > > + > > + bg = elm_bg_add(win); > > + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, > > EVAS_HINT_EXPAND); > > + elm_win_resize_object_add(win, bg); > > + evas_object_show(bg); > > + > > + box = elm_box_add(win); > > + evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, > > EVAS_HINT_EXPAND); > > + elm_win_resize_object_add(win, box); > > + evas_object_show(box); > > + > > + o_bg = elm_bg_add(win); > > + snprintf(buf, sizeof(buf), "%s/images/twofish.jpg", > > elm_app_data_dir_get()); > > + elm_bg_file_set(o_bg, buf, NULL); > > + evas_object_size_hint_weight_set(o_bg, EVAS_HINT_EXPAND, > > EVAS_HINT_EXPAND); > > + evas_object_size_hint_align_set(o_bg, EVAS_HINT_FILL, EVAS_HINT_FILL); > > + elm_box_pack_end(box, o_bg); > > + > > + rd = elm_check_add(win); > > + elm_object_text_set(rd, "Homogeneous"); > > + evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL); > > + evas_object_smart_callback_add(rd, "changed", _cb_check_changed, box); > > + elm_box_pack_end(box, rd); > > + evas_object_show(rd); > > + > > + evas_object_show(o_bg); > > + evas_object_size_hint_min_set(bg, 160, 160); > > + evas_object_size_hint_max_set(bg, 640, 640); > > + evas_object_resize(win, 320, 320); > > + evas_object_show(win); > > +} > > + > > typedef struct > > { > > Eina_List *transitions; > > > > Modified: trunk/elementary/src/bin/test_genlist.c > > =================================================================== > > --- trunk/elementary/src/bin/test_genlist.c 2012-02-20 08:24:41 UTC > > (rev 68146) > > +++ trunk/elementary/src/bin/test_genlist.c 2012-02-20 08:26:17 UTC > > (rev 68147) > > @@ -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); > > } > > > > Modified: trunk/elementary/src/bin/test_store.c > > =================================================================== > > --- trunk/elementary/src/bin/test_store.c 2012-02-20 08:24:41 UTC > > (rev 68146) > > +++ trunk/elementary/src/bin/test_store.c 2012-02-20 08:26:17 UTC > > (rev 68147) > > @@ -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); > > } > > > > Modified: trunk/elementary/src/lib/elc_fileselector.c > > =================================================================== > > --- trunk/elementary/src/lib/elc_fileselector.c 2012-02-20 08:24:41 UTC > > (rev 68146) > > +++ trunk/elementary/src/lib/elc_fileselector.c 2012-02-20 08:26:17 UTC > > (rev 68147) > > @@ -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 } } > > + { ELM_GENGRID_ITEM_CLASS_HEADER, "default", { NULL, NULL, NULL, > > NULL } }, > > + { ELM_GENGRID_ITEM_CLASS_HEADER, "default", { NULL, NULL, NULL, > > NULL } }, > > + { ELM_GENGRID_ITEM_CLASS_HEADER, "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); > > > > Modified: trunk/elementary/src/lib/elm_deprecated_before.h > > =================================================================== > > --- trunk/elementary/src/lib/elm_deprecated_before.h 2012-02-20 > > 08:24:41 UTC (rev 68146) > > +++ trunk/elementary/src/lib/elm_deprecated_before.h 2012-02-20 > > 08:26:17 UTC (rev 68147) > > @@ -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 > > { > > > > Modified: trunk/elementary/src/lib/elm_gengrid.h > > =================================================================== > > --- trunk/elementary/src/lib/elm_gengrid.h 2012-02-20 08:24:41 UTC > > (rev 68146) > > +++ trunk/elementary/src/lib/elm_gengrid.h 2012-02-20 08:26:17 UTC > > (rev 68147) > > @@ -223,6 +223,8 @@ > > */ > > > > typedef struct _Elm_Gengrid_Item_Class Elm_Gengrid_Item_Class; /**< > > Gengrid item class definition structs */ > > +#define ELM_GENGRID_ITEM_CLASS_HEADER 0, 0, 0 > > + > > #define Elm_Gengrid_Item_Class Elm_Gen_Item_Class > > typedef struct _Elm_Gengrid_Item_Class_Func Elm_Gengrid_Item_Class_Func; > > /**< Class functions for gengrid item classes. */ > > > > > > Modified: trunk/elementary/src/lib/elm_genlist.c > > =================================================================== > > --- trunk/elementary/src/lib/elm_genlist.c 2012-02-20 08:24:41 UTC > > (rev 68146) > > +++ trunk/elementary/src/lib/elm_genlist.c 2012-02-20 08:26:17 UTC > > (rev 68147) > > @@ -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, > > > > Modified: trunk/elementary/src/lib/elm_genlist.h > > =================================================================== > > --- trunk/elementary/src/lib/elm_genlist.h 2012-02-20 08:24:41 UTC > > (rev 68146) > > +++ trunk/elementary/src/lib/elm_genlist.h 2012-02-20 08:26:17 UTC > > (rev 68147) > > @@ -364,6 +364,7 @@ > > ELM_GENLIST_ITEM_FIELD_STATE = (1 << 2) > > } Elm_Genlist_Item_Field_Flags; > > typedef struct _Elm_Genlist_Item_Class Elm_Genlist_Item_Class; /**< > > Genlist item class definition structs */ > > +#define ELM_GENLIST_ITEM_CLASS_HEADER 0, 0, 0 > > > > #define Elm_Genlist_Item_Class Elm_Gen_Item_Class > > typedef struct _Elm_Genlist_Item_Class_Func Elm_Genlist_Item_Class_Func; > > /**< Class functions for genlist item class */ > > @@ -1846,6 +1847,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); > > + > > +/** > > * @} > > */ > > > > > > > > ------------------------------------------------------------------------------ > > Try before you buy = See our experts in action! > > 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-dev2 > > _______________________________________________ > > enlightenment-svn mailing list > > enlightenment-...@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/enlightenment-svn > > > ------------------------------------------------------------------------------ > Try before you buy = See our experts in action! > 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-dev2 > _______________________________________________ > 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 ------------------------------------------------------------------------------ Try before you buy = See our experts in action! 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-dev2 _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel