]> git.0d.be Git - empathy.git/commitdiff
set urgency hint on urgent notifications
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Tue, 29 Mar 2011 07:48:22 +0000 (09:48 +0200)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Fri, 1 Apr 2011 22:04:21 +0000 (00:04 +0200)
This will ensure that they stay visible in the Shell and that their actions
buttons are displayed as well (#645932).

src/empathy-notifications-approver.c

index e0d540cdcda0eaad185a6b125ccd9ce2b7ef3268..9f1774ae408142c97fdaf572299c13600ab55420 100644 (file)
@@ -222,6 +222,28 @@ add_notification_actions (EmpathyNotificationsApprover *self,
   }
 }
 
   }
 }
 
+static gboolean
+notification_is_urgent (EmpathyNotificationsApprover *self,
+    NotifyNotification *notification)
+{
+  /* Mark as urgent all the notifications with which user should
+   * interact ASAP */
+  switch (self->priv->event->type) {
+    case EMPATHY_EVENT_TYPE_CHAT:
+    case EMPATHY_EVENT_TYPE_VOIP:
+    case EMPATHY_EVENT_TYPE_TRANSFER:
+    case EMPATHY_EVENT_TYPE_INVITATION:
+    case EMPATHY_EVENT_TYPE_AUTH:
+      return TRUE;
+
+    case EMPATHY_EVENT_TYPE_SUBSCRIPTION:
+    case EMPATHY_EVENT_TYPE_PRESENCE:
+      return FALSE;
+  }
+
+  return FALSE;
+}
+
 static void
 update_notification (EmpathyNotificationsApprover *self)
 {
 static void
 update_notification (EmpathyNotificationsApprover *self)
 {
@@ -288,6 +310,9 @@ update_notification (EmpathyNotificationsApprover *self)
       if (empathy_notify_manager_has_capability (self->priv->notify_mgr,
             EMPATHY_NOTIFY_MANAGER_CAP_ACTIONS))
         add_notification_actions (self, notification);
       if (empathy_notify_manager_has_capability (self->priv->notify_mgr,
             EMPATHY_NOTIFY_MANAGER_CAP_ACTIONS))
         add_notification_actions (self, notification);
+
+      if (notification_is_urgent (self, notification))
+        notify_notification_set_urgency (notification, NOTIFY_URGENCY_CRITICAL);
     }
 
   pixbuf = empathy_notify_manager_get_pixbuf_for_notification (
     }
 
   pixbuf = empathy_notify_manager_get_pixbuf_for_notification (