[gnome-shell/wip/fmuellner/notification-redux+sass: 36/61] messageTray: Skip banner mode when queue exceeds a threshold
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/fmuellner/notification-redux+sass: 36/61] messageTray: Skip banner mode when queue exceeds a threshold
- Date: Thu, 19 Feb 2015 14:11:39 +0000 (UTC)
commit 36f0178b9fdb9f92721e5ec5b232e7747b07b3a7
Author: Florian Müllner <fmuellner gnome org>
Date: Sat Feb 14 03:18:52 2015 +0100
messageTray: Skip banner mode when queue exceeds a threshold
js/ui/messageTray.js | 19 +++++++++++++------
1 files changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index b8a7a7e..561221b 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -28,6 +28,7 @@ const HIDE_TIMEOUT = 0.2;
const LONGER_HIDE_TIMEOUT = 0.6;
const MAX_NOTIFICATIONS_PER_SOURCE = 3;
+const MAX_NOTIFICATIONS_IN_QUEUE = 3;
// We delay hiding of the tray if the mouse is within MOUSE_LEFT_ACTOR_THRESHOLD
// range from the point where it left the tray.
@@ -1541,12 +1542,18 @@ const MessageTray = new Lang.Class({
// we stop hiding it and show it again.
this._updateShowingNotification();
} else if (this._notificationQueue.indexOf(notification) < 0) {
- notification.connect('destroy',
- Lang.bind(this, this._onNotificationDestroy));
- this._notificationQueue.push(notification);
- this._notificationQueue.sort(function(notification1, notification2) {
- return (notification2.urgency - notification1.urgency);
- });
+ // If the queue is "full", we skip banner mode and just show a small
+ // indicator in the panel; however do make an exception for CRITICAL
+ // notifications, as only banner mode allows expansion.
+ let full = (this._notificationQueue.length >= MAX_NOTIFICATIONS_IN_QUEUE);
+ if (!full || notification.urgency == Urgency.CRITICAL) {
+ notification.connect('destroy',
+ Lang.bind(this, this._onNotificationDestroy));
+ this._notificationQueue.push(notification);
+ this._notificationQueue.sort(function(notification1, notification2) {
+ return (notification2.urgency - notification1.urgency);
+ });
+ }
}
this._updateState();
},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]