FdoNotificationDaemon: Emit ActivationToken before ActionInvoked signal
Two years ago FDO notifications spec gained the ability to pass an activation token (often called startup id) let's finally implement it. See: https://gitlab.freedesktop.org/xdg/xdg-specs/-/commit/b9a470004d Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/358 Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3199>
This commit is contained in:

committed by
Florian Müllner

parent
7d6f465a47
commit
bb73bf548c
@ -217,6 +217,7 @@ class FdoNotificationDaemon {
|
||||
hasDefaultAction = true;
|
||||
} else {
|
||||
notification.addAction(label, () => {
|
||||
this._emitActivationToken(source, ndata.id);
|
||||
this._emitActionInvoked(ndata.id, actionId);
|
||||
});
|
||||
}
|
||||
@ -225,6 +226,7 @@ class FdoNotificationDaemon {
|
||||
|
||||
if (hasDefaultAction) {
|
||||
notification.connect('activated', () => {
|
||||
this._emitActivationToken(source, ndata.id);
|
||||
this._emitActionInvoked(ndata.id, 'default');
|
||||
});
|
||||
} else {
|
||||
@ -301,6 +303,16 @@ class FdoNotificationDaemon {
|
||||
this._dbusImpl.emit_signal('ActionInvoked',
|
||||
GLib.Variant.new('(us)', [id, action]));
|
||||
}
|
||||
|
||||
_emitActivationToken(source, id) {
|
||||
const context = global.create_app_launch_context(0, -1);
|
||||
const info = source.app?.get_app_info();
|
||||
if (info) {
|
||||
const token = context.get_startup_notify_id(info, []);
|
||||
this._dbusImpl.emit_signal('ActivationToken',
|
||||
GLib.Variant.new('(us)', [id, token]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const FdoNotificationDaemonSource = GObject.registerClass(
|
||||
|
Reference in New Issue
Block a user