]> git.0d.be Git - empathy.git/commitdiff
set a category on chat related notifications
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Tue, 29 Mar 2011 08:07:01 +0000 (10:07 +0200)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Fri, 1 Apr 2011 22:04:22 +0000 (00:04 +0200)
That can be used by the Shell to filter out notifications it's handling itself
directly (#645932).

libempathy-gtk/empathy-notify-manager.h
src/empathy-notifications-approver.c

index f7c5e4c5a087c5430c814772a9a9481d482fd2bb..dd7565c9f116ad2ba8e99d1516b24889542eab6c 100644 (file)
@@ -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"
index 9f1774ae408142c97fdaf572299c13600ab55420..4bfe23cf1cb38d36f1c7be1bd8dbe148933f2ca9 100644 (file)
@@ -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 (