[gnome-boxes/wip/run-in-bg: 13/13] libvirt-machine-properties: Launch GNOME Settings to manage permissions
- From: Felipe Borges <felipeborges src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes/wip/run-in-bg: 13/13] libvirt-machine-properties: Launch GNOME Settings to manage permissions
- Date: Tue, 15 Dec 2020 10:28:56 +0000 (UTC)
commit 48fed39634553d0d745a7a467cc2c088505732c4
Author: Felipe Borges <felipeborges gnome org>
Date: Tue Dec 8 14:19:23 2020 +0100
libvirt-machine-properties: Launch GNOME Settings to manage permissions
build-aux/flatpak/org.gnome.Boxes.json | 1 +
src/libvirt-machine-properties.vala | 4 +++-
src/util-app.vala | 24 ++++++++++++++++++++++++
3 files changed, 28 insertions(+), 1 deletion(-)
---
diff --git a/build-aux/flatpak/org.gnome.Boxes.json b/build-aux/flatpak/org.gnome.Boxes.json
index 3c7735f9..56b7b2c0 100644
--- a/build-aux/flatpak/org.gnome.Boxes.json
+++ b/build-aux/flatpak/org.gnome.Boxes.json
@@ -16,6 +16,7 @@
"--system-talk-name=org.freedesktop.timedate1",
"--system-talk-name=org.freedesktop.Accounts",
"--filesystem=/var/lib/AccountsService/icons:ro",
+ "--talk-name=org.gnome.ControlCenter",
"--talk-name=org.freedesktop.secrets",
"--filesystem=xdg-run/dconf",
"--filesystem=~/.config/dconf:ro",
diff --git a/src/libvirt-machine-properties.vala b/src/libvirt-machine-properties.vala
index e88531a4..025db7dc 100644
--- a/src/libvirt-machine-properties.vala
+++ b/src/libvirt-machine-properties.vala
@@ -783,7 +783,9 @@ private async void on_run_in_bg () {
machine.run_in_bg = false;
var msg = _("Boxes is not authorized to run in the background");
- machine.window.notificationbar.display_error (msg);
+ machine.window.notificationbar.display_for_action (msg,
+ _("Manage permissions"),
+ open_permission_settings);
} catch (GLib.Error error) {
warning ("Failed to reset VM's run-in-bg setting: %s", error.message);
}
diff --git a/src/util-app.vala b/src/util-app.vala
index 9648ec0e..8acb1451 100644
--- a/src/util-app.vala
+++ b/src/util-app.vala
@@ -683,4 +683,28 @@ private async void move_config_from_cache (string config_name) {
return Gdk.pixbuf_get_from_surface (surface, 0, 0, size, size);
}
+
+ public void open_permission_settings () {
+ try {
+ var proxy = new DBusProxy.for_bus_sync (BusType.SESSION,
+ DBusProxyFlags.NONE,
+ null,
+ "org.gnome.ControlCenter",
+ "/org/gnome/ControlCenter",
+ "org.gtk.Actions");
+ var builder = new VariantBuilder (new VariantType ("av"));
+ builder.add ("v", new Variant.string (Config.APPLICATION_ID));
+ var param = new Variant.tuple ({
+ new Variant.string ("launch-panel"),
+ new Variant.array (new VariantType ("v"), {
+ new Variant ("v", new Variant ("(sav)", "applications", builder)),
+ }),
+ new Variant.array (new VariantType ("{sv}"), {})
+ });
+
+ proxy.call_sync ("Activate", param, DBusCallFlags.NONE, -1);
+ } catch (GLib.Error error) {
+ warning ("Failed to launch gnome-control-center: %s", error.message);
+ }
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]