messageTray: Use new notification-removed signal to cleanup notifications

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3173>
This commit is contained in:
Julian Sparber 2024-02-14 19:24:01 +01:00 committed by Florian Müllner
parent ec5bbfe319
commit 050e4e9a6e

View File

@ -925,6 +925,7 @@ export const MessageTray = GObject.registerClass({
source.connectObject(
'notification-show', this._onNotificationShow.bind(this),
'notification-removed', this._onNotificationRemoved.bind(this),
'destroy', () => this._removeSource(source), this);
this.emit('source-added', source);
@ -952,7 +953,7 @@ export const MessageTray = GObject.registerClass({
}
}
_onNotificationDestroy(notification) {
_onNotificationRemoved(source, notification) {
if (this._notification === notification) {
this._notificationRemoved = true;
if (this._notificationState === State.SHOWN ||
@ -983,8 +984,6 @@ export const MessageTray = GObject.registerClass({
let bannerCount = this._notification ? 1 : 0;
let full = this.queueCount + bannerCount >= MAX_NOTIFICATIONS_IN_QUEUE;
if (!full || notification.urgency === Urgency.CRITICAL) {
notification.connect('destroy',
this._onNotificationDestroy.bind(this));
this._notificationQueue.push(notification);
this._notificationQueue.sort(
(n1, n2) => n2.urgency - n1.urgency);