From 4c20267a1c5db9f7b259524ea92403a8caeb58ab Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 16 Mar 2011 10:23:03 -0500 Subject: Adding defines for the event ids --- libdbusmenu-glib/menuitem.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/libdbusmenu-glib/menuitem.h b/libdbusmenu-glib/menuitem.h index f4eb989..afd1d4e 100644 --- a/libdbusmenu-glib/menuitem.h +++ b/libdbusmenu-glib/menuitem.h @@ -267,6 +267,32 @@ G_BEGIN_DECLS */ #define DBUSMENU_MENUITEM_CHILD_DISPLAY_SUBMENU "submenu" +/** + * DBUSMENU_MENUITEM_EVENT_ACTIVATED: + * + * String for the event identifier when a menu item is clicked + * on by the user. + */ +#define DBUSMENU_MENUITEM_EVENT_ACTIVATED "clicked" + +/** + * DBUSMENU_MENUITEM_EVENT_OPENED: + * + * String for the event identifier when a menu is opened and + * displayed to the user. Only valid for items that contain + * submenus. + */ +#define DBUSMENU_MENUITEM_EVENT_OPENED "opened" + +/** + * DBUSMENU_MENUITEM_EVENT_CLOSED: + * + * String for the event identifier when a menu is closed and + * displayed to the user. Only valid for items that contain + * submenus. + */ +#define DBUSMENU_MENUITEM_EVENT_CLOSED "closed" + typedef struct _DbusmenuMenuitemPrivate DbusmenuMenuitemPrivate; /** -- cgit v1.2.3 From 224a7bad973443574bdd182fcd7b544c641edc58 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 16 Mar 2011 10:27:00 -0500 Subject: Using the new defines --- libdbusmenu-glib/menuitem.c | 2 +- libdbusmenu-gtk/client.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 2e5a345..70b5fd2 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -430,7 +430,7 @@ get_property (GObject * obj, guint id, GValue * value, GParamSpec * pspec) static void handle_event (DbusmenuMenuitem * mi, const gchar * name, GVariant * value, guint timestamp) { - if (g_strcmp0(name, "clicked") == 0) { + if (g_strcmp0(name, DBUSMENU_MENUITEM_EVENT_ACTIVATED) == 0) { g_signal_emit(G_OBJECT(mi), signals[ITEM_ACTIVATED], 0, timestamp, TRUE); } diff --git a/libdbusmenu-gtk/client.c b/libdbusmenu-gtk/client.c index f9de880..497808b 100644 --- a/libdbusmenu-gtk/client.c +++ b/libdbusmenu-gtk/client.c @@ -458,7 +458,7 @@ menu_pressed_cb (GtkMenuItem * gmi, DbusmenuMenuitem * mi) { if (gtk_menu_item_get_submenu(gmi) == NULL) { GVariant * variant = g_variant_new("i", 0); - dbusmenu_menuitem_handle_event(mi, "clicked", variant, gtk_get_current_event_time()); + dbusmenu_menuitem_handle_event(mi, DBUSMENU_MENUITEM_EVENT_ACTIVATED, variant, gtk_get_current_event_time()); } else { /* TODO: We need to stop the display of the submenu until this callback returns. */ @@ -471,9 +471,9 @@ static void submenu_notify_visible_cb (GtkWidget * menu, GParamSpec * pspec, DbusmenuMenuitem * mi) { if (gtk_widget_get_visible (menu)) - dbusmenu_menuitem_handle_event(mi, "opened", NULL, gtk_get_current_event_time()); + dbusmenu_menuitem_handle_event(mi, DBUSMENU_MENUITEM_EVENT_OPENED, NULL, gtk_get_current_event_time()); else - dbusmenu_menuitem_handle_event(mi, "closed", NULL, gtk_get_current_event_time()); + dbusmenu_menuitem_handle_event(mi, DBUSMENU_MENUITEM_EVENT_CLOSED, NULL, gtk_get_current_event_time()); } /* Process the visible property */ -- cgit v1.2.3 From 7cd13f9f5a9cee28e3c35a50ddf5bb366a3fd53c Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 16 Mar 2011 10:27:40 -0500 Subject: Adding opened and closed to the spec --- libdbusmenu-glib/dbus-menu.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libdbusmenu-glib/dbus-menu.xml b/libdbusmenu-glib/dbus-menu.xml index efb55d4..a36c148 100644 --- a/libdbusmenu-glib/dbus-menu.xml +++ b/libdbusmenu-glib/dbus-menu.xml @@ -294,6 +294,8 @@ License version 3 and version 2.1 along with this program. If not, see @li "clicked" @li "hovered" + @li "opened" + @li "closed" Vendor specific events can be added by prefixing them with "x--" ]]> -- cgit v1.2.3 From d2243c9e779c8b7038a6dff55f0cd1d5a0721351 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 16 Mar 2011 10:28:34 -0500 Subject: Adding event defines to the documentation. --- docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt b/docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt index 84d8257..4d1e50a 100644 --- a/docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt +++ b/docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt @@ -70,6 +70,9 @@ DBUSMENU_MENUITEM_SHORTCUT_ALT DBUSMENU_MENUITEM_SHORTCUT_CONTROL DBUSMENU_MENUITEM_SHORTCUT_SHIFT DBUSMENU_MENUITEM_SHORTCUT_SUPER +DBUSMENU_MENUITEM_EVENT_ACTIVATED +DBUSMENU_MENUITEM_EVENT_CLOSED +DBUSMENU_MENUITEM_EVENT_OPENED DbusmenuMenuitem dbusmenu_menuitem_about_to_show_cb dbusmenu_menuitem_buildvariant_slot_t -- cgit v1.2.3