aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-03-29 16:07:01 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-04-02 06:04:22 +0800
commitaaf4798dd5eb270c95964441cf29768e580ef80b (patch)
tree44bbbd1bfd1fc193385faf2c7f5eb454db46a42c
parentdfc65cb90ac55e7b84a4213356dbaec9a6ec6b9a (diff)
downloadgsoc2013-empathy-aaf4798dd5eb270c95964441cf29768e580ef80b.tar
gsoc2013-empathy-aaf4798dd5eb270c95964441cf29768e580ef80b.tar.gz
gsoc2013-empathy-aaf4798dd5eb270c95964441cf29768e580ef80b.tar.bz2
gsoc2013-empathy-aaf4798dd5eb270c95964441cf29768e580ef80b.tar.lz
gsoc2013-empathy-aaf4798dd5eb270c95964441cf29768e580ef80b.tar.xz
gsoc2013-empathy-aaf4798dd5eb270c95964441cf29768e580ef80b.tar.zst
gsoc2013-empathy-aaf4798dd5eb270c95964441cf29768e580ef80b.zip
set a category on chat related notifications
That can be used by the Shell to filter out notifications it's handling itself directly (#645932).
-rw-r--r--libempathy-gtk/empathy-notify-manager.h1
-rw-r--r--src/empathy-notifications-approver.c25
2 files changed, 26 insertions, 0 deletions
diff --git a/libempathy-gtk/empathy-notify-manager.h b/libempathy-gtk/empathy-notify-manager.h
index f7c5e4c5a..dd7565c9f 100644
--- a/libempathy-gtk/empathy-notify-manager.h
+++ b/libempathy-gtk/empathy-notify-manager.h
@@ -32,6 +32,7 @@ G_BEGIN_DECLS
#define EMPATHY_NOTIFY_MANAGER_CAP_BODY_HYPERLINKS "body-hyperlinks"
#define EMPATHY_NOTIFY_MANAGER_CAP_BODY_IMAGES "body-images"
#define EMPATHY_NOTIFY_MANAGER_CAP_BODY_MARKUP "body-markup"
+#define EMPATHY_NOTIFY_MANAGER_CAP_CATEGORY "category"
#define EMPATHY_NOTIFY_MANAGER_CAP_ICON_MULTI "icon-multi"
#define EMPATHY_NOTIFY_MANAGER_CAP_ICON_STATIC "icon-static"
#define EMPATHY_NOTIFY_MANAGER_CAP_IMAGE_SVG_XML "image/svg+xml"
diff --git a/src/empathy-notifications-approver.c b/src/empathy-notifications-approver.c
index 9f1774ae4..4bfe23cf1 100644
--- a/src/empathy-notifications-approver.c
+++ b/src/empathy-notifications-approver.c
@@ -244,6 +244,24 @@ notification_is_urgent (EmpathyNotificationsApprover *self,
return FALSE;
}
+static const gchar *
+get_category_for_event_type (EmpathyEventType type)
+{
+ switch (type) {
+ case EMPATHY_EVENT_TYPE_CHAT:
+ return "im.received";
+ case EMPATHY_EVENT_TYPE_VOIP:
+ case EMPATHY_EVENT_TYPE_TRANSFER:
+ case EMPATHY_EVENT_TYPE_INVITATION:
+ case EMPATHY_EVENT_TYPE_AUTH:
+ case EMPATHY_EVENT_TYPE_SUBSCRIPTION:
+ case EMPATHY_EVENT_TYPE_PRESENCE:
+ return NULL;
+ }
+
+ return NULL;
+}
+
static void
update_notification (EmpathyNotificationsApprover *self)
{
@@ -283,6 +301,8 @@ update_notification (EmpathyNotificationsApprover *self)
}
else
{
+ const gchar *category;
+
/* if the notification server supports x-canonical-append,
* the hint will be added, so that the message from the
* just created notification will be automatically appended
@@ -313,6 +333,11 @@ update_notification (EmpathyNotificationsApprover *self)
if (notification_is_urgent (self, notification))
notify_notification_set_urgency (notification, NOTIFY_URGENCY_CRITICAL);
+
+ category = get_category_for_event_type (self->priv->event->type);
+ if (category != NULL)
+ notify_notification_set_hint_string (notification,
+ EMPATHY_NOTIFY_MANAGER_CAP_CATEGORY, category);
}
pixbuf = empathy_notify_manager_get_pixbuf_for_notification (