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
Index: elementary/src/lib/elm_genlist.c
===================================================================
--- elementary/src/lib/elm_genlist.c (리비전 68002)
+++ 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/elm_genlist.h
===================================================================
--- elementary/src/lib/elm_genlist.h (리비전 68002)
+++ 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 (리비전 68002)
+++ 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_genlist.c
===================================================================
--- elementary/src/bin/test_genlist.c (리비전 68002)
+++ 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