messageTray: Summarize notifications when messages queue up

It is really annoying for the user to acknowledge multiple notifications
when they queue up. So, to prevent a notification flood that has to be
handled by the user one-by-one, a summarized-notification feature is
added which leaves a single summarized-notification for the user,
replacing multiple notifications if the number exceeds 1, which they may
or may not acknowledge. When this summarized-notification is acknowledged,
the message-tray is opened where they can view the notifications that were
summarized. This helps the user concentrate on his primary task
simultaneously informing them about the new notifications.

https://bugzilla.gnome.org/show_bug.cgi?id=702460
This commit is contained in:
Devyani Kota 2014-10-21 17:15:31 +05:30 committed by Florian Müllner
parent 260657c0b8
commit 34606c0a8c

View File

@ -2432,8 +2432,22 @@ const MessageTray = new Lang.Class({
if (shouldShowNotification && nextNotification) {
let limited = this._busy || Main.layoutManager.bottomMonitor.inFullscreen;
let showNextNotification = (!limited || nextNotification.forFeedback || nextNotification.urgency == Urgency.CRITICAL);
if (showNextNotification)
this._showNotification();
if (showNextNotification) {
let len = this._notificationQueue.length;
if (len > 1) {
this._notificationQueue.length = 0;
let source = new SystemNotificationSource();
this.add(source);
let notification = new Notification(source, ngettext("%d new message", "%d new messages", len).format(len));
notification.setTransient(true);
notification.connect('clicked', Lang.bind(this, function() {
this.openTray();
}));
source.notify(notification);
} else {
this._showNotification();
}
}
}
} else if (this._notificationState == State.SHOWN) {
let expired = (this._userActiveWhileNotificationShown &&