diff options
author | Ted Gould <ted@gould.cx> | 2011-03-16 10:29:58 -0500 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2011-03-16 10:29:58 -0500 |
commit | 7be07c87e6f01fa30fc66a2d3d05e868f29d362a (patch) | |
tree | 9a70364818ae894f986b9b39603c0520d6529f37 | |
parent | 7b45ed929b6c83335034ee9e3b98cf6dd7891b7a (diff) | |
parent | d2243c9e779c8b7038a6dff55f0cd1d5a0721351 (diff) | |
download | libdbusmenu-7be07c87e6f01fa30fc66a2d3d05e868f29d362a.tar.gz libdbusmenu-7be07c87e6f01fa30fc66a2d3d05e868f29d362a.tar.bz2 libdbusmenu-7be07c87e6f01fa30fc66a2d3d05e868f29d362a.zip |
Adding defines for the event identifiers
-rw-r--r-- | docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt | 3 | ||||
-rw-r--r-- | libdbusmenu-glib/dbus-menu.xml | 2 | ||||
-rw-r--r-- | libdbusmenu-glib/menuitem.c | 2 | ||||
-rw-r--r-- | libdbusmenu-glib/menuitem.h | 26 | ||||
-rw-r--r-- | libdbusmenu-gtk/client.c | 6 |
5 files changed, 35 insertions, 4 deletions
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 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-<vendor>-" ]]></dox:d> 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-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; /** 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 */ |