/*
- * Copyright © 2010 Red Hat, Inc.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation; either version 2 of the licence or (at
- * your option) any later version.
- *
- * See the included COPYING file for more information.
- *
- * Author: David Zeuthen <davidz@redhat.com>
- */
-
-/*
Usage examples (modulo addresses / credentials).
const gchar *greeting;
gchar *response;
- g_variant_get (parameters, "(s)", &greeting);
+ g_variant_get (parameters, "(&s)", &greeting);
response = g_strdup_printf ("You said '%s'. KTHXBYE!", greeting);
g_dbus_method_invocation_return_value (invocation,
g_variant_new ("(s)", response));
/* ---------------------------------------------------------------------------------------------------- */
-static void
+static gboolean
on_new_connection (GDBusServer *server,
GDBusConnection *connection,
gpointer user_data)
g_object_ref (connection);
registration_id = g_dbus_connection_register_object (connection,
"/org/gtk/GDBus/TestObject",
- "org.gtk.GDBus.TestPeerInterface",
introspection_data->interfaces[0],
&interface_vtable,
NULL, /* user_data */
NULL, /* user_data_free_func */
NULL); /* GError** */
g_assert (registration_id > 0);
+
+ return TRUE;
}
/* ---------------------------------------------------------------------------------------------------- */
ret = 1;
- g_type_init ();
-
opt_address = NULL;
opt_server = FALSE;
opt_allow_anonymous = FALSE;
error = NULL;
connection = g_dbus_connection_new_for_address_sync (opt_address,
G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT,
+ NULL, /* GDBusAuthObserver */
NULL, /* GCancellable */
&error);
if (connection == NULL)
g_dbus_connection_get_capabilities (connection) & G_DBUS_CAPABILITY_FLAGS_UNIX_FD_PASSING);
greeting = g_strdup_printf ("Hey, it's %" G_GUINT64_FORMAT " already!", (guint64) time (NULL));
- value = g_dbus_connection_invoke_method_sync (connection,
- NULL, /* bus_name */
- "/org/gtk/GDBus/TestObject",
- "org.gtk.GDBus.TestPeerInterface",
- "HelloWorld",
- g_variant_new ("(s)", greeting),
- G_DBUS_INVOKE_METHOD_FLAGS_NONE,
- -1,
- NULL,
- &error);
+ value = g_dbus_connection_call_sync (connection,
+ NULL, /* bus_name */
+ "/org/gtk/GDBus/TestObject",
+ "org.gtk.GDBus.TestPeerInterface",
+ "HelloWorld",
+ g_variant_new ("(s)", greeting),
+ G_VARIANT_TYPE ("(s)"),
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL,
+ &error);
if (value == NULL)
{
g_printerr ("Error invoking HelloWorld(): %s\n", error->message);
g_error_free (error);
goto out;
}
- g_variant_get (value, "(s)", &greeting_response);
+ g_variant_get (value, "(&s)", &greeting_response);
g_print ("Server said: %s\n", greeting_response);
g_variant_unref (value);