[gnome-contacts] Use DBus to open the Online Accounts panel.
- From: Niels De Graef <nielsdg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-contacts] Use DBus to open the Online Accounts panel.
- Date: Wed, 23 Aug 2017 09:45:12 +0000 (UTC)
commit d03f268fc5ff3bb0a372ff2a23995e411e16c5cd
Author: Niels De Graef <nielsdegraef gmail com>
Date: Wed Aug 23 11:44:20 2017 +0200
Use DBus to open the Online Accounts panel.
Can't spawn processes in a sandboxed environment (Flatpak), so use DBus
insteads.
data/flatpak/org.gnome.Contacts.json | 2 ++
src/contacts-accounts-list.vala | 21 +++++++++++++++++++--
2 files changed, 21 insertions(+), 2 deletions(-)
---
diff --git a/data/flatpak/org.gnome.Contacts.json b/data/flatpak/org.gnome.Contacts.json
index 9101eab..67213c6 100644
--- a/data/flatpak/org.gnome.Contacts.json
+++ b/data/flatpak/org.gnome.Contacts.json
@@ -16,6 +16,8 @@
"--device=dri",
/* Notification access */
"--talk-name=org.freedesktop.Notifications",
+ /* GNOME Control Center (for the Online Accounts panel) */
+ "--talk-name=org.gnome.ControlCenter",
/* GNOME Online Accounts */
"--talk-name=org.gnome.OnlineAccounts",
/* Evolution Data server */
diff --git a/src/contacts-accounts-list.vala b/src/contacts-accounts-list.vala
index e742819..652b26e 100644
--- a/src/contacts-accounts-list.vala
+++ b/src/contacts-accounts-list.vala
@@ -154,10 +154,27 @@ public class Contacts.AccountsList : Box {
[GtkCallback]
private void on_goa_button_clicked () {
try {
- Process.spawn_command_line_async ("gnome-control-center online-accounts");
+ 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 (""));
+ var param = new Variant.tuple ({
+ new Variant.string ("launch-panel"),
+ new Variant.array (new VariantType ("v"), {
+ new Variant ("v", new Variant ("(sav)", "online-accounts", builder))
+ }),
+ new Variant.array (new VariantType ("{sv}"), {})
+ });
+
+ proxy.call_sync ("Activate", param, DBusCallFlags.NONE, -1);
} catch (Error e) {
// TODO: Show error dialog
- warning ("Couldn't open GOA: %s", e.message);
+ warning ("Couldn't open online-accounts: %s", e.message);
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]