messageTray: Add notification-removed signal to Source

This allows us to drop the `destroy` signal handler for each
notification in MessageTray.

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

View File

@ -633,6 +633,7 @@ export const Source = GObject.registerClass({
Signals: { Signals: {
'destroy': {param_types: [GObject.TYPE_UINT]}, 'destroy': {param_types: [GObject.TYPE_UINT]},
'notification-added': {param_types: [Notification.$gtype]}, 'notification-added': {param_types: [Notification.$gtype]},
'notification-removed': {param_types: [Notification.$gtype]},
'notification-show': {param_types: [Notification.$gtype]}, 'notification-show': {param_types: [Notification.$gtype]},
}, },
}, class Source extends MessageList.Source { }, class Source extends MessageList.Source {
@ -687,6 +688,7 @@ export const Source = GObject.registerClass({
return; return;
this.notifications.splice(index, 1); this.notifications.splice(index, 1);
this.emit('notification-removed', notification);
this.countUpdated(); this.countUpdated();
if (this.notifications.length === 0) if (this.notifications.length === 0)