diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js index 58e68a06e..df695e882 100644 --- a/js/ui/messageTray.js +++ b/js/ui/messageTray.js @@ -70,6 +70,7 @@ Notification.prototype = { this.id = id; this.source = source; this._bannerBody = bannerBody; + this.urgent = false; source.connect('clicked', Lang.bind(this, function() { @@ -265,6 +266,10 @@ Notification.prototype = { button.connect('clicked', Lang.bind(this, function() { this.emit('action-invoked', id); })); }, + setUrgent: function(urgent) { + this.urgent = urgent; + }, + _styleChanged: function() { let [has_spacing, spacing] = this.actor.get_theme_node().get_length('spacing-columns', false); this._spacing = has_spacing ? spacing : 0; @@ -611,7 +616,11 @@ MessageTray.prototype = { if (this._getNotification(notification.id, source) == null) { notification.connect('destroy', Lang.bind(this, this.removeNotification)); - this._notificationQueue.push(notification); + + if (notification.urgent) + this._notificationQueue.unshift(notification); + else + this._notificationQueue.push(notification); } this._updateState(); @@ -805,6 +814,12 @@ MessageTray.prototype = { onComplete: this._showNotificationCompleted, onCompleteScope: this }); + + if (this._notification.urgent) { + // This will overwrite the y tween, but leave the opacity + // tween, and so the onComplete will remain as well. + this._expandNotification(); + } }, _showNotificationCompleted: function() { diff --git a/js/ui/notificationDaemon.js b/js/ui/notificationDaemon.js index dc8f08d6f..7054bdce4 100644 --- a/js/ui/notificationDaemon.js +++ b/js/ui/notificationDaemon.js @@ -151,8 +151,11 @@ NotificationDaemon.prototype = { return id; } - // Source may be null if we have never received a notification from - // this app or if all notifications from this app have been acknowledged. + hints = Params.parse(hints, { urgency: Urgency.NORMAL }, true); + + // Source may be null if we have never received a notification + // from this app or if all notifications from this app have + // been acknowledged. if (source == null) { source = new Source(this._sourceId(appName), icon, hints); Main.messageTray.add(source); @@ -211,6 +214,8 @@ NotificationDaemon.prototype = { notification.connect('action-invoked', Lang.bind(this, this._actionInvoked, source, id)); } + notification.setUrgent(hints.urgency == Urgency.CRITICAL); + source.notify(notification); return id; }, @@ -290,8 +295,6 @@ Source.prototype = { }, update: function(icon, hints) { - hints = Params.parse(hints, { urgency: Urgency.NORMAL }, true); - this._icon = icon; this._iconData = hints.icon_data; this._urgency = hints.urgency;