[gnome-shell/wip/fmuellner/notification-redux: 70/88] 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: 70/88] messageTray: Limit number of notifications per source
- Date: Sun, 15 Feb 2015 17:36:40 +0000 (UTC)
commit e09d7fe04a24270693f7198cc0ba6ea6b5575ea6
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 c6ab49a..185c334 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]