forked from enlightenment/efl
add clear call. fix free to have less leaks
SVN revision: 39073
This commit is contained in:
parent
0c40d9a0a8
commit
385fcff490
|
@ -2122,6 +2122,13 @@ my_bt_29(void *data, Evas_Object *obj, void *event_info)
|
|||
evas_object_show(win);
|
||||
}
|
||||
|
||||
static void
|
||||
my_gl_clear(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
Evas_Object *gl = data;
|
||||
elm_genlist_clear(gl);
|
||||
}
|
||||
|
||||
static void
|
||||
my_gl_add(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
|
@ -2227,6 +2234,14 @@ my_bt_30(void *data, Evas_Object *obj, void *event_info)
|
|||
elm_box_pack_end(bx2, bt);
|
||||
evas_object_show(bt);
|
||||
|
||||
bt = elm_button_add(win);
|
||||
elm_button_label_set(bt, "[X]");
|
||||
evas_object_smart_callback_add(bt, "clicked", my_gl_clear, gl);
|
||||
evas_object_size_hint_align_set(bt, -1.0, -1.0);
|
||||
evas_object_size_hint_weight_set(bt, 1.0, 0.0);
|
||||
elm_box_pack_end(bx2, bt);
|
||||
evas_object_show(bt);
|
||||
|
||||
bt = elm_button_add(win);
|
||||
elm_button_label_set(bt, "[+]");
|
||||
evas_object_smart_callback_add(bt, "clicked", my_gl_add, gl);
|
||||
|
|
|
@ -516,6 +516,7 @@ extern "C" {
|
|||
|
||||
EAPI Evas_Object *elm_genlist_add(Evas_Object *parent);
|
||||
EAPI Elm_Genlist_Item *elm_genlist_item_append(Evas_Object *obj, const Elm_Genlist_Item_Class *itc, const void *data, Elm_Genlist_Item *parent, Elm_Genlist_Item_Flags flags, void (*func) (void *data, Evas_Object *obj, void *event_info), const void *func_data);
|
||||
EAPI void elm_genlist_clear(Evas_Object *obj);
|
||||
EAPI const Elm_Genlist_Item *elm_genlist_selected_item_get(Evas_Object *obj);
|
||||
EAPI const Eina_List *elm_genlist_selected_items_get(Evas_Object *obj);
|
||||
EAPI const Elm_Genlist_Item *elm_genlist_first_item_get(Evas_Object *obj);
|
||||
|
|
|
@ -86,24 +86,7 @@ static void
|
|||
_del_hook(Evas_Object *obj)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
while (wd->items)
|
||||
{
|
||||
Item *it = (Item *)(wd->items);
|
||||
wd->items = eina_inlist_remove(wd->items, wd->items);
|
||||
if (it->realized) _item_unrealize(it);
|
||||
if (it->itc->func.del) it->itc->func.del(it->data, it->wd->obj);
|
||||
free(it);
|
||||
}
|
||||
while (wd->blocks)
|
||||
{
|
||||
Item_Block *itb = (Item_Block *)(wd->blocks);
|
||||
wd->blocks = eina_inlist_remove(wd->blocks, wd->blocks);
|
||||
if (itb->items) eina_list_free(itb->items);
|
||||
free(itb);
|
||||
}
|
||||
if (wd->selected) eina_list_free(wd->selected);
|
||||
if (wd->queue) eina_list_free(wd->queue);
|
||||
if (wd->calc_job) ecore_job_del(wd->calc_job);
|
||||
elm_genlist_clear(obj);
|
||||
evas_object_del(wd->pan_smart);
|
||||
wd->pan_smart = NULL;
|
||||
free(wd);
|
||||
|
@ -985,6 +968,53 @@ elm_genlist_item_insert_after(Evas_Object *obj, const Elm_Genlist_Item_Class *it
|
|||
// fixme
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_genlist_clear(Evas_Object *obj)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
while (wd->items)
|
||||
{
|
||||
Item *it = (Item *)(wd->items);
|
||||
wd->items = eina_inlist_remove(wd->items, wd->items);
|
||||
if (it->realized) _item_unrealize(it);
|
||||
if (it->itc->func.del) it->itc->func.del(it->data, it->wd->obj);
|
||||
free(it);
|
||||
}
|
||||
while (wd->blocks)
|
||||
{
|
||||
Item_Block *itb = (Item_Block *)(wd->blocks);
|
||||
wd->blocks = eina_inlist_remove(wd->blocks, wd->blocks);
|
||||
if (itb->items) eina_list_free(itb->items);
|
||||
free(itb);
|
||||
}
|
||||
if (wd->calc_job)
|
||||
{
|
||||
ecore_job_del(wd->calc_job);
|
||||
wd->calc_job = NULL;
|
||||
}
|
||||
if (wd->queue_idler)
|
||||
{
|
||||
ecore_idler_del(wd->queue_idler);
|
||||
wd->queue_idler = NULL;
|
||||
}
|
||||
if (wd->queue)
|
||||
{
|
||||
eina_list_free(wd->queue);
|
||||
wd->queue = NULL;
|
||||
}
|
||||
if (wd->selected)
|
||||
{
|
||||
eina_list_free(wd->selected);
|
||||
wd->selected = NULL;
|
||||
}
|
||||
wd->show_item = NULL;
|
||||
wd->pan_x = 0;
|
||||
wd->pan_y = 0;
|
||||
wd->minw = 0;
|
||||
wd->minh = 0;
|
||||
evas_object_smart_callback_call(wd->pan_smart, "changed", NULL);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_genlist_multi_select_set(Evas_Object *obj, Evas_Bool multi)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue