diff options
author | Jason Conti <jason.conti@gmail.com> | 2012-02-26 15:10:19 -0500 |
---|---|---|
committer | Jason Conti <jason.conti@gmail.com> | 2012-02-26 15:10:19 -0500 |
commit | 920396388ab4ed97133588382847a61318859aeb (patch) | |
tree | c89828b8df0a639d84d1a379bf0b4bf91fb4ec2c /src | |
parent | 5d8d44a32d19063be8237f52ebf5d56c4e90f7d6 (diff) | |
download | ayatana-indicator-notifications-920396388ab4ed97133588382847a61318859aeb.tar.gz ayatana-indicator-notifications-920396388ab4ed97133588382847a61318859aeb.tar.bz2 ayatana-indicator-notifications-920396388ab4ed97133588382847a61318859aeb.zip |
* Emit the clicked signal when the keyboard activates a menuitem.
- If using the spacebar, the menu won't hide
- If using enter, the menu hides
Diffstat (limited to 'src')
-rw-r--r-- | src/notification-menuitem.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/notification-menuitem.c b/src/notification-menuitem.c index 9e3c029..df510bd 100644 --- a/src/notification-menuitem.c +++ b/src/notification-menuitem.c @@ -19,6 +19,7 @@ enum { static void notification_menuitem_class_init(NotificationMenuItemClass *klass); static void notification_menuitem_init(NotificationMenuItem *self); +static void notification_activated_cb(GtkMenuItem *menuitem, gpointer user_data); static gboolean notification_button_press_cb(GtkWidget *widget, GdkEventButton *event, gpointer user_data); static gboolean notification_button_release_cb(GtkWidget *widget, GdkEventButton *event, gpointer user_data); @@ -69,6 +70,7 @@ notification_menuitem_init(NotificationMenuItem *self) gtk_container_add(GTK_CONTAINER(self), hbox); gtk_widget_show(hbox); + g_signal_connect(self, "activate", G_CALLBACK(notification_activated_cb), NULL); g_signal_connect(self, "button-press-event", G_CALLBACK(notification_button_press_cb), NULL); g_signal_connect(self, "button-release-event", G_CALLBACK(notification_button_release_cb), NULL); } @@ -105,6 +107,21 @@ notification_menuitem_set_from_notification(NotificationMenuItem *self, Notifica } /** + * notification_activated_cb: + * @menuitem: the menuitem + * @user_data: not used + * + * Emit a clicked event for the case where a keyboard activates a menuitem. + **/ +static void +notification_activated_cb(GtkMenuItem *menuitem, gpointer user_data) +{ + g_return_if_fail(IS_NOTIFICATION_MENUITEM(menuitem)); + + g_signal_emit(NOTIFICATION_MENUITEM(menuitem), notification_menuitem_signals[CLICKED], 0); +} + +/** * notification_button_press_cb: * @widget: the menuitem * @event: the button press event |