+
+ g_object_unref(desktop);
+}
+
+static void _at_spi_client_enable(gboolean enabled)
+{
+ static GDBusProxy *proxy = NULL; //we keep proxy (dbus connection) until program exits
+ GVariant *result;
+ GError *error = NULL;
+ GDBusProxyFlags flags = G_DBUS_PROXY_FLAGS_NONE;
+
+
+ if (!proxy) {
+ proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
+ flags,
+ NULL, /* GDBusInterfaceInfo */
+ "org.a11y.Bus",
+ "/org/a11y/bus",
+ "org.freedesktop.DBus.Properties",
+ NULL, /* GCancellable */
+ &error);
+ if (error) {
+ fprintf(stderr, "Failed to create proxy object for '/org/a11y/bus': %s\n", error->message);
+ g_error_free(error);
+ return;
+ }
+ }
+
+ result = g_dbus_proxy_call_sync(proxy,
+ "Set",
+ g_variant_new ("(ssv)", "org.a11y.Status", "IsEnabled", g_variant_new_boolean(enabled)),
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL,
+ &error);
+ if (result)
+ g_variant_unref(result);
+
+ if (error) {
+ fprintf(stderr, "Fail to call org.freedesktop.DBus.Properties.Set: %s\n", error->message);
+ g_error_free(error);
+ }