elementary - modified item_del_pre_hook function prototype.
Now it returns the bool value to free the widget item. Some widget items(i,e genlist) should not be deleted directly when elm_object_item_del is called. So, if the pre_hook function returns EINA_FALSE, then the widget item will not be deleted. SVN revision: 67565
This commit is contained in:
parent
749e8e2642
commit
fcc6192848
|
@ -1233,16 +1233,16 @@ _remove_items(Widget_Data *wd)
|
|||
wd->items = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
static Eina_Bool
|
||||
_item_del_pre_hook(Elm_Object_Item *it)
|
||||
{
|
||||
ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
|
||||
ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
|
||||
|
||||
Widget_Data *wd;
|
||||
Elm_Ctxpopup_Item *ctxpopup_it = (Elm_Ctxpopup_Item *) it;
|
||||
|
||||
wd = elm_widget_data_get(WIDGET(ctxpopup_it));
|
||||
if (!wd) return;
|
||||
if (!wd) return EINA_FALSE;
|
||||
|
||||
if (ctxpopup_it->icon)
|
||||
evas_object_del(ctxpopup_it->icon);
|
||||
|
@ -1258,11 +1258,13 @@ _item_del_pre_hook(Elm_Object_Item *it)
|
|||
if (eina_list_count(wd->items) < 1)
|
||||
{
|
||||
evas_object_hide(WIDGET(ctxpopup_it));
|
||||
return;
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
if (wd->visible)
|
||||
_sizing_eval(WIDGET(ctxpopup_it));
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
EAPI Evas_Object *
|
||||
|
|
|
@ -309,19 +309,21 @@ _item_text_get_hook(const Elm_Object_Item *it, const char *part)
|
|||
return ((Elm_Hoversel_Item *) it)->label;
|
||||
}
|
||||
|
||||
static void
|
||||
static Eina_Bool
|
||||
_item_del_pre_hook(Elm_Object_Item *it)
|
||||
{
|
||||
ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
|
||||
ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
|
||||
Widget_Data *wd;
|
||||
Elm_Hoversel_Item *item = (Elm_Hoversel_Item *) it;
|
||||
wd = elm_widget_data_get(WIDGET(item));
|
||||
if (!wd) return;
|
||||
if (!wd) return EINA_FALSE;
|
||||
elm_hoversel_hover_end(WIDGET(item));
|
||||
wd->items = eina_list_remove(wd->items, item);
|
||||
eina_stringshare_del(item->label);
|
||||
eina_stringshare_del(item->icon_file);
|
||||
eina_stringshare_del(item->icon_group);
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
EAPI Evas_Object *
|
||||
|
|
|
@ -760,11 +760,12 @@ _resize_button(Evas_Object *btn, Evas_Coord *realw, Evas_Coord *vieww)
|
|||
if (vieww) *vieww = vw;
|
||||
}
|
||||
|
||||
static void
|
||||
static Eina_Bool
|
||||
_item_del_pre_hook(Elm_Object_Item *it)
|
||||
{
|
||||
ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
|
||||
ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
|
||||
_del_button_item((Elm_Multibuttonentry_Item *) it);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static Elm_Multibuttonentry_Item*
|
||||
|
|
|
@ -128,7 +128,7 @@ static Evas_Object * _title_icon_unset(Elm_Naviframe_Item *it);
|
|||
static Evas_Object * _title_content_unset(Elm_Naviframe_Item *it,
|
||||
const char *part);
|
||||
static void _item_del(Elm_Naviframe_Item *it);
|
||||
static void _item_del_pre_hook(Elm_Object_Item *it);
|
||||
static Eina_Bool _item_del_pre_hook(Elm_Object_Item *it);
|
||||
static void _pushed_finished(void *data,
|
||||
Evas_Object *obj,
|
||||
const char *emission,
|
||||
|
@ -779,16 +779,16 @@ _item_del(Elm_Naviframe_Item *it)
|
|||
eina_stringshare_del(it->style);
|
||||
}
|
||||
|
||||
static void
|
||||
static Eina_Bool
|
||||
_item_del_pre_hook(Elm_Object_Item *it)
|
||||
{
|
||||
ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
|
||||
ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
|
||||
Elm_Naviframe_Item *navi_it;
|
||||
Widget_Data *wd;
|
||||
|
||||
navi_it =(Elm_Naviframe_Item *) it;
|
||||
wd = elm_widget_data_get(WIDGET(navi_it));
|
||||
if (!wd) return;
|
||||
if (!wd) return EINA_FALSE;
|
||||
|
||||
if (it == elm_naviframe_top_item_get(WIDGET(navi_it)))
|
||||
{
|
||||
|
@ -796,7 +796,7 @@ _item_del_pre_hook(Elm_Object_Item *it)
|
|||
_item_del(navi_it);
|
||||
elm_widget_item_free(navi_it);
|
||||
//If the item is only one, the stack will be empty
|
||||
if (!wd->stack) return;
|
||||
if (!wd->stack) return EINA_TRUE;
|
||||
navi_it = EINA_INLIST_CONTAINER_GET(wd->stack->last,
|
||||
Elm_Naviframe_Item);
|
||||
evas_object_show(VIEW(navi_it));
|
||||
|
@ -809,6 +809,8 @@ _item_del_pre_hook(Elm_Object_Item *it)
|
|||
_item_del(navi_it);
|
||||
elm_widget_item_free(navi_it);
|
||||
}
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -226,17 +226,17 @@ _check_string(void *data)
|
|||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
static Eina_Bool
|
||||
_item_del_pre_hook(Elm_Object_Item *it)
|
||||
{
|
||||
ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
|
||||
ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
|
||||
Elm_Diskselector_Item *item, *item2, *dit;
|
||||
Eina_List *l;
|
||||
int i = 0;
|
||||
Widget_Data *wd;
|
||||
item = (Elm_Diskselector_Item *) it;
|
||||
wd = elm_widget_data_get(WIDGET(item));
|
||||
if (!wd) return;
|
||||
if (!wd) return EINA_FALSE;
|
||||
|
||||
elm_box_unpack(wd->main_box, VIEW(item));
|
||||
|
||||
|
@ -327,6 +327,7 @@ _item_del_pre_hook(Elm_Object_Item *it)
|
|||
wd->check_idler = ecore_idle_enterer_before_add(_check_string, wd);
|
||||
_sizing_eval(wd->self);
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static Elm_Diskselector_Item *
|
||||
|
|
|
@ -57,7 +57,7 @@ static void _update_view(Evas_Object *obj);
|
|||
static void _callbacks_set(Evas_Object *obj);
|
||||
static void _flip_up(Widget_Data *wd);
|
||||
static void _flip_down(Widget_Data *wd);
|
||||
static void _item_del_pre_hook(Elm_Object_Item *it);
|
||||
static Eina_Bool _item_del_pre_hook(Elm_Object_Item *it);
|
||||
|
||||
static const char SIG_SELECTED[] = "selected";
|
||||
static const char SIG_UNDERFLOWED[] = "underflowed";
|
||||
|
@ -576,22 +576,22 @@ _callbacks_set(Evas_Object *obj)
|
|||
"", _signal_val_change_stop, obj);
|
||||
}
|
||||
|
||||
static void
|
||||
static Eina_Bool
|
||||
_item_del_pre_hook(Elm_Object_Item *it)
|
||||
{
|
||||
ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
|
||||
ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
|
||||
Widget_Data *wd;
|
||||
Elm_Flipselector_Item *item, *item2;
|
||||
Eina_List *l;
|
||||
|
||||
item = (Elm_Flipselector_Item *) it;
|
||||
wd = elm_widget_data_get(WIDGET(item));
|
||||
if (!wd) return;
|
||||
if (!wd) return EINA_FALSE;
|
||||
|
||||
if (wd->walking > 0)
|
||||
{
|
||||
item->deleted = EINA_TRUE;
|
||||
return;
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
_flipselector_walk(wd);
|
||||
|
@ -619,6 +619,8 @@ _item_del_pre_hook(Elm_Object_Item *it)
|
|||
eina_stringshare_del(item->label);
|
||||
_sentinel_eval(wd);
|
||||
_flipselector_unwalk(wd);
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
EAPI Evas_Object *
|
||||
|
|
|
@ -189,14 +189,15 @@ _sizing_eval(Evas_Object *obj)
|
|||
evas_object_size_hint_max_set(obj, maxw, maxh);
|
||||
}
|
||||
|
||||
static void
|
||||
static Eina_Bool
|
||||
_item_del_pre_hook(Elm_Object_Item *it)
|
||||
{
|
||||
ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
|
||||
ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
|
||||
Widget_Data *wd = elm_widget_data_get(WIDGET(it));
|
||||
if (!wd) return;
|
||||
if (!wd) return EINA_FALSE;
|
||||
_item_free((Elm_Index_Item *) it);
|
||||
_index_box_clear(WIDGET(it), wd->bx[wd->level], wd->level);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static Elm_Index_Item *
|
||||
|
|
|
@ -690,10 +690,10 @@ _elm_menu_item_add_helper(Evas_Object *obj, Elm_Menu_Item *parent, Elm_Menu_Item
|
|||
_sizing_eval(obj);
|
||||
}
|
||||
|
||||
static void
|
||||
static Eina_Bool
|
||||
_item_del_pre_hook(Elm_Object_Item *it)
|
||||
{
|
||||
ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
|
||||
ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
|
||||
Elm_Menu_Item *item = (Elm_Menu_Item *) it;
|
||||
Elm_Object_Item *_item;
|
||||
|
||||
|
@ -710,6 +710,8 @@ _item_del_pre_hook(Elm_Object_Item *it)
|
|||
Widget_Data *wd = elm_widget_data_get(WIDGET(item));
|
||||
wd->items = eina_list_remove(wd->items, item);
|
||||
}
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
EAPI Elm_Object_Item *
|
||||
|
|
|
@ -503,18 +503,20 @@ _item_content_get_hook(const Elm_Object_Item *it, const char *part)
|
|||
return ((Elm_Segment_Item *) it)->icon;
|
||||
}
|
||||
|
||||
static void
|
||||
static Eina_Bool
|
||||
_item_del_pre_hook(Elm_Object_Item *it)
|
||||
{
|
||||
ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
|
||||
ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
|
||||
Widget_Data *wd;
|
||||
Elm_Segment_Item *item = (Elm_Segment_Item *) it;
|
||||
|
||||
wd = elm_widget_item_data_get(item);
|
||||
if (!wd) return;
|
||||
if (!wd) return EINA_FALSE;
|
||||
|
||||
_item_free(item);
|
||||
_update_list(wd);
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static Elm_Segment_Item*
|
||||
|
|
|
@ -348,14 +348,15 @@ _timer_cb(void *data)
|
|||
return ECORE_CALLBACK_CANCEL;
|
||||
}
|
||||
|
||||
static void
|
||||
static Eina_Bool
|
||||
_item_del_pre_hook(Elm_Object_Item *it)
|
||||
{
|
||||
ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
|
||||
ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
|
||||
|
||||
Elm_Slideshow_Item *item = (Elm_Slideshow_Item *) it;
|
||||
Widget_Data *wd = elm_widget_data_get(WIDGET(item));
|
||||
if (!wd) return;
|
||||
if (!wd) return EINA_FALSE;
|
||||
|
||||
if (wd->previous == item) wd->previous = NULL;
|
||||
if (wd->current == item)
|
||||
{
|
||||
|
@ -378,6 +379,8 @@ _item_del_pre_hook(Elm_Object_Item *it)
|
|||
|
||||
if ((VIEW(item)) && (item->itc->func.del))
|
||||
item->itc->func.del(elm_widget_item_data_get(item), VIEW(item));
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
EAPI Evas_Object *
|
||||
|
|
|
@ -764,10 +764,10 @@ _access_state_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, Elm_Widget_
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
static Eina_Bool
|
||||
_item_del_pre_hook(Elm_Object_Item *it)
|
||||
{
|
||||
ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
|
||||
ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
|
||||
|
||||
Widget_Data *wd;
|
||||
Evas_Object *obj2;
|
||||
|
@ -775,7 +775,8 @@ _item_del_pre_hook(Elm_Object_Item *it)
|
|||
item = (Elm_Toolbar_Item *) it;
|
||||
|
||||
wd = elm_widget_data_get(WIDGET(item));
|
||||
if (!wd) return;
|
||||
if (!wd) return EINA_FALSE;
|
||||
|
||||
obj2 = WIDGET(item);
|
||||
next = ELM_TOOLBAR_ITEM_FROM_INLIST(EINA_INLIST_GET(item)->next);
|
||||
wd->items = eina_inlist_remove(wd->items, EINA_INLIST_GET(item));
|
||||
|
@ -784,6 +785,8 @@ _item_del_pre_hook(Elm_Object_Item *it)
|
|||
if (wd->always_select && item->selected && next) _item_select(next);
|
||||
_item_del(item);
|
||||
_theme_hook(obj2);
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static Elm_Toolbar_Item *
|
||||
|
|
|
@ -2818,13 +2818,10 @@ _elm_widget_item_free(Elm_Widget_Item *item)
|
|||
{
|
||||
_elm_access_clear(item->access);
|
||||
free(item->access);
|
||||
item->access = NULL;
|
||||
}
|
||||
|
||||
if (item->access_info)
|
||||
{
|
||||
eina_stringshare_del(item->access_info);
|
||||
item->access_info = NULL;
|
||||
}
|
||||
eina_stringshare_del(item->access_info);
|
||||
|
||||
EINA_MAGIC_SET(item, EINA_MAGIC_NONE);
|
||||
free(item);
|
||||
|
@ -2853,11 +2850,12 @@ _elm_widget_item_del(Elm_Widget_Item *item)
|
|||
{
|
||||
ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
|
||||
|
||||
//Widget delete callback
|
||||
//Widget item delete callback
|
||||
if (item->del_pre_func)
|
||||
item->del_pre_func((Elm_Object_Item *) item);
|
||||
|
||||
_elm_widget_item_free(item);
|
||||
{
|
||||
if (item->del_pre_func((Elm_Object_Item *) item))
|
||||
_elm_widget_item_free(item);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -207,7 +207,7 @@ typedef Evas_Object *(*Elm_Widget_Content_Get_Cb)(const void *data, con
|
|||
typedef Evas_Object *(*Elm_Widget_Content_Unset_Cb)(const void *data, const char *part);
|
||||
typedef void (*Elm_Widget_Signal_Emit_Cb)(void *data, const char *emission, const char *source);
|
||||
typedef void (*Elm_Widget_Disable_Cb)(void *data);
|
||||
typedef void (*Elm_Widget_Del_Pre_Cb)(void *data);
|
||||
typedef Eina_Bool (*Elm_Widget_Del_Pre_Cb)(void *data);
|
||||
|
||||
#define ELM_ACCESS_TYPE 0 // when reading out widget or item this is read first
|
||||
#define ELM_ACCESS_INFO 1 // next read is info - this is normally label
|
||||
|
|
Loading…
Reference in New Issue