aboutsummaryrefslogtreecommitdiff
path: root/src
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
commit27a4b02329b62efffa89419d73be7c1f10838d76 (patch)
tree51d6c58c02fc6f65990e698e34be7e5be6149b84 /src
parent6dd7a7237dceefd83deb8be94744b7182d173492 (diff)
downloadayatana-indicator-notifications-27a4b02329b62efffa89419d73be7c1f10838d76.tar.gz
ayatana-indicator-notifications-27a4b02329b62efffa89419d73be7c1f10838d76.tar.bz2
ayatana-indicator-notifications-27a4b02329b62efffa89419d73be7c1f10838d76.zip
* Add option to clear the notifications using middle click on the notification icon.0.3.3
* Bump version.
Diffstat (limited to 'src')
-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);
}