status/network: Use ShellApp.activate_action() to launch settings panel
`ShellApp` gained the ability to activated actions and sets the correct platform data, 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
90e9f56f79
commit
d6779f34da
@ -7,6 +7,7 @@ import GLib from 'gi://GLib';
|
|||||||
import GObject from 'gi://GObject';
|
import GObject from 'gi://GObject';
|
||||||
import NM from 'gi://NM';
|
import NM from 'gi://NM';
|
||||||
import Polkit from 'gi://Polkit';
|
import Polkit from 'gi://Polkit';
|
||||||
|
import Shell from 'gi://Shell';
|
||||||
import St from 'gi://St';
|
import St from 'gi://St';
|
||||||
|
|
||||||
import * as Main from '../main.js';
|
import * as Main from '../main.js';
|
||||||
@ -65,25 +66,13 @@ function ssidToLabel(ssid) {
|
|||||||
function launchSettingsPanel(panel, ...args) {
|
function launchSettingsPanel(panel, ...args) {
|
||||||
const param = new GLib.Variant('(sav)',
|
const param = new GLib.Variant('(sav)',
|
||||||
[panel, args.map(s => new GLib.Variant('s', s))]);
|
[panel, args.map(s => new GLib.Variant('s', s))]);
|
||||||
const platformData = {
|
|
||||||
'desktop-startup-id': new GLib.Variant('s',
|
const app = Shell.AppSystem.get_default()
|
||||||
`_TIME${global.get_current_time()}`),
|
.lookup_app('org.gnome.Settings.desktop');
|
||||||
};
|
|
||||||
try {
|
app.activate_action('launch-panel', param, 0, -1, null).catch(error => {
|
||||||
Gio.DBus.session.call(
|
log(`Failed to launch Settings panel: ${error.message}`);
|
||||||
'org.gnome.Settings',
|
});
|
||||||
'/org/gnome/Settings',
|
|
||||||
'org.freedesktop.Application',
|
|
||||||
'ActivateAction',
|
|
||||||
new GLib.Variant('(sava{sv})',
|
|
||||||
['launch-panel', [param], platformData]),
|
|
||||||
null,
|
|
||||||
Gio.DBusCallFlags.NONE,
|
|
||||||
-1,
|
|
||||||
null);
|
|
||||||
} catch (e) {
|
|
||||||
log(`Failed to launch Settings panel: ${e.message}`);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class ItemSorter {
|
class ItemSorter {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user