From 430d6bd6327cc68ccdb641a9866cc4040699bda6 Mon Sep 17 00:00:00 2001 From: discomfitor Date: Mon, 12 Sep 2011 02:05:30 +0000 Subject: [PATCH] clicking a toolbar item is now a toggle: clicking an unselected item -> item is selected clicking a selected item -> item is unselected git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@63333 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/elm_toolbar.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/lib/elm_toolbar.c b/src/lib/elm_toolbar.c index b4dfcc2..a82d291 100644 --- a/src/lib/elm_toolbar.c +++ b/src/lib/elm_toolbar.c @@ -136,23 +136,29 @@ _item_select(Elm_Toolbar_Item *it) Elm_Toolbar_Item *it2; Widget_Data *wd = elm_widget_data_get(it->base.widget); Evas_Object *obj2; + Eina_Bool sel; if (!wd) return; - if ((it->selected) || (it->disabled) || (it->separator)) return; + if ((it->disabled) || (it->separator)) return; + sel = it->selected; if (!wd->no_select) { - it2 = elm_toolbar_selected_item_get(it->base.widget); - _item_unselect(it2); - - it->selected = EINA_TRUE; - wd->selected_item = it; - edje_object_signal_emit(it->base.view, "elm,state,selected", "elm"); - elm_widget_signal_emit(it->icon, "elm,state,selected", "elm"); - _item_show(it); + if (sel) _item_unselect(it); + else + { + it2 = elm_toolbar_selected_item_get(it->base.widget); + _item_unselect(it2); + + it->selected = EINA_TRUE; + wd->selected_item = it; + edje_object_signal_emit(it->base.view, "elm,state,selected", "elm"); + elm_widget_signal_emit(it->icon, "elm,state,selected", "elm"); + _item_show(it); + } } obj2 = it->base.widget; - if (it->menu) + if (it->menu && (!sel)) { evas_object_show(it->o_menu); evas_object_event_callback_add(it->base.view, EVAS_CALLBACK_RESIZE, -- 2.7.4