forked from enlightenment/efl
Object Items: Adapt del callback to Eo.
Because of widget item design, it is hard to make it fit to Eo as it should be: - _eo_del_cb should have the callback pointer as data but pre_notify function forces its storage into the item data because we need to be able to call the cb before del is really triggered. - only one cb is supported for an item, meaning replacing it would mean we have to save the function pointer inside the item, delete the callback with the previous function as data and then add the new callback. Instead of it, we just add our own wrapper as Eo callback that will invoke the function pointer stored in the item data.
This commit is contained in:
parent
ef03bc098e
commit
9d50d391a0
|
@ -4096,6 +4096,16 @@ _elm_widget_item_signal_callback_list_get(Elm_Widget_Item_Data *item, Eina_List
|
|||
|
||||
#define ERR_NOT_SUPPORTED(item, method) ERR("%s does not support %s API.", elm_widget_type_get(item->widget), method);
|
||||
|
||||
static Eina_Bool
|
||||
_eo_del_cb(void *data EINA_UNUSED, Eo *eo_item, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||
{
|
||||
Elm_Widget_Item_Data *item = eo_data_scope_get(eo_item, ELM_WIDGET_ITEM_CLASS);
|
||||
ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, EINA_TRUE);
|
||||
if (item->del_func)
|
||||
item->del_func((void *)item->data, item->widget, item);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
|
@ -4130,6 +4140,7 @@ _elm_widget_item_eo_base_constructor(Eo *eo_item, Elm_Widget_Item_Data *item)
|
|||
eo_do_super(eo_item, ELM_WIDGET_ITEM_CLASS, eo_constructor());
|
||||
item->widget = widget;
|
||||
item->eo_obj = eo_item;
|
||||
eo_do(eo_item, eo_event_callback_add(EO_BASE_EVENT_DEL, _eo_del_cb, NULL));
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
|
@ -4139,9 +4150,6 @@ _elm_widget_item_eo_base_destructor(Eo *eo_item, Elm_Widget_Item_Data *item)
|
|||
|
||||
ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
|
||||
|
||||
if (item->del_func)
|
||||
item->del_func((void *)item->data, item->widget, item);
|
||||
|
||||
evas_object_del(item->view);
|
||||
|
||||
eina_stringshare_del(item->access_info);
|
||||
|
|
Loading…
Reference in New Issue