status/backgroundApps: Use ShellApp.activate_action() to quit apps
`ShellApp` gained the ability to activated actions, therefore drop the current implementation in favor for it. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3198>
This commit is contained in:
parent
d6779f34da
commit
3abf7e4662
@ -111,8 +111,6 @@ const BackgroundAppMenuItem = GObject.registerClass({
|
|||||||
}
|
}
|
||||||
|
|
||||||
async _quitApp() {
|
async _quitApp() {
|
||||||
const appId = this.app.get_id().replace(/\.desktop$/, '');
|
|
||||||
|
|
||||||
this._spinner.play();
|
this._spinner.play();
|
||||||
this._spinnerTimeoutId =
|
this._spinnerTimeoutId =
|
||||||
GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, SPINNER_TIMEOUT,
|
GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, SPINNER_TIMEOUT,
|
||||||
@ -124,18 +122,10 @@ const BackgroundAppMenuItem = GObject.registerClass({
|
|||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await Gio.DBus.session.call(
|
await this.app.activate_action('quit', null, 0, -1, null);
|
||||||
appId,
|
|
||||||
`/${appId.replaceAll('.', '/')}`,
|
|
||||||
'org.freedesktop.Application',
|
|
||||||
'ActivateAction',
|
|
||||||
new GLib.Variant('(sava{sv})', ['quit', [], {}]),
|
|
||||||
null,
|
|
||||||
Gio.DBusCallFlags.NONE,
|
|
||||||
-1,
|
|
||||||
null);
|
|
||||||
} catch (_error) {
|
} catch (_error) {
|
||||||
try {
|
try {
|
||||||
|
const appId = this.app.get_id().replace(/\.desktop$/, '');
|
||||||
Util.trySpawn(['flatpak', 'kill', appId]);
|
Util.trySpawn(['flatpak', 'kill', appId]);
|
||||||
} catch (pidError) {
|
} catch (pidError) {
|
||||||
logError(pidError, 'Failed to kill application');
|
logError(pidError, 'Failed to kill application');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user