]> git.0d.be Git - empathy.git/blobdiff - src/empathy-notifications-approver.c
Use double quotes for all internal headers
[empathy.git] / src / empathy-notifications-approver.c
index bb7f6b458dc633b6047a63cdd5ca46b51ab4bb71..b4f77eebbfed3a21835c3d61398244a597d416a9 100644 (file)
  * Authors: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
  */
 
-#include <config.h>
-#include <string.h>
+#include "config.h"
 
 #include <glib/gi18n.h>
-#include <libnotify/notification.h>
-#include <libnotify/notify.h>
-#include <telepathy-glib/telepathy-glib.h>
 
-#include <libempathy-gtk/empathy-notify-manager.h>
-#include <libempathy-gtk/empathy-call-utils.h>
+#include "libempathy-gtk/empathy-notify-manager.h"
+#include "libempathy-gtk/empathy-call-utils.h"
 
 #include "empathy-event-manager.h"
 
 #define DEBUG_FLAG EMPATHY_DEBUG_OTHER
-#include <libempathy/empathy-debug.h>
+#include "libempathy/empathy-debug.h"
 
 #include "empathy-notifications-approver.h"
 
@@ -183,6 +179,7 @@ add_notification_actions (EmpathyNotificationsApprover *self,
 
   switch (self->priv->event->type) {
     case EMPATHY_EVENT_TYPE_CHAT:
+    case EMPATHY_EVENT_TYPE_MENTIONED:
       notify_notification_add_action (notification,
         "respond", _("Respond"), (NotifyActionCallback) notification_approve_cb,
           self, NULL);
@@ -257,6 +254,7 @@ notification_is_urgent (EmpathyNotificationsApprover *self,
     case EMPATHY_EVENT_TYPE_TRANSFER:
     case EMPATHY_EVENT_TYPE_INVITATION:
     case EMPATHY_EVENT_TYPE_AUTH:
+    case EMPATHY_EVENT_TYPE_MENTIONED:
       return TRUE;
 
     case EMPATHY_EVENT_TYPE_SUBSCRIPTION:
@@ -268,29 +266,24 @@ notification_is_urgent (EmpathyNotificationsApprover *self,
   return FALSE;
 }
 
-/* Use x-empathy as prefix for unofficial categories
- * http://www.galago-project.org/specs/notification/0.9/x211.html */
 static const gchar *
 get_category_for_event_type (EmpathyEventType type)
 {
+#define CASE(x) \
+    case EMPATHY_EVENT_TYPE_##x: \
+      return EMPATHY_NOTIFICATION_CATEGORY_##x;
   switch (type) {
-    case EMPATHY_EVENT_TYPE_CHAT:
-      return "im.received";
-    case EMPATHY_EVENT_TYPE_PRESENCE_ONLINE:
-      return "presence.online";
-    case EMPATHY_EVENT_TYPE_PRESENCE_OFFLINE:
-      return "presence.offline";
-    case EMPATHY_EVENT_TYPE_CALL:
-      return "x-empathy.call.incoming";
-    case EMPATHY_EVENT_TYPE_TRANSFER:
-      return "x-empathy.transfer.incoming";
-    case EMPATHY_EVENT_TYPE_INVITATION:
-      return "x-empathy.im.room-invitation";
-    case EMPATHY_EVENT_TYPE_AUTH:
-      return "x-empathy.network.auth-request";
-    case EMPATHY_EVENT_TYPE_SUBSCRIPTION:
-      return "x-empathy.im.subscription-request";
+    CASE(CHAT)
+    CASE(PRESENCE_ONLINE)
+    CASE(PRESENCE_OFFLINE)
+    CASE(CALL)
+    CASE(TRANSFER)
+    CASE(INVITATION)
+    CASE(AUTH)
+    CASE(SUBSCRIPTION)
+    CASE(MENTIONED)
   }
+#undef CASE
 
   return NULL;
 }
@@ -342,8 +335,8 @@ update_notification (EmpathyNotificationsApprover *self)
        * to an existing notification with the same title.
        * In this way the previous message will not be lost: the new
        * message will appear below it, in the same notification */
-      notification = notify_notification_new (self->priv->event->header,
-           message_esc, NULL);
+      notification = empathy_notify_manager_create_notification (
+          self->priv->event->header, message_esc, NULL);
 
       if (self->priv->notification == NULL)
         {
@@ -353,9 +346,6 @@ update_notification (EmpathyNotificationsApprover *self)
               G_CALLBACK (notification_closed_cb), self);
         }
 
-      notify_notification_set_timeout (notification,
-          NOTIFY_EXPIRES_DEFAULT);
-
       if (has_x_canonical_append)
         {
           notify_notification_set_hint (notification,