summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrii Kroitor <an.kroitor@samsung.com>2013-11-16 09:50:32 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2013-11-16 09:50:32 +0900
commite89f620324750aae8de9b4d968ee706df5fb4144 (patch)
tree39de3a4fe3aa7248e2a0e5842ac2cf721fd286c7
parent95794e0810d8de70d0cb98d68a04aa473f1e6c02 (diff)
Elm_menu: fixed item disable hook for elm_dbus_menu
Summary: Menu items in dbus-mode (in Ubunut/Unity) were not updated on disabled/enabled state changes. They were applied only after adding/removing an item. Reviewers: cedric, seoz, raster Reviewed By: raster CC: reutskiy.v.v Differential Revision: https://phab.enlightenment.org/D333
Diffstat (limited to '')
-rw-r--r--src/bin/test_main_menu.c9
-rw-r--r--src/lib/elm_dbus_menu.c1
-rw-r--r--src/lib/elm_menu.c5
-rw-r--r--src/lib/elm_priv.h1
-rw-r--r--src/lib/elm_widget_menu.h1
5 files changed, 12 insertions, 5 deletions
diff --git a/src/bin/test_main_menu.c b/src/bin/test_main_menu.c
index e21f4cb5a..846cc7173 100644
--- a/src/bin/test_main_menu.c
+++ b/src/bin/test_main_menu.c
@@ -2,13 +2,14 @@
2# include "elementary_config.h" 2# include "elementary_config.h"
3#endif 3#endif
4#include <Elementary.h> 4#include <Elementary.h>
5
6
7static void 5static void
8_click_me(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, 6_click_me(void *data, Evas_Object *obj EINA_UNUSED,
9 void *event_info EINA_UNUSED) 7 void *event_info EINA_UNUSED)
10{ 8{
9 Elm_Object_Item *it = (Elm_Object_Item *)data;
11 fputs(":-)\n", stderr); 10 fputs(":-)\n", stderr);
11 int disabled = elm_object_item_disabled_get(it);
12 elm_object_item_disabled_set(it, !disabled);
12} 13}
13 14
14void 15void
@@ -68,7 +69,7 @@ test_main_menu(void *data EINA_UNUSED,
68 menu_it1 = elm_menu_item_add(menu, menu_it, NULL, "disabled item", NULL, NULL); 69 menu_it1 = elm_menu_item_add(menu, menu_it, NULL, "disabled item", NULL, NULL);
69 elm_object_item_disabled_set(menu_it1, EINA_TRUE); 70 elm_object_item_disabled_set(menu_it1, EINA_TRUE);
70 elm_menu_item_separator_add(menu, menu_it); 71 elm_menu_item_separator_add(menu, menu_it);
71 elm_menu_item_add(menu, menu_it, NULL, "click me :-)", _click_me, NULL); 72 elm_menu_item_add(menu, menu_it, NULL, "click me :-)", _click_me, menu_it1);
72 elm_menu_item_add(menu, menu_it, "applications-email-panel", "third item", NULL, NULL); 73 elm_menu_item_add(menu, menu_it, "applications-email-panel", "third item", NULL, NULL);
73 menu_it1 = elm_menu_item_add(menu, menu_it, NULL, "sub menu", NULL, NULL); 74 menu_it1 = elm_menu_item_add(menu, menu_it, NULL, "sub menu", NULL, NULL);
74 elm_menu_item_add(menu, menu_it1, NULL, "first item", NULL, NULL); 75 elm_menu_item_add(menu, menu_it1, NULL, "first item", NULL, NULL);
diff --git a/src/lib/elm_dbus_menu.c b/src/lib/elm_dbus_menu.c
index 9c2287bc5..798ff1375 100644
--- a/src/lib/elm_dbus_menu.c
+++ b/src/lib/elm_dbus_menu.c
@@ -1032,5 +1032,6 @@ _elm_dbus_menu_item_delete(Elm_DBus_Menu *dbus_menu, int id)
1032void 1032void
1033_elm_dbus_menu_update(Elm_DBus_Menu *dbus_menu) 1033_elm_dbus_menu_update(Elm_DBus_Menu *dbus_menu)
1034{ 1034{
1035 dbus_menu->timestamp++;
1035 _layout_signal(dbus_menu); 1036 _layout_signal(dbus_menu);
1036} 1037}
diff --git a/src/lib/elm_menu.c b/src/lib/elm_menu.c
index 97411884d..d0e31de40 100644
--- a/src/lib/elm_menu.c
+++ b/src/lib/elm_menu.c
@@ -84,6 +84,7 @@ _item_disable_hook(Elm_Object_Item *it)
84 else 84 else
85 elm_layout_signal_emit(VIEW(item), "elm,state,enabled", "elm"); 85 elm_layout_signal_emit(VIEW(item), "elm,state,enabled", "elm");
86 86
87 if (item->dbus_menu) _elm_dbus_menu_update(item->dbus_menu);
87 edje_object_message_signal_process(elm_layout_edje_get(VIEW(item))); 88 edje_object_message_signal_process(elm_layout_edje_get(VIEW(item)));
88} 89}
89 90
@@ -985,8 +986,10 @@ _item_add(Eo *obj, void *_pd, va_list *list)
985 _elm_menu_item_add_helper(obj, (Elm_Menu_Item *)parent, subitem, sd); 986 _elm_menu_item_add_helper(obj, (Elm_Menu_Item *)parent, subitem, sd);
986 987
987 if (sd->dbus_menu) 988 if (sd->dbus_menu)
989 {
988 subitem->dbus_idx = _elm_dbus_menu_item_add(sd->dbus_menu, (Elm_Object_Item *)subitem); 990 subitem->dbus_idx = _elm_dbus_menu_item_add(sd->dbus_menu, (Elm_Object_Item *)subitem);
989 991 subitem->dbus_menu = sd->dbus_menu;
992 }
990 *ret = (Elm_Object_Item *)subitem; 993 *ret = (Elm_Object_Item *)subitem;
991} 994}
992 995
diff --git a/src/lib/elm_priv.h b/src/lib/elm_priv.h
index 8b5846694..110b615ee 100644
--- a/src/lib/elm_priv.h
+++ b/src/lib/elm_priv.h
@@ -437,6 +437,7 @@ const char *_elm_dbus_menu_register(Eo *obj);
437void _elm_dbus_menu_unregister(Eo *obj); 437void _elm_dbus_menu_unregister(Eo *obj);
438int _elm_dbus_menu_item_add(Elm_DBus_Menu *dbus_menu, 438int _elm_dbus_menu_item_add(Elm_DBus_Menu *dbus_menu,
439 Elm_Object_Item *item); 439 Elm_Object_Item *item);
440void _elm_dbus_menu_update(Elm_DBus_Menu *dbus_menu);
440void _elm_dbus_menu_item_delete(Elm_DBus_Menu *dbus_menu, 441void _elm_dbus_menu_item_delete(Elm_DBus_Menu *dbus_menu,
441 int id); 442 int id);
442 443
diff --git a/src/lib/elm_widget_menu.h b/src/lib/elm_widget_menu.h
index 03e3ef0c8..2bde15bc5 100644
--- a/src/lib/elm_widget_menu.h
+++ b/src/lib/elm_widget_menu.h
@@ -40,6 +40,7 @@ struct _Elm_Menu_Item
40 const char *label; 40 const char *label;
41 Evas_Smart_Cb func; 41 Evas_Smart_Cb func;
42 unsigned int idx; 42 unsigned int idx;
43 Elm_DBus_Menu *dbus_menu;
43 int dbus_idx; 44 int dbus_idx;
44 45
45 struct 46 struct