aboutsummaryrefslogtreecommitdiff
path: root/src/indicator-notifications.c
diff options
context:
space:
mode:
authorJason Conti <jason.conti@gmail.com>2017-03-15 14:58:36 -0400
committerJason Conti <jason.conti@gmail.com>2017-03-15 14:58:36 -0400
commit69817c8b25658ae63c6fca86004e2e70932e9342 (patch)
tree51d6c58c02fc6f65990e698e34be7e5be6149b84 /src/indicator-notifications.c
parent0cd1204cb44cd1d1e5943c544df421e1eef7e0c1 (diff)
downloadayatana-indicator-notifications-69817c8b25658ae63c6fca86004e2e70932e9342.tar.gz
ayatana-indicator-notifications-69817c8b25658ae63c6fca86004e2e70932e9342.tar.bz2
ayatana-indicator-notifications-69817c8b25658ae63c6fca86004e2e70932e9342.zip
* Add option to clear the notifications using middle click on the notification icon.
* Bump version.
Diffstat (limited to 'src/indicator-notifications.c')
-rw-r--r--src/indicator-notifications.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/indicator-notifications.c b/src/indicator-notifications.c
index 0ca4a6a..41164c9 100644
--- a/src/indicator-notifications.c
+++ b/src/indicator-notifications.c
@@ -65,6 +65,7 @@ struct _IndicatorNotificationsPrivate {
GList *visible_items;
GList *hidden_items;
+ gboolean clear_on_middle_click;
gboolean have_unread;
gboolean hide_indicator;
@@ -88,6 +89,7 @@ struct _IndicatorNotificationsPrivate {
#define NOTIFICATIONS_SCHEMA "net.launchpad.indicator.notifications"
#define NOTIFICATIONS_KEY_BLACKLIST "blacklist"
+#define NOTIFICATIONS_KEY_CLEAR_MC "clear-on-middle-click"
#define NOTIFICATIONS_KEY_HIDE_INDICATOR "hide-indicator"
#define NOTIFICATIONS_KEY_MAX_ITEMS "max-items"
@@ -196,6 +198,7 @@ indicator_notifications_init(IndicatorNotifications *self)
/* Connect to GSettings */
self->priv->settings = g_settings_new(NOTIFICATIONS_SCHEMA);
+ self->priv->clear_on_middle_click = g_settings_get_boolean(self->priv->settings, NOTIFICATIONS_KEY_CLEAR_MC);
self->priv->hide_indicator = g_settings_get_boolean(self->priv->settings, NOTIFICATIONS_KEY_HIDE_INDICATOR);
self->priv->max_items = g_settings_get_int(self->priv->settings, NOTIFICATIONS_KEY_MAX_ITEMS);
update_blacklist(self);
@@ -289,8 +292,16 @@ indicator_notifications_middle_click(IndicatorObject *io, IndicatorObjectEntry *
{
IndicatorNotifications *self = INDICATOR_NOTIFICATIONS(io);
- if(g_list_length(self->priv->visible_items) > 0)
- set_unread(self, !self->priv->have_unread);
+ /* Clear the notifications */
+ if(self->priv->clear_on_middle_click) {
+ clear_menuitems(self);
+ set_unread(self, FALSE);
+ }
+ /* Otherwise toggle unread status */
+ else {
+ if(g_list_length(self->priv->visible_items) > 0)
+ set_unread(self, !self->priv->have_unread);
+ }
}
/**
@@ -524,6 +535,9 @@ setting_changed_cb(GSettings *settings, gchar *key, gpointer user_data)
self->priv->hide_indicator = g_settings_get_boolean(settings, NOTIFICATIONS_KEY_HIDE_INDICATOR);
update_indicator_visibility(self);
}
+ else if(g_strcmp0(key, NOTIFICATIONS_KEY_CLEAR_MC) == 0) {
+ self->priv->clear_on_middle_click = g_settings_get_boolean(self->priv->settings, NOTIFICATIONS_KEY_CLEAR_MC);
+ }
else if(g_strcmp0(key, NOTIFICATIONS_KEY_BLACKLIST) == 0) {
update_blacklist(self);
}