[MessageTray] handle "urgent" notifications specially

Urgent notifications jump to the front of the tray's notification
queue, and come up pre-expanded.

https://bugzilla.gnome.org/show_bug.cgi?id=611612
This commit is contained in:
Dan Winship
2010-04-28 15:34:27 -04:00
parent 077f0c56f1
commit 263261cc86
2 changed files with 23 additions and 5 deletions

View File

@ -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() {