messageList: Use default signal handler for closing notifications

And change the `close` signal on `Message` to run the default handler
last, which allows other signal handers to stop the signal emission
chain.

This change shouldn't have much effect on existing code but will be
needed for by-source notification grouping.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3429>
This commit is contained in:
Julian Sparber 2024-10-05 13:11:18 +02:00
parent 6fa76cd8f4
commit bf76553287

View File

@ -408,7 +408,9 @@ export const Message = GObject.registerClass({
GLib.DateTime),
},
Signals: {
'close': {},
'close': {
flags: GObject.SignalFlags.RUN_LAST,
},
'expanded': {},
'unexpanded': {},
},
@ -664,11 +666,6 @@ class NotificationMessage extends Message {
this.notification = notification;
this.connect('close', () => {
this._closed = true;
if (this.notification)
this.notification.destroy(MessageTray.NotificationDestroyedReason.DISMISSED);
});
notification.connectObject(
'action-added', (_, action) => this._addAction(action),
'action-removed', (_, action) => this._removeAction(action),
@ -700,6 +697,11 @@ class NotificationMessage extends Message {
});
}
on_close() {
this._closed = true;
this.notification?.destroy(MessageTray.NotificationDestroyedReason.DISMISSED);
}
vfunc_clicked() {
this.notification.activate();
}