[gnome-shell/wip/fmuellner/notification-redux: 73/88] 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: 73/88] messageTray: Skip banner mode when queue exceeds a threshold
- Date: Sun, 15 Feb 2015 17:36:55 +0000 (UTC)
commit 7d9b894c90fd2e0bb59f99b8723d19b16037cadf
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 f63be04..2645c44 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -29,6 +29,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.
@@ -1416,12 +1417,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]