aboutsummaryrefslogtreecommitdiff
path: root/src/notification-menuitem.c
diff options
context:
space:
mode:
authorJason Conti <jason.conti@gmail.com>2016-08-28 15:49:33 -0400
committerJason Conti <jason.conti@gmail.com>2016-08-28 15:49:33 -0400
commit39810bbf1c3128d0bcaf292e200776173de212cd (patch)
tree98f892e69cf7da00832b22371c4d8cbf1b9b5f60 /src/notification-menuitem.c
parent83f8134780499def6fe2973934d5b7b8e015e28f (diff)
downloadayatana-indicator-notifications-39810bbf1c3128d0bcaf292e200776173de212cd.tar.gz
ayatana-indicator-notifications-39810bbf1c3128d0bcaf292e200776173de212cd.tar.bz2
ayatana-indicator-notifications-39810bbf1c3128d0bcaf292e200776173de212cd.zip
* Added back hide_on_activate = false on the notification menuitem
- Enables using space when in keyboard navigation to avoid closing the menu * Added custom close icons for selected and deselected notifications - Since we don't set PRELIGHT, needed a way to show the selected notification during keyboard navigation - gtk-close is deprecated anyway, so might as well use our own - Can be replaced by the icon theme to look more appropriate
Diffstat (limited to 'src/notification-menuitem.c')
-rw-r--r--src/notification-menuitem.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/notification-menuitem.c b/src/notification-menuitem.c
index 08274cf..3240de1 100644
--- a/src/notification-menuitem.c
+++ b/src/notification-menuitem.c
@@ -11,6 +11,8 @@
#include "urlregex.h"
#define NOTIFICATION_MENUITEM_MAX_CHARS 42
+#define NOTIFICATION_MENUITEM_CLOSE_SELECT "indicator-notification-close-select"
+#define NOTIFICATION_MENUITEM_CLOSE_DESELECT "indicator-notification-close-deselect"
enum {
CLICKED,
@@ -50,6 +52,7 @@ notification_menuitem_class_init(NotificationMenuItemClass *klass)
g_type_class_add_private(klass, sizeof(NotificationMenuItemPrivate));
+ menu_item_class->hide_on_activate = FALSE;
menu_item_class->activate = notification_menuitem_activate;
menu_item_class->select = notification_menuitem_select;
menu_item_class->deselect = notification_menuitem_deselect;
@@ -87,7 +90,7 @@ notification_menuitem_init(NotificationMenuItem *self)
gtk_box_pack_start(GTK_BOX(self->priv->hbox), self->priv->label, TRUE, TRUE, 0);
gtk_widget_show(self->priv->label);
- self->priv->close_image = gtk_image_new_from_icon_name("gtk-close", GTK_ICON_SIZE_MENU);
+ self->priv->close_image = gtk_image_new_from_icon_name(NOTIFICATION_MENUITEM_CLOSE_DESELECT, GTK_ICON_SIZE_MENU);
gtk_widget_show(self->priv->close_image);
gtk_box_pack_start(GTK_BOX(self->priv->hbox), self->priv->close_image, FALSE, FALSE, 0);
@@ -229,12 +232,25 @@ notification_menuitem_button_release(GtkWidget *widget, GdkEventButton *event)
static void
notification_menuitem_select(GtkMenuItem *menuitem)
{
- /* FIXME: breaks keyboard navigation */
+ g_return_if_fail(IS_NOTIFICATION_MENUITEM(menuitem));
+
+ NotificationMenuItem *self = NOTIFICATION_MENUITEM(menuitem);
+
+ gtk_image_set_from_icon_name(GTK_IMAGE(self->priv->close_image),
+ NOTIFICATION_MENUITEM_CLOSE_SELECT,
+ GTK_ICON_SIZE_MENU);
}
static void
notification_menuitem_deselect(GtkMenuItem *menuitem)
{
+ g_return_if_fail(IS_NOTIFICATION_MENUITEM(menuitem));
+
+ NotificationMenuItem *self = NOTIFICATION_MENUITEM(menuitem);
+
+ gtk_image_set_from_icon_name(GTK_IMAGE(self->priv->close_image),
+ NOTIFICATION_MENUITEM_CLOSE_DESELECT,
+ GTK_ICON_SIZE_MENU);
}
static gboolean