summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Zaoui <daniel.zaoui@samsung.com>2016-11-09 07:39:10 +0200
committerDaniel Zaoui <daniel.zaoui@samsung.com>2016-11-09 07:42:57 +0200
commit0c78e1eb4d61ae42fcd24a59acef641bb3188636 (patch)
tree9b4870c3d44e866893e5b9bd03ffcc323888ecdd
parent7957041d845a0130f57be7abad4acd1f61141764 (diff)
downloadefl-0c78e1eb4d61ae42fcd24a59acef641bb3188636.tar.gz
Toolbar: fix icon switch during state change
When many states are set on an item, the icon is deleted when the state is changed. This shouldn't be as it leads to an unstable state whose icon is still considered as existing and errors displayed on the screen. We need to check that the icon is not used inside any state to permit its deletion. Otherwise we should just hide it. @fix
-rw-r--r--src/lib/elementary/elm_toolbar.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/lib/elementary/elm_toolbar.c b/src/lib/elementary/elm_toolbar.c
index 67f9518091..e9bbc9f02b 100644
--- a/src/lib/elementary/elm_toolbar.c
+++ b/src/lib/elementary/elm_toolbar.c
@@ -2626,7 +2626,16 @@ _elm_toolbar_item_icon_obj_set(Evas_Object *obj,
}
if (item->icon)
{
- evas_object_del(item->icon);
+ Elm_Toolbar_Item_State *it_state;
+ Eina_List *l;
+ Eina_Bool found = EINA_FALSE;
+ EINA_LIST_FOREACH(item->states, l, it_state)
+ {
+ found |= (it_state->icon == item->icon);
+ }
+ if (!found) evas_object_del(item->icon);
+ else evas_object_hide(item->icon);
+ elm_layout_content_unset(VIEW(item), "elm.swallow.icon");
}
item->icon = icon_obj;