[empathy] set urgency hint on urgent notifications



commit dfc65cb90ac55e7b84a4213356dbaec9a6ec6b9a
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Tue Mar 29 09:48:22 2011 +0200

    set urgency hint on urgent notifications
    
    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 |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/src/empathy-notifications-approver.c b/src/empathy-notifications-approver.c
index e0d540c..9f1774a 100644
--- a/src/empathy-notifications-approver.c
+++ b/src/empathy-notifications-approver.c
@@ -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)
 {
@@ -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 (notification_is_urgent (self, notification))
+        notify_notification_set_urgency (notification, NOTIFY_URGENCY_CRITICAL);
     }
 
   pixbuf = empathy_notify_manager_get_pixbuf_for_notification (



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]