[gnome-shell/wip/fmuellner/notification-redux: 77/88] calendar: Keep urgent notifications on top of the list



commit 7c06c8eaa3ec2805f592bd6556fff884d98e8c52
Author: Florian Müllner <fmuellner gnome org>
Date:   Sat Feb 14 04:58:05 2015 +0100

    calendar: Keep urgent notifications on top of the list

 js/ui/calendar.js |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/calendar.js b/js/ui/calendar.js
index 1a9475d..9c89afe 100644
--- a/js/ui/calendar.js
+++ b/js/ui/calendar.js
@@ -1297,9 +1297,14 @@ const NotificationSection = new Lang.Class({
         if (this.mapped)
             notification.acknowledged = true;
 
+        let children = this._list.get_children();
+        let index;
+        for (index = 0; index < children.length; index++)
+            if (children[index]._delegate.notification.urgency <= notification.urgency)
+                break;
+
         let listChild = this.addMessage(listEntry, this.actor.mapped);
-        // TODO: Keep URGENT notifications on top
-        this._list.set_child_below_sibling(listChild, null);
+        this._list.set_child_at_index(listChild, index);
     },
 
     _onSourceDestroy: function(source, obj) {


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