elm_toolbar: handle the cleanup in the invalidate call

there is actaully no need to add the event, we can cleanup the pointer
in the invalidate call. Further more, the event was executed before the
method, thus checks against more_item failed because that was already
NULL. The result have been error messages, this fixes the error.

Differential Revision: https://phab.enlightenment.org/D6496
This commit is contained in:
Marcel Hollerbach 2018-07-02 11:16:41 +02:00
parent c14ea532eb
commit b28bd3ac0a
1 changed files with 2 additions and 11 deletions

View File

@ -2316,6 +2316,8 @@ _elm_toolbar_item_efl_object_invalidate(Eo *eo_item, Elm_Toolbar_Item_Data *item
if (item != sd->more_item)
efl_ui_widget_theme_apply(obj);
else
sd->more_item = NULL;
efl_invalidate(efl_super(eo_item, ELM_TOOLBAR_ITEM_CLASS));
}
@ -3349,14 +3351,6 @@ _elm_toolbar_item_separator_get(const Eo *eo_item EINA_UNUSED, Elm_Toolbar_Item_
return it->separator;
}
static void
_cleanup_more_item(void *data, const Efl_Event *ev EINA_UNUSED)
{
Elm_Toolbar_Data *sd = data;
sd->more_item = NULL;
}
EOLIAN static void
_elm_toolbar_shrink_mode_set(Eo *obj, Elm_Toolbar_Data *sd, Elm_Toolbar_Shrink_Mode shrink_mode)
{
@ -3403,9 +3397,6 @@ _elm_toolbar_shrink_mode_set(Eo *obj, Elm_Toolbar_Data *sd, Elm_Toolbar_Shrink_M
elm_interface_scrollable_policy_set
(obj, ELM_SCROLLER_POLICY_AUTO, ELM_SCROLLER_POLICY_OFF);
if (sd->more_item)
efl_event_callback_add(EO_OBJ(sd->more_item), EFL_EVENT_INVALIDATE, _cleanup_more_item, sd);
EINA_INLIST_FOREACH(sd->items, it)
_item_shrink_signal_emit(VIEW(it), sd->shrink_mode);