[gnome-shell/wip/fmuellner/notification-redux+sass: 151/207] messageTray: Limit number of notifications per source
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/fmuellner/notification-redux+sass: 151/207] messageTray: Limit number of notifications per source
- Date: Tue, 17 Feb 2015 17:06:42 +0000 (UTC)
commit ab0a153ffefa48bca9270ac47d2df77e8c338a6e
Author: Florian Müllner <fmuellner gnome org>
Date: Sat Feb 14 00:06:11 2015 +0100
messageTray: Limit number of notifications per source
test-xy-stress in libnotify's tests suddenly became fun again ...
js/ui/messageTray.js | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index 06ea098..0c96bd5 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -28,6 +28,8 @@ const NOTIFICATION_TIMEOUT = 4;
const HIDE_TIMEOUT = 0.2;
const LONGER_HIDE_TIMEOUT = 0.6;
+const MAX_NOTIFICATIONS_PER_SOURCE = 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.
const MOUSE_LEFT_ACTOR_THRESHOLD = 20;
@@ -1131,6 +1133,9 @@ const Source = new Lang.Class({
if (this.notifications.indexOf(notification) >= 0)
return;
+ while (this.notifications.length >= MAX_NOTIFICATIONS_PER_SOURCE)
+ this.notifications.shift().destroy(NotificationDestroyedReason.EXPIRED);
+
notification.connect('destroy', Lang.bind(this, this._onNotificationDestroy));
this.notifications.push(notification);
this.emit('notification-added', notification);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]