dateMenu: Update message indicator on queue changes
The message indicator conveys that the message list contains unseen messages that will not be shown as banner. So its visibility depends on two factors: the number of unseen messages, and the number of messages waiting in the queue to be shown as banner. As we currently only update the visibility on changes to the former, the indicator is not always accurate - for instance sources notify count changes before passing on a notification to the message tray for display. To fix, add a signal to the message tray to notify when the queue changes and use it to update the indicator's visibility. https://bugzilla.gnome.org/show_bug.cgi?id=744880
This commit is contained in:
parent
078aafb10c
commit
880b240ecb
@ -231,6 +231,7 @@ const MessagesIndicator = new Lang.Class({
|
||||
|
||||
Main.messageTray.connect('source-added', Lang.bind(this, this._onSourceAdded));
|
||||
Main.messageTray.connect('source-removed', Lang.bind(this, this._onSourceRemoved));
|
||||
Main.messageTray.connect('queue-changed', Lang.bind(this, this._updateCount));
|
||||
|
||||
let sources = Main.messageTray.getSources();
|
||||
sources.forEach(Lang.bind(this, function(source) { this._onSourceAdded(null, source); }));
|
||||
|
@ -1662,8 +1662,10 @@ const MessageTray = new Lang.Class({
|
||||
}
|
||||
|
||||
let index = this._notificationQueue.indexOf(notification);
|
||||
if (index != -1)
|
||||
if (index != -1) {
|
||||
this._notificationQueue.splice(index, 1);
|
||||
this.emit('queue-changed');
|
||||
}
|
||||
},
|
||||
|
||||
_onNotify: function(source, notification) {
|
||||
@ -1686,6 +1688,7 @@ const MessageTray = new Lang.Class({
|
||||
this._notificationQueue.sort(function(notification1, notification2) {
|
||||
return (notification2.urgency - notification1.urgency);
|
||||
});
|
||||
this.emit('queue-changed');
|
||||
}
|
||||
}
|
||||
this._updateState();
|
||||
@ -1806,10 +1809,15 @@ const MessageTray = new Lang.Class({
|
||||
this._updatingState = true;
|
||||
|
||||
// Filter out acknowledged notifications.
|
||||
let changed = false;
|
||||
this._notificationQueue = this._notificationQueue.filter(function(n) {
|
||||
changed = changed || n.acknowledged;
|
||||
return !n.acknowledged;
|
||||
});
|
||||
|
||||
if (changed)
|
||||
this.emit('queue-changed');
|
||||
|
||||
let hasNotifications = Main.sessionMode.hasNotifications;
|
||||
|
||||
if (this._notificationState == State.HIDDEN) {
|
||||
@ -1881,6 +1889,7 @@ const MessageTray = new Lang.Class({
|
||||
|
||||
_showNotification: function() {
|
||||
this._notification = this._notificationQueue.shift();
|
||||
this.emit('queue-changed');
|
||||
|
||||
this._userActiveWhileNotificationShown = this.idleMonitor.get_idletime() <= IDLE_TIME;
|
||||
if (!this._userActiveWhileNotificationShown) {
|
||||
|
Loading…
Reference in New Issue
Block a user