aboutsummaryrefslogtreecommitdiff
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
parent6dd7a7237dceefd83deb8be94744b7182d173492 (diff)
downloadayatana-indicator-notifications-0.3.3.tar.gz
ayatana-indicator-notifications-0.3.3.tar.bz2
ayatana-indicator-notifications-0.3.3.zip
* Add option to clear the notifications using middle click on the notification icon.0.3.3
* Bump version.
-rw-r--r--configure.ac2
-rw-r--r--data/net.launchpad.indicator.notifications.gschema.xml.in.in5
-rw-r--r--src/indicator-notifications.c18
3 files changed, 22 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac
index c99c54a..3ec1f55 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-AC_INIT([indicator-notifications], [0.3.2], [jason.conti@gmail.com])
+AC_INIT([indicator-notifications], [0.3.3], [jason.conti@gmail.com])
AM_INIT_AUTOMAKE([-Wall -Werror])
diff --git a/data/net.launchpad.indicator.notifications.gschema.xml.in.in b/data/net.launchpad.indicator.notifications.gschema.xml.in.in
index 43ece43..a4c6dde 100644
--- a/data/net.launchpad.indicator.notifications.gschema.xml.in.in
+++ b/data/net.launchpad.indicator.notifications.gschema.xml.in.in
@@ -5,6 +5,11 @@
<_summary>Discard notifications by application name</_summary>
<_description>If an application name is in the blacklist, all notifications matching the application name will be discarded.</_description>
</key>
+ <key name="clear-on-middle-click" type="b">
+ <default>false</default>
+ <_summary>Clear notifications on middle click</_summary>
+ <_description>Normally when middle clicking the notification icon, the unread status will be toggled if the queue is not empty. With this option enabled, the notification queue will be cleared instead.</_description>
+ </key>
<key name="hide-indicator" type="b">
<default>false</default>
<_summary>Hide the indicator</_summary>
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);
}