aboutsummaryrefslogtreecommitdiff
path: root/src/notification.c
diff options
context:
space:
mode:
authorJason Conti <jason.conti@gmail.com>2011-05-17 16:49:45 -0400
committerJason Conti <jason.conti@gmail.com>2011-05-17 16:49:45 -0400
commit344eaf62015d77d1cd6885bda807a2e8fcb16b3b (patch)
tree75916781500632364254f39c3a2dfddbbbfd69ec /src/notification.c
parent425bde705a072effe6232cb3fa4fecdcb8849639 (diff)
downloadayatana-indicator-notifications-344eaf62015d77d1cd6885bda807a2e8fcb16b3b.tar.gz
ayatana-indicator-notifications-344eaf62015d77d1cd6885bda807a2e8fcb16b3b.tar.bz2
ayatana-indicator-notifications-344eaf62015d77d1cd6885bda807a2e8fcb16b3b.zip
Checking for, and discarding volume notifications, since they contain no useful information (which is stupid, why can't they provide a summary (Volume Up/Down) and body (Current volume level X%).
Diffstat (limited to 'src/notification.c')
-rw-r--r--src/notification.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/notification.c b/src/notification.c
index d99a1f8..c76da87 100644
--- a/src/notification.c
+++ b/src/notification.c
@@ -15,6 +15,8 @@
#define COLUMN_COUNT 8
+#define X_CANONICAL_PRIVATE_SYNCHRONOUS "x-canonical-private-synchronous"
+
static void notification_class_init(NotificationClass *klass);
static void notification_init(Notification *self);
static void notification_dispose(GObject *object);
@@ -43,6 +45,7 @@ notification_init(Notification *self)
self->priv->body = NULL;
self->priv->expire_timeout = 0;
self->priv->timestamp = NULL;
+ self->priv->is_volume = FALSE;
}
static void
@@ -93,7 +96,7 @@ notification_new_from_dbus_message(GDBusMessage *message)
self->priv->timestamp = g_date_time_new_now_local();
GVariant *body = g_dbus_message_get_body(message);
- GVariant *child = NULL;
+ GVariant *child = NULL, *value = NULL;
g_assert(g_variant_is_of_type(body, G_VARIANT_TYPE_TUPLE));
g_assert(g_variant_n_children(body) == COLUMN_COUNT);
@@ -126,6 +129,18 @@ notification_new_from_dbus_message(GDBusMessage *message)
self->priv->body = g_variant_dup_string(child,
&(self->priv->body_length));
+ /* hints */
+ child = g_variant_get_child_value(body, COLUMN_HINTS);
+ g_assert(g_variant_is_of_type(child, G_VARIANT_TYPE_DICTIONARY));
+
+ /* check for volume hint */
+ value = g_variant_lookup_value(child, X_CANONICAL_PRIVATE_SYNCHRONOUS, G_VARIANT_TYPE_STRING);
+ if(value != NULL) {
+ if(g_strcmp0(g_variant_get_string(value, NULL), "volume") == 0) {
+ self->priv->is_volume = TRUE;
+ }
+ }
+
child = NULL;
return self;
@@ -167,6 +182,12 @@ notification_timestamp_for_locale(Notification *self)
return g_date_time_format(self->priv->timestamp, "%X %x");
}
+gboolean
+notification_is_volume(Notification *self)
+{
+ return self->priv->is_volume;
+}
+
void
notification_print(Notification *self)
{