mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-03-12 10:45:13 +01:00
GDBus: Use call() instead of invoke_method()
Lots of people been suggesting this. We still use MethodInvocation / method_invocation for handling incoming method calls so use call() instead of invoke_method() helps to separate the client and server facilities. Which is a good thing(tm).
This commit is contained in:
parent
728c4e38e7
commit
869b4c6833
@ -2361,10 +2361,10 @@ g_dbus_connection_get_guid
|
|||||||
g_dbus_connection_get_unique_name
|
g_dbus_connection_get_unique_name
|
||||||
g_dbus_connection_get_capabilities
|
g_dbus_connection_get_capabilities
|
||||||
g_dbus_connection_get_peer_credentials
|
g_dbus_connection_get_peer_credentials
|
||||||
GDBusInvokeMethodFlags
|
GDBusCallFlags
|
||||||
g_dbus_connection_invoke_method
|
g_dbus_connection_call
|
||||||
g_dbus_connection_invoke_method_finish
|
g_dbus_connection_call_finish
|
||||||
g_dbus_connection_invoke_method_sync
|
g_dbus_connection_call_sync
|
||||||
g_dbus_connection_emit_signal
|
g_dbus_connection_emit_signal
|
||||||
GDBusSignalCallback
|
GDBusSignalCallback
|
||||||
g_dbus_connection_signal_subscribe
|
g_dbus_connection_signal_subscribe
|
||||||
@ -2495,9 +2495,9 @@ g_dbus_proxy_get_cached_property_names
|
|||||||
g_dbus_proxy_get_cached_property
|
g_dbus_proxy_get_cached_property
|
||||||
g_dbus_proxy_set_interface_info
|
g_dbus_proxy_set_interface_info
|
||||||
g_dbus_proxy_get_interface_info
|
g_dbus_proxy_get_interface_info
|
||||||
g_dbus_proxy_invoke_method
|
g_dbus_proxy_call
|
||||||
g_dbus_proxy_invoke_method_finish
|
g_dbus_proxy_call_finish
|
||||||
g_dbus_proxy_invoke_method_sync
|
g_dbus_proxy_call_sync
|
||||||
<SUBSECTION Standard>
|
<SUBSECTION Standard>
|
||||||
G_DBUS_PROXY
|
G_DBUS_PROXY
|
||||||
G_IS_DBUS_PROXY
|
G_IS_DBUS_PROXY
|
||||||
|
@ -55,9 +55,9 @@
|
|||||||
<row><entry>dbus_g_connection_unregister_g_object()</entry><entry>g_dbus_connection_unregister_object()</entry></row>
|
<row><entry>dbus_g_connection_unregister_g_object()</entry><entry>g_dbus_connection_unregister_object()</entry></row>
|
||||||
<row><entry>dbus_g_object_type_install_info()</entry><entry>introspection data is installed while registering
|
<row><entry>dbus_g_object_type_install_info()</entry><entry>introspection data is installed while registering
|
||||||
an object, see g_dbus_connection_register_object()</entry></row>
|
an object, see g_dbus_connection_register_object()</entry></row>
|
||||||
<row><entry>dbus_g_proxy_begin_call()</entry><entry>g_dbus_proxy_invoke_method()</entry></row>
|
<row><entry>dbus_g_proxy_begin_call()</entry><entry>g_dbus_proxy_call()</entry></row>
|
||||||
<row><entry>dbus_g_proxy_end_call()</entry><entry>g_dbus_proxy_invoke_method_finish()</entry></row>
|
<row><entry>dbus_g_proxy_end_call()</entry><entry>g_dbus_proxy_call_finish()</entry></row>
|
||||||
<row><entry>dbus_g_proxy_call()</entry><entry>g_dbus_proxy_invoke_method_sync()</entry></row>
|
<row><entry>dbus_g_proxy_call()</entry><entry>g_dbus_proxy_call_sync()</entry></row>
|
||||||
<row><entry>dbus_g_error_domain_register()</entry><entry>g_dbus_error_register_error_domain()</entry></row>
|
<row><entry>dbus_g_error_domain_register()</entry><entry>g_dbus_error_register_error_domain()</entry></row>
|
||||||
<row><entry>dbus_g_error_has_name()</entry><entry>no direct equivalent, see g_dbus_error_get_remote_error()</entry></row>
|
<row><entry>dbus_g_error_has_name()</entry><entry>no direct equivalent, see g_dbus_error_get_remote_error()</entry></row>
|
||||||
<row><entry>dbus_g_method_return()</entry><entry>g_dbus_method_invocation_return_value()</entry></row>
|
<row><entry>dbus_g_method_return()</entry><entry>g_dbus_method_invocation_return_value()</entry></row>
|
||||||
|
160
gio/gdbus-tool.c
160
gio/gdbus-tool.c
@ -143,16 +143,16 @@ print_methods (GDBusConnection *c,
|
|||||||
guint m;
|
guint m;
|
||||||
|
|
||||||
error = NULL;
|
error = NULL;
|
||||||
result = g_dbus_connection_invoke_method_sync (c,
|
result = g_dbus_connection_call_sync (c,
|
||||||
name,
|
name,
|
||||||
path,
|
path,
|
||||||
"org.freedesktop.DBus.Introspectable",
|
"org.freedesktop.DBus.Introspectable",
|
||||||
"Introspect",
|
"Introspect",
|
||||||
NULL,
|
NULL,
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
3000, /* 3 secs */
|
3000, /* 3 secs */
|
||||||
NULL,
|
NULL,
|
||||||
&error);
|
&error);
|
||||||
if (result == NULL)
|
if (result == NULL)
|
||||||
{
|
{
|
||||||
g_printerr (_("Error: %s\n"), error->message);
|
g_printerr (_("Error: %s\n"), error->message);
|
||||||
@ -205,16 +205,16 @@ print_paths (GDBusConnection *c,
|
|||||||
guint n;
|
guint n;
|
||||||
|
|
||||||
error = NULL;
|
error = NULL;
|
||||||
result = g_dbus_connection_invoke_method_sync (c,
|
result = g_dbus_connection_call_sync (c,
|
||||||
name,
|
name,
|
||||||
path,
|
path,
|
||||||
"org.freedesktop.DBus.Introspectable",
|
"org.freedesktop.DBus.Introspectable",
|
||||||
"Introspect",
|
"Introspect",
|
||||||
NULL,
|
NULL,
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
3000, /* 3 secs */
|
3000, /* 3 secs */
|
||||||
NULL,
|
NULL,
|
||||||
&error);
|
&error);
|
||||||
if (result == NULL)
|
if (result == NULL)
|
||||||
{
|
{
|
||||||
g_printerr (_("Error: %s\n"), error->message);
|
g_printerr (_("Error: %s\n"), error->message);
|
||||||
@ -283,16 +283,16 @@ print_names (GDBusConnection *c,
|
|||||||
name_set = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
|
name_set = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
|
||||||
|
|
||||||
error = NULL;
|
error = NULL;
|
||||||
result = g_dbus_connection_invoke_method_sync (c,
|
result = g_dbus_connection_call_sync (c,
|
||||||
"org.freedesktop.DBus",
|
"org.freedesktop.DBus",
|
||||||
"/org/freedesktop/DBus",
|
"/org/freedesktop/DBus",
|
||||||
"org.freedesktop.DBus",
|
"org.freedesktop.DBus",
|
||||||
"ListNames",
|
"ListNames",
|
||||||
NULL,
|
NULL,
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
3000, /* 3 secs */
|
3000, /* 3 secs */
|
||||||
NULL,
|
NULL,
|
||||||
&error);
|
&error);
|
||||||
if (result == NULL)
|
if (result == NULL)
|
||||||
{
|
{
|
||||||
g_printerr (_("Error: %s\n"), error->message);
|
g_printerr (_("Error: %s\n"), error->message);
|
||||||
@ -312,16 +312,16 @@ print_names (GDBusConnection *c,
|
|||||||
g_variant_unref (result);
|
g_variant_unref (result);
|
||||||
|
|
||||||
error = NULL;
|
error = NULL;
|
||||||
result = g_dbus_connection_invoke_method_sync (c,
|
result = g_dbus_connection_call_sync (c,
|
||||||
"org.freedesktop.DBus",
|
"org.freedesktop.DBus",
|
||||||
"/org/freedesktop/DBus",
|
"/org/freedesktop/DBus",
|
||||||
"org.freedesktop.DBus",
|
"org.freedesktop.DBus",
|
||||||
"ListActivatableNames",
|
"ListActivatableNames",
|
||||||
NULL,
|
NULL,
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
3000, /* 3 secs */
|
3000, /* 3 secs */
|
||||||
NULL,
|
NULL,
|
||||||
&error);
|
&error);
|
||||||
if (result == NULL)
|
if (result == NULL)
|
||||||
{
|
{
|
||||||
g_printerr (_("Error: %s\n"), error->message);
|
g_printerr (_("Error: %s\n"), error->message);
|
||||||
@ -453,16 +453,16 @@ call_helper_get_method_in_signature (GDBusConnection *c,
|
|||||||
result = NULL;
|
result = NULL;
|
||||||
node_info = NULL;
|
node_info = NULL;
|
||||||
|
|
||||||
result = g_dbus_connection_invoke_method_sync (c,
|
result = g_dbus_connection_call_sync (c,
|
||||||
dest,
|
dest,
|
||||||
path,
|
path,
|
||||||
"org.freedesktop.DBus.Introspectable",
|
"org.freedesktop.DBus.Introspectable",
|
||||||
"Introspect",
|
"Introspect",
|
||||||
NULL,
|
NULL,
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
3000, /* 3 secs */
|
3000, /* 3 secs */
|
||||||
NULL,
|
NULL,
|
||||||
error);
|
error);
|
||||||
if (result == NULL)
|
if (result == NULL)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
@ -825,16 +825,16 @@ handle_call (gint *argc,
|
|||||||
|
|
||||||
if (parameters != NULL)
|
if (parameters != NULL)
|
||||||
parameters = g_variant_ref_sink (parameters);
|
parameters = g_variant_ref_sink (parameters);
|
||||||
result = g_dbus_connection_invoke_method_sync (c,
|
result = g_dbus_connection_call_sync (c,
|
||||||
opt_call_dest,
|
opt_call_dest,
|
||||||
opt_call_object_path,
|
opt_call_object_path,
|
||||||
interface_name,
|
interface_name,
|
||||||
method_name,
|
method_name,
|
||||||
parameters,
|
parameters,
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
-1,
|
-1,
|
||||||
NULL,
|
NULL,
|
||||||
&error);
|
&error);
|
||||||
if (result == NULL)
|
if (result == NULL)
|
||||||
{
|
{
|
||||||
g_printerr (_("Error: %s\n"), error->message);
|
g_printerr (_("Error: %s\n"), error->message);
|
||||||
@ -1011,16 +1011,16 @@ dump_interface (GDBusConnection *c,
|
|||||||
if (c != NULL && name != NULL && object_path != NULL)
|
if (c != NULL && name != NULL && object_path != NULL)
|
||||||
{
|
{
|
||||||
GVariant *result;
|
GVariant *result;
|
||||||
result = g_dbus_connection_invoke_method_sync (c,
|
result = g_dbus_connection_call_sync (c,
|
||||||
name,
|
name,
|
||||||
object_path,
|
object_path,
|
||||||
"org.freedesktop.DBus.Properties",
|
"org.freedesktop.DBus.Properties",
|
||||||
"GetAll",
|
"GetAll",
|
||||||
g_variant_new ("(s)", o->name),
|
g_variant_new ("(s)", o->name),
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
3000,
|
3000,
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
if (result != NULL)
|
if (result != NULL)
|
||||||
{
|
{
|
||||||
if (g_variant_is_of_type (result, G_VARIANT_TYPE ("(a{sv})")))
|
if (g_variant_is_of_type (result, G_VARIANT_TYPE ("(a{sv})")))
|
||||||
@ -1259,16 +1259,16 @@ handle_introspect (gint *argc,
|
|||||||
if (request_completion)
|
if (request_completion)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
result = g_dbus_connection_invoke_method_sync (c,
|
result = g_dbus_connection_call_sync (c,
|
||||||
opt_introspect_dest,
|
opt_introspect_dest,
|
||||||
opt_introspect_object_path,
|
opt_introspect_object_path,
|
||||||
"org.freedesktop.DBus.Introspectable",
|
"org.freedesktop.DBus.Introspectable",
|
||||||
"Introspect",
|
"Introspect",
|
||||||
NULL,
|
NULL,
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
3000, /* 3 sec */
|
3000, /* 3 sec */
|
||||||
NULL,
|
NULL,
|
||||||
&error);
|
&error);
|
||||||
if (result == NULL)
|
if (result == NULL)
|
||||||
{
|
{
|
||||||
g_printerr (_("Error: %s\n"), error->message);
|
g_printerr (_("Error: %s\n"), error->message);
|
||||||
|
@ -351,7 +351,7 @@ mechanism_client_initiate (GDBusAuthMechanism *mechanism,
|
|||||||
|
|
||||||
/* return the uid */
|
/* return the uid */
|
||||||
#if defined(G_OS_UNIX)
|
#if defined(G_OS_UNIX)
|
||||||
initial_response = g_strdup_printf ("%" G_GINT64_FORMAT, g_credentials_get_unix_user (credentials, NULL));
|
initial_response = g_strdup_printf ("%" G_GINT64_FORMAT, (gint64) g_credentials_get_unix_user (credentials, NULL));
|
||||||
#elif defined(G_OS_WIN32)
|
#elif defined(G_OS_WIN32)
|
||||||
initial_response = g_strdup_printf ("%s", g_credentials_get_windows_user ());
|
initial_response = g_strdup_printf ("%s", g_credentials_get_windows_user ());
|
||||||
#else
|
#else
|
||||||
|
@ -1802,16 +1802,16 @@ initable_init (GInitable *initable,
|
|||||||
GVariant *hello_result;
|
GVariant *hello_result;
|
||||||
const gchar *s;
|
const gchar *s;
|
||||||
|
|
||||||
hello_result = g_dbus_connection_invoke_method_sync (connection,
|
hello_result = g_dbus_connection_call_sync (connection,
|
||||||
"org.freedesktop.DBus", /* name */
|
"org.freedesktop.DBus", /* name */
|
||||||
"/org/freedesktop/DBus", /* path */
|
"/org/freedesktop/DBus", /* path */
|
||||||
"org.freedesktop.DBus", /* interface */
|
"org.freedesktop.DBus", /* interface */
|
||||||
"Hello",
|
"Hello",
|
||||||
NULL, /* parameters */
|
NULL, /* parameters */
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
-1,
|
-1,
|
||||||
NULL, /* TODO: cancellable */
|
NULL, /* TODO: cancellable */
|
||||||
&connection->priv->initialization_error);
|
&connection->priv->initialization_error);
|
||||||
if (hello_result == NULL)
|
if (hello_result == NULL)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
@ -2274,7 +2274,7 @@ static guint _global_filter_id = 1;
|
|||||||
* worker thread. Also note that filters are rarely needed - use API
|
* worker thread. Also note that filters are rarely needed - use API
|
||||||
* such as g_dbus_connection_send_message_with_reply(),
|
* such as g_dbus_connection_send_message_with_reply(),
|
||||||
* g_dbus_connection_signal_subscribe() or
|
* g_dbus_connection_signal_subscribe() or
|
||||||
* g_dbus_connection_invoke_method() instead.
|
* g_dbus_connection_call() instead.
|
||||||
*
|
*
|
||||||
* Returns: A filter identifier that can be used with
|
* Returns: A filter identifier that can be used with
|
||||||
* g_dbus_connection_remove_filter().
|
* g_dbus_connection_remove_filter().
|
||||||
@ -3646,7 +3646,7 @@ handle_introspect (GDBusConnection *connection,
|
|||||||
|
|
||||||
/* called in thread where object was registered - no locks held */
|
/* called in thread where object was registered - no locks held */
|
||||||
static gboolean
|
static gboolean
|
||||||
invoke_method_in_idle_cb (gpointer user_data)
|
call_in_idle_cb (gpointer user_data)
|
||||||
{
|
{
|
||||||
GDBusMethodInvocation *invocation = G_DBUS_METHOD_INVOCATION (user_data);
|
GDBusMethodInvocation *invocation = G_DBUS_METHOD_INVOCATION (user_data);
|
||||||
GDBusInterfaceVTable *vtable;
|
GDBusInterfaceVTable *vtable;
|
||||||
@ -3753,7 +3753,7 @@ validate_and_maybe_schedule_method_call (GDBusConnection *connection,
|
|||||||
idle_source = g_idle_source_new ();
|
idle_source = g_idle_source_new ();
|
||||||
g_source_set_priority (idle_source, G_PRIORITY_DEFAULT);
|
g_source_set_priority (idle_source, G_PRIORITY_DEFAULT);
|
||||||
g_source_set_callback (idle_source,
|
g_source_set_callback (idle_source,
|
||||||
invoke_method_in_idle_cb,
|
call_in_idle_cb,
|
||||||
invocation,
|
invocation,
|
||||||
g_object_unref);
|
g_object_unref);
|
||||||
g_source_attach (idle_source, main_context);
|
g_source_attach (idle_source, main_context);
|
||||||
@ -4068,22 +4068,22 @@ g_dbus_connection_emit_signal (GDBusConnection *connection,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
add_invoke_method_flags (GDBusMessage *message,
|
add_call_flags (GDBusMessage *message,
|
||||||
GDBusInvokeMethodFlags flags)
|
GDBusCallFlags flags)
|
||||||
{
|
{
|
||||||
if (flags & G_DBUS_INVOKE_METHOD_FLAGS_NO_AUTO_START)
|
if (flags & G_DBUS_CALL_FLAGS_NO_AUTO_START)
|
||||||
g_dbus_message_set_flags (message, G_DBUS_MESSAGE_FLAGS_NO_AUTO_START);
|
g_dbus_message_set_flags (message, G_DBUS_MESSAGE_FLAGS_NO_AUTO_START);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* g_dbus_connection_invoke_method:
|
* g_dbus_connection_call:
|
||||||
* @connection: A #GDBusConnection.
|
* @connection: A #GDBusConnection.
|
||||||
* @bus_name: A unique or well-known bus name or %NULL if @connection is not a message bus connection.
|
* @bus_name: A unique or well-known bus name or %NULL if @connection is not a message bus connection.
|
||||||
* @object_path: Path of remote object.
|
* @object_path: Path of remote object.
|
||||||
* @interface_name: D-Bus interface to invoke method on.
|
* @interface_name: D-Bus interface to invoke method on.
|
||||||
* @method_name: The name of the method to invoke.
|
* @method_name: The name of the method to invoke.
|
||||||
* @parameters: A #GVariant tuple with parameters for the method or %NULL if not passing parameters.
|
* @parameters: A #GVariant tuple with parameters for the method or %NULL if not passing parameters.
|
||||||
* @flags: Flags from the #GDBusInvokeMethodFlags enumeration.
|
* @flags: Flags from the #GDBusCallFlags enumeration.
|
||||||
* @timeout_msec: The timeout in milliseconds or -1 to use the default timeout.
|
* @timeout_msec: The timeout in milliseconds or -1 to use the default timeout.
|
||||||
* @cancellable: A #GCancellable or %NULL.
|
* @cancellable: A #GCancellable or %NULL.
|
||||||
* @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL if you don't
|
* @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL if you don't
|
||||||
@ -4103,24 +4103,24 @@ add_invoke_method_flags (GDBusMessage *message,
|
|||||||
* This is an asynchronous method. When the operation is finished, @callback will be invoked
|
* This is an asynchronous method. When the operation is finished, @callback will be invoked
|
||||||
* in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link>
|
* in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link>
|
||||||
* of the thread you are calling this method from. You can then call
|
* of the thread you are calling this method from. You can then call
|
||||||
* g_dbus_connection_invoke_method_finish() to get the result of the operation.
|
* g_dbus_connection_call_finish() to get the result of the operation.
|
||||||
* See g_dbus_connection_invoke_method_sync() for the synchronous version of this
|
* See g_dbus_connection_call_sync() for the synchronous version of this
|
||||||
* function.
|
* function.
|
||||||
*
|
*
|
||||||
* Since: 2.26
|
* Since: 2.26
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
g_dbus_connection_invoke_method (GDBusConnection *connection,
|
g_dbus_connection_call (GDBusConnection *connection,
|
||||||
const gchar *bus_name,
|
const gchar *bus_name,
|
||||||
const gchar *object_path,
|
const gchar *object_path,
|
||||||
const gchar *interface_name,
|
const gchar *interface_name,
|
||||||
const gchar *method_name,
|
const gchar *method_name,
|
||||||
GVariant *parameters,
|
GVariant *parameters,
|
||||||
GDBusInvokeMethodFlags flags,
|
GDBusCallFlags flags,
|
||||||
gint timeout_msec,
|
gint timeout_msec,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GDBusMessage *message;
|
GDBusMessage *message;
|
||||||
|
|
||||||
@ -4136,7 +4136,7 @@ g_dbus_connection_invoke_method (GDBusConnection *connection,
|
|||||||
object_path,
|
object_path,
|
||||||
interface_name,
|
interface_name,
|
||||||
method_name);
|
method_name);
|
||||||
add_invoke_method_flags (message, flags);
|
add_call_flags (message, flags);
|
||||||
if (parameters != NULL)
|
if (parameters != NULL)
|
||||||
g_dbus_message_set_body (message, parameters);
|
g_dbus_message_set_body (message, parameters);
|
||||||
|
|
||||||
@ -4187,12 +4187,12 @@ decode_method_reply (GDBusMessage *reply,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* g_dbus_connection_invoke_method_finish:
|
* g_dbus_connection_call_finish:
|
||||||
* @connection: A #GDBusConnection.
|
* @connection: A #GDBusConnection.
|
||||||
* @res: A #GAsyncResult obtained from the #GAsyncReadyCallback passed to g_dbus_connection_invoke_method().
|
* @res: A #GAsyncResult obtained from the #GAsyncReadyCallback passed to g_dbus_connection_call().
|
||||||
* @error: Return location for error or %NULL.
|
* @error: Return location for error or %NULL.
|
||||||
*
|
*
|
||||||
* Finishes an operation started with g_dbus_connection_invoke_method().
|
* Finishes an operation started with g_dbus_connection_call().
|
||||||
*
|
*
|
||||||
* Returns: %NULL if @error is set. Otherwise a #GVariant tuple with
|
* Returns: %NULL if @error is set. Otherwise a #GVariant tuple with
|
||||||
* return values. Free with g_variant_unref().
|
* return values. Free with g_variant_unref().
|
||||||
@ -4200,9 +4200,9 @@ decode_method_reply (GDBusMessage *reply,
|
|||||||
* Since: 2.26
|
* Since: 2.26
|
||||||
*/
|
*/
|
||||||
GVariant *
|
GVariant *
|
||||||
g_dbus_connection_invoke_method_finish (GDBusConnection *connection,
|
g_dbus_connection_call_finish (GDBusConnection *connection,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GDBusMessage *reply;
|
GDBusMessage *reply;
|
||||||
GVariant *result;
|
GVariant *result;
|
||||||
@ -4228,14 +4228,14 @@ g_dbus_connection_invoke_method_finish (GDBusConnection *connection,
|
|||||||
/* ---------------------------------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* g_dbus_connection_invoke_method_sync:
|
* g_dbus_connection_call_sync:
|
||||||
* @connection: A #GDBusConnection.
|
* @connection: A #GDBusConnection.
|
||||||
* @bus_name: A unique or well-known bus name.
|
* @bus_name: A unique or well-known bus name.
|
||||||
* @object_path: Path of remote object.
|
* @object_path: Path of remote object.
|
||||||
* @interface_name: D-Bus interface to invoke method on.
|
* @interface_name: D-Bus interface to invoke method on.
|
||||||
* @method_name: The name of the method to invoke.
|
* @method_name: The name of the method to invoke.
|
||||||
* @parameters: A #GVariant tuple with parameters for the method or %NULL if not passing parameters.
|
* @parameters: A #GVariant tuple with parameters for the method or %NULL if not passing parameters.
|
||||||
* @flags: Flags from the #GDBusInvokeMethodFlags enumeration.
|
* @flags: Flags from the #GDBusCallFlags enumeration.
|
||||||
* @timeout_msec: The timeout in milliseconds or -1 to use the default timeout.
|
* @timeout_msec: The timeout in milliseconds or -1 to use the default timeout.
|
||||||
* @cancellable: A #GCancellable or %NULL.
|
* @cancellable: A #GCancellable or %NULL.
|
||||||
* @error: Return location for error or %NULL.
|
* @error: Return location for error or %NULL.
|
||||||
@ -4251,7 +4251,7 @@ g_dbus_connection_invoke_method_finish (GDBusConnection *connection,
|
|||||||
* fails with %G_IO_ERROR_INVALID_ARGUMENT.
|
* fails with %G_IO_ERROR_INVALID_ARGUMENT.
|
||||||
*
|
*
|
||||||
* The calling thread is blocked until a reply is received. See
|
* The calling thread is blocked until a reply is received. See
|
||||||
* g_dbus_connection_invoke_method() for the asynchronous version of
|
* g_dbus_connection_call() for the asynchronous version of
|
||||||
* this method.
|
* this method.
|
||||||
*
|
*
|
||||||
* Returns: %NULL if @error is set. Otherwise a #GVariant tuple with
|
* Returns: %NULL if @error is set. Otherwise a #GVariant tuple with
|
||||||
@ -4260,16 +4260,16 @@ g_dbus_connection_invoke_method_finish (GDBusConnection *connection,
|
|||||||
* Since: 2.26
|
* Since: 2.26
|
||||||
*/
|
*/
|
||||||
GVariant *
|
GVariant *
|
||||||
g_dbus_connection_invoke_method_sync (GDBusConnection *connection,
|
g_dbus_connection_call_sync (GDBusConnection *connection,
|
||||||
const gchar *bus_name,
|
const gchar *bus_name,
|
||||||
const gchar *object_path,
|
const gchar *object_path,
|
||||||
const gchar *interface_name,
|
const gchar *interface_name,
|
||||||
const gchar *method_name,
|
const gchar *method_name,
|
||||||
GVariant *parameters,
|
GVariant *parameters,
|
||||||
GDBusInvokeMethodFlags flags,
|
GDBusCallFlags flags,
|
||||||
gint timeout_msec,
|
gint timeout_msec,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GDBusMessage *message;
|
GDBusMessage *message;
|
||||||
GDBusMessage *reply;
|
GDBusMessage *reply;
|
||||||
@ -4291,7 +4291,7 @@ g_dbus_connection_invoke_method_sync (GDBusConnection *connection,
|
|||||||
object_path,
|
object_path,
|
||||||
interface_name,
|
interface_name,
|
||||||
method_name);
|
method_name);
|
||||||
add_invoke_method_flags (message, flags);
|
add_call_flags (message, flags);
|
||||||
if (parameters != NULL)
|
if (parameters != NULL)
|
||||||
g_dbus_message_set_body (message, parameters);
|
g_dbus_message_set_body (message, parameters);
|
||||||
|
|
||||||
|
@ -171,27 +171,27 @@ gboolean g_dbus_connection_emit_signal (GDBusConnection
|
|||||||
const gchar *signal_name,
|
const gchar *signal_name,
|
||||||
GVariant *parameters,
|
GVariant *parameters,
|
||||||
GError **error);
|
GError **error);
|
||||||
void g_dbus_connection_invoke_method (GDBusConnection *connection,
|
void g_dbus_connection_call (GDBusConnection *connection,
|
||||||
const gchar *bus_name,
|
const gchar *bus_name,
|
||||||
const gchar *object_path,
|
const gchar *object_path,
|
||||||
const gchar *interface_name,
|
const gchar *interface_name,
|
||||||
const gchar *method_name,
|
const gchar *method_name,
|
||||||
GVariant *parameters,
|
GVariant *parameters,
|
||||||
GDBusInvokeMethodFlags flags,
|
GDBusCallFlags flags,
|
||||||
gint timeout_msec,
|
gint timeout_msec,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
GVariant *g_dbus_connection_invoke_method_finish (GDBusConnection *connection,
|
GVariant *g_dbus_connection_call_finish (GDBusConnection *connection,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
GError **error);
|
GError **error);
|
||||||
GVariant *g_dbus_connection_invoke_method_sync (GDBusConnection *connection,
|
GVariant *g_dbus_connection_call_sync (GDBusConnection *connection,
|
||||||
const gchar *bus_name,
|
const gchar *bus_name,
|
||||||
const gchar *object_path,
|
const gchar *object_path,
|
||||||
const gchar *interface_name,
|
const gchar *interface_name,
|
||||||
const gchar *method_name,
|
const gchar *method_name,
|
||||||
GVariant *parameters,
|
GVariant *parameters,
|
||||||
GDBusInvokeMethodFlags flags,
|
GDBusCallFlags flags,
|
||||||
gint timeout_msec,
|
gint timeout_msec,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
@ -41,9 +41,9 @@
|
|||||||
* @include: gio/gio.h
|
* @include: gio/gio.h
|
||||||
*
|
*
|
||||||
* All facilities that return errors from remote methods (such as
|
* All facilities that return errors from remote methods (such as
|
||||||
* g_dbus_connection_invoke_method_sync()) use #GError to represent
|
* g_dbus_connection_call_sync()) use #GError to represent both D-Bus
|
||||||
* both D-Bus errors (e.g. errors returned from the other peer) and
|
* errors (e.g. errors returned from the other peer) and locally
|
||||||
* locally in-process generated errors.
|
* in-process generated errors.
|
||||||
*
|
*
|
||||||
* To check if a returned #GError is an error from a remote peer, use
|
* To check if a returned #GError is an error from a remote peer, use
|
||||||
* g_dbus_error_is_remote_error(). To get the actual D-Bus error name,
|
* g_dbus_error_is_remote_error(). To get the actual D-Bus error name,
|
||||||
@ -488,9 +488,10 @@ g_dbus_error_is_remote_error (const GError *error)
|
|||||||
*
|
*
|
||||||
* Gets the D-Bus error name used for @error, if any.
|
* Gets the D-Bus error name used for @error, if any.
|
||||||
*
|
*
|
||||||
* This function is guaranteed to return a D-Bus error name for all #GError<!-- -->s returned from
|
* This function is guaranteed to return a D-Bus error name for all
|
||||||
* functions handling remote method calls (e.g. g_dbus_connection_invoke_method_finish())
|
* #GError<!-- -->s returned from functions handling remote method
|
||||||
* unless g_dbus_error_strip_remote_error() has been used on @error.
|
* calls (e.g. g_dbus_connection_call_finish()) unless
|
||||||
|
* g_dbus_error_strip_remote_error() has been used on @error.
|
||||||
*
|
*
|
||||||
* Returns: An allocated string or %NULL if the D-Bus error name could not be found. Free with g_free().
|
* Returns: An allocated string or %NULL if the D-Bus error name could not be found. Free with g_free().
|
||||||
*
|
*
|
||||||
|
@ -294,9 +294,9 @@ request_name_cb (GObject *source_object,
|
|||||||
request_name_reply = 0;
|
request_name_reply = 0;
|
||||||
result = NULL;
|
result = NULL;
|
||||||
|
|
||||||
result = g_dbus_connection_invoke_method_finish (client->connection,
|
result = g_dbus_connection_call_finish (client->connection,
|
||||||
res,
|
res,
|
||||||
NULL);
|
NULL);
|
||||||
if (result != NULL)
|
if (result != NULL)
|
||||||
{
|
{
|
||||||
g_variant_get (result, "(u)", &request_name_reply);
|
g_variant_get (result, "(u)", &request_name_reply);
|
||||||
@ -395,19 +395,19 @@ has_connection (Client *client)
|
|||||||
client);
|
client);
|
||||||
|
|
||||||
/* attempt to acquire the name */
|
/* attempt to acquire the name */
|
||||||
g_dbus_connection_invoke_method (client->connection,
|
g_dbus_connection_call (client->connection,
|
||||||
"org.freedesktop.DBus", /* bus name */
|
"org.freedesktop.DBus", /* bus name */
|
||||||
"/org/freedesktop/DBus", /* object path */
|
"/org/freedesktop/DBus", /* object path */
|
||||||
"org.freedesktop.DBus", /* interface name */
|
"org.freedesktop.DBus", /* interface name */
|
||||||
"RequestName", /* method name */
|
"RequestName", /* method name */
|
||||||
g_variant_new ("(su)",
|
g_variant_new ("(su)",
|
||||||
client->name,
|
client->name,
|
||||||
client->flags),
|
client->flags),
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
-1,
|
-1,
|
||||||
NULL,
|
NULL,
|
||||||
(GAsyncReadyCallback) request_name_cb,
|
(GAsyncReadyCallback) request_name_cb,
|
||||||
client_ref (client));
|
client_ref (client));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -676,16 +676,16 @@ g_bus_unown_name (guint owner_id)
|
|||||||
* I believe this is a bug in the bus daemon.
|
* I believe this is a bug in the bus daemon.
|
||||||
*/
|
*/
|
||||||
error = NULL;
|
error = NULL;
|
||||||
result = g_dbus_connection_invoke_method_sync (client->connection,
|
result = g_dbus_connection_call_sync (client->connection,
|
||||||
"org.freedesktop.DBus", /* bus name */
|
"org.freedesktop.DBus", /* bus name */
|
||||||
"/org/freedesktop/DBus", /* object path */
|
"/org/freedesktop/DBus", /* object path */
|
||||||
"org.freedesktop.DBus", /* interface name */
|
"org.freedesktop.DBus", /* interface name */
|
||||||
"ReleaseName", /* method name */
|
"ReleaseName", /* method name */
|
||||||
g_variant_new ("(s)", client->name),
|
g_variant_new ("(s)", client->name),
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
-1,
|
-1,
|
||||||
NULL,
|
NULL,
|
||||||
&error);
|
&error);
|
||||||
if (result == NULL)
|
if (result == NULL)
|
||||||
{
|
{
|
||||||
g_warning ("Error releasing name %s: %s", client->name, error->message);
|
g_warning ("Error releasing name %s: %s", client->name, error->message);
|
||||||
|
@ -331,9 +331,9 @@ get_name_owner_cb (GObject *source_object,
|
|||||||
name_owner = NULL;
|
name_owner = NULL;
|
||||||
result = NULL;
|
result = NULL;
|
||||||
|
|
||||||
result = g_dbus_connection_invoke_method_finish (client->connection,
|
result = g_dbus_connection_call_finish (client->connection,
|
||||||
res,
|
res,
|
||||||
NULL);
|
NULL);
|
||||||
if (result != NULL)
|
if (result != NULL)
|
||||||
{
|
{
|
||||||
g_variant_get (result, "(s)", &name_owner);
|
g_variant_get (result, "(s)", &name_owner);
|
||||||
@ -362,17 +362,17 @@ get_name_owner_cb (GObject *source_object,
|
|||||||
static void
|
static void
|
||||||
invoke_get_name_owner (Client *client)
|
invoke_get_name_owner (Client *client)
|
||||||
{
|
{
|
||||||
g_dbus_connection_invoke_method (client->connection,
|
g_dbus_connection_call (client->connection,
|
||||||
"org.freedesktop.DBus", /* bus name */
|
"org.freedesktop.DBus", /* bus name */
|
||||||
"/org/freedesktop/DBus", /* object path */
|
"/org/freedesktop/DBus", /* object path */
|
||||||
"org.freedesktop.DBus", /* interface name */
|
"org.freedesktop.DBus", /* interface name */
|
||||||
"GetNameOwner", /* method name */
|
"GetNameOwner", /* method name */
|
||||||
g_variant_new ("(s)", client->name),
|
g_variant_new ("(s)", client->name),
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
-1,
|
-1,
|
||||||
NULL,
|
NULL,
|
||||||
(GAsyncReadyCallback) get_name_owner_cb,
|
(GAsyncReadyCallback) get_name_owner_cb,
|
||||||
client_ref (client));
|
client_ref (client));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------------------------------- */
|
||||||
@ -387,9 +387,9 @@ start_service_by_name_cb (GObject *source_object,
|
|||||||
|
|
||||||
result = NULL;
|
result = NULL;
|
||||||
|
|
||||||
result = g_dbus_connection_invoke_method_finish (client->connection,
|
result = g_dbus_connection_call_finish (client->connection,
|
||||||
res,
|
res,
|
||||||
NULL);
|
NULL);
|
||||||
if (result != NULL)
|
if (result != NULL)
|
||||||
{
|
{
|
||||||
guint32 start_service_result;
|
guint32 start_service_result;
|
||||||
@ -452,17 +452,17 @@ has_connection (Client *client)
|
|||||||
|
|
||||||
if (client->flags & G_BUS_NAME_WATCHER_FLAGS_AUTO_START)
|
if (client->flags & G_BUS_NAME_WATCHER_FLAGS_AUTO_START)
|
||||||
{
|
{
|
||||||
g_dbus_connection_invoke_method (client->connection,
|
g_dbus_connection_call (client->connection,
|
||||||
"org.freedesktop.DBus", /* bus name */
|
"org.freedesktop.DBus", /* bus name */
|
||||||
"/org/freedesktop/DBus", /* object path */
|
"/org/freedesktop/DBus", /* object path */
|
||||||
"org.freedesktop.DBus", /* interface name */
|
"org.freedesktop.DBus", /* interface name */
|
||||||
"StartServiceByName", /* method name */
|
"StartServiceByName", /* method name */
|
||||||
g_variant_new ("(su)", client->name, 0),
|
g_variant_new ("(su)", client->name, 0),
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
-1,
|
-1,
|
||||||
NULL,
|
NULL,
|
||||||
(GAsyncReadyCallback) start_service_by_name_cb,
|
(GAsyncReadyCallback) start_service_by_name_cb,
|
||||||
client_ref (client));
|
client_ref (client));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
142
gio/gdbusproxy.c
142
gio/gdbusproxy.c
@ -359,8 +359,8 @@ g_dbus_proxy_class_init (GDBusProxyClass *klass)
|
|||||||
* GDBusProxy:g-default-timeout:
|
* GDBusProxy:g-default-timeout:
|
||||||
*
|
*
|
||||||
* The timeout to use if -1 (specifying default timeout) is passed
|
* The timeout to use if -1 (specifying default timeout) is passed
|
||||||
* as @timeout_msec in the g_dbus_proxy_invoke_method() and
|
* as @timeout_msec in the g_dbus_proxy_call() and
|
||||||
* g_dbus_proxy_invoke_method_sync() functions.
|
* g_dbus_proxy_call_sync() functions.
|
||||||
*
|
*
|
||||||
* This allows applications to set a proxy-wide timeout for all
|
* This allows applications to set a proxy-wide timeout for all
|
||||||
* remote method invocations on the proxy. If this property is -1,
|
* remote method invocations on the proxy. If this property is -1,
|
||||||
@ -752,16 +752,16 @@ initable_init (GInitable *initable,
|
|||||||
if (!(proxy->priv->flags & G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES))
|
if (!(proxy->priv->flags & G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES))
|
||||||
{
|
{
|
||||||
/* load all properties synchronously */
|
/* load all properties synchronously */
|
||||||
result = g_dbus_connection_invoke_method_sync (proxy->priv->connection,
|
result = g_dbus_connection_call_sync (proxy->priv->connection,
|
||||||
proxy->priv->unique_bus_name,
|
proxy->priv->unique_bus_name,
|
||||||
proxy->priv->object_path,
|
proxy->priv->object_path,
|
||||||
"org.freedesktop.DBus.Properties",
|
"org.freedesktop.DBus.Properties",
|
||||||
"GetAll",
|
"GetAll",
|
||||||
g_variant_new ("(s)", proxy->priv->interface_name),
|
g_variant_new ("(s)", proxy->priv->interface_name),
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
-1, /* timeout */
|
-1, /* timeout */
|
||||||
cancellable,
|
cancellable,
|
||||||
error);
|
error);
|
||||||
if (result == NULL)
|
if (result == NULL)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
@ -796,9 +796,9 @@ get_all_cb (GDBusConnection *connection,
|
|||||||
GError *error;
|
GError *error;
|
||||||
|
|
||||||
error = NULL;
|
error = NULL;
|
||||||
result = g_dbus_connection_invoke_method_finish (connection,
|
result = g_dbus_connection_call_finish (connection,
|
||||||
res,
|
res,
|
||||||
&error);
|
&error);
|
||||||
if (result == NULL)
|
if (result == NULL)
|
||||||
{
|
{
|
||||||
g_simple_async_result_set_from_error (simple, error);
|
g_simple_async_result_set_from_error (simple, error);
|
||||||
@ -833,17 +833,17 @@ async_initable_init_async (GAsyncInitable *initable,
|
|||||||
if (!(proxy->priv->flags & G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES))
|
if (!(proxy->priv->flags & G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES))
|
||||||
{
|
{
|
||||||
/* load all properties asynchronously */
|
/* load all properties asynchronously */
|
||||||
g_dbus_connection_invoke_method (proxy->priv->connection,
|
g_dbus_connection_call (proxy->priv->connection,
|
||||||
proxy->priv->unique_bus_name,
|
proxy->priv->unique_bus_name,
|
||||||
proxy->priv->object_path,
|
proxy->priv->object_path,
|
||||||
"org.freedesktop.DBus.Properties",
|
"org.freedesktop.DBus.Properties",
|
||||||
"GetAll",
|
"GetAll",
|
||||||
g_variant_new ("(s)", proxy->priv->interface_name),
|
g_variant_new ("(s)", proxy->priv->interface_name),
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
-1, /* timeout */
|
-1, /* timeout */
|
||||||
cancellable,
|
cancellable,
|
||||||
(GAsyncReadyCallback) get_all_cb,
|
(GAsyncReadyCallback) get_all_cb,
|
||||||
simple);
|
simple);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1148,8 +1148,8 @@ g_dbus_proxy_get_interface_name (GDBusProxy *proxy)
|
|||||||
* @proxy: A #GDBusProxy.
|
* @proxy: A #GDBusProxy.
|
||||||
*
|
*
|
||||||
* Gets the timeout to use if -1 (specifying default timeout) is
|
* Gets the timeout to use if -1 (specifying default timeout) is
|
||||||
* passed as @timeout_msec in the g_dbus_proxy_invoke_method() and
|
* passed as @timeout_msec in the g_dbus_proxy_call() and
|
||||||
* g_dbus_proxy_invoke_method_sync() functions.
|
* g_dbus_proxy_call_sync() functions.
|
||||||
*
|
*
|
||||||
* See the #GDBusProxy:g-default-timeout property for more details.
|
* See the #GDBusProxy:g-default-timeout property for more details.
|
||||||
*
|
*
|
||||||
@ -1170,8 +1170,8 @@ g_dbus_proxy_get_default_timeout (GDBusProxy *proxy)
|
|||||||
* @timeout_msec: Timeout in milliseconds.
|
* @timeout_msec: Timeout in milliseconds.
|
||||||
*
|
*
|
||||||
* Sets the timeout to use if -1 (specifying default timeout) is
|
* Sets the timeout to use if -1 (specifying default timeout) is
|
||||||
* passed as @timeout_msec in the g_dbus_proxy_invoke_method() and
|
* passed as @timeout_msec in the g_dbus_proxy_call() and
|
||||||
* g_dbus_proxy_invoke_method_sync() functions.
|
* g_dbus_proxy_call_sync() functions.
|
||||||
*
|
*
|
||||||
* See the #GDBusProxy:g-default-timeout property for more details.
|
* See the #GDBusProxy:g-default-timeout property for more details.
|
||||||
*
|
*
|
||||||
@ -1282,9 +1282,9 @@ reply_cb (GDBusConnection *connection,
|
|||||||
GError *error;
|
GError *error;
|
||||||
|
|
||||||
error = NULL;
|
error = NULL;
|
||||||
value = g_dbus_connection_invoke_method_finish (connection,
|
value = g_dbus_connection_call_finish (connection,
|
||||||
res,
|
res,
|
||||||
&error);
|
&error);
|
||||||
if (error != NULL)
|
if (error != NULL)
|
||||||
{
|
{
|
||||||
g_simple_async_result_set_from_error (simple,
|
g_simple_async_result_set_from_error (simple,
|
||||||
@ -1359,11 +1359,11 @@ validate_method_return (const char *method_name,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* g_dbus_proxy_invoke_method:
|
* g_dbus_proxy_call:
|
||||||
* @proxy: A #GDBusProxy.
|
* @proxy: A #GDBusProxy.
|
||||||
* @method_name: Name of method to invoke.
|
* @method_name: Name of method to invoke.
|
||||||
* @parameters: A #GVariant tuple with parameters for the signal or %NULL if not passing parameters.
|
* @parameters: A #GVariant tuple with parameters for the signal or %NULL if not passing parameters.
|
||||||
* @flags: Flags from the #GDBusInvokeMethodFlags enumeration.
|
* @flags: Flags from the #GDBusCallFlags enumeration.
|
||||||
* @timeout_msec: The timeout in milliseconds or -1 to use the proxy default timeout.
|
* @timeout_msec: The timeout in milliseconds or -1 to use the proxy default timeout.
|
||||||
* @cancellable: A #GCancellable or %NULL.
|
* @cancellable: A #GCancellable or %NULL.
|
||||||
* @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL if you don't
|
* @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL if you don't
|
||||||
@ -1386,17 +1386,17 @@ validate_method_return (const char *method_name,
|
|||||||
* This is an asynchronous method. When the operation is finished, @callback will be invoked
|
* This is an asynchronous method. When the operation is finished, @callback will be invoked
|
||||||
* in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link>
|
* in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link>
|
||||||
* of the thread you are calling this method from. You can then call
|
* of the thread you are calling this method from. You can then call
|
||||||
* g_dbus_proxy_invoke_method_finish() to get the result of the operation.
|
* g_dbus_proxy_call_finish() to get the result of the operation.
|
||||||
* See g_dbus_proxy_invoke_method_sync() for the
|
* See g_dbus_proxy_call_sync() for the
|
||||||
* synchronous version of this method.
|
* synchronous version of this method.
|
||||||
*
|
*
|
||||||
* Since: 2.26
|
* Since: 2.26
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
g_dbus_proxy_invoke_method (GDBusProxy *proxy,
|
g_dbus_proxy_call (GDBusProxy *proxy,
|
||||||
const gchar *method_name,
|
const gchar *method_name,
|
||||||
GVariant *parameters,
|
GVariant *parameters,
|
||||||
GDBusInvokeMethodFlags flags,
|
GDBusCallFlags flags,
|
||||||
gint timeout_msec,
|
gint timeout_msec,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
@ -1418,7 +1418,7 @@ g_dbus_proxy_invoke_method (GDBusProxy *proxy,
|
|||||||
simple = g_simple_async_result_new (G_OBJECT (proxy),
|
simple = g_simple_async_result_new (G_OBJECT (proxy),
|
||||||
callback,
|
callback,
|
||||||
user_data,
|
user_data,
|
||||||
g_dbus_proxy_invoke_method);
|
g_dbus_proxy_call);
|
||||||
|
|
||||||
was_split = maybe_split_method_name (method_name, &split_interface_name, &split_method_name);
|
was_split = maybe_split_method_name (method_name, &split_interface_name, &split_method_name);
|
||||||
target_method_name = was_split ? split_method_name : method_name;
|
target_method_name = was_split ? split_method_name : method_name;
|
||||||
@ -1429,28 +1429,28 @@ g_dbus_proxy_invoke_method (GDBusProxy *proxy,
|
|||||||
/* Just warn here */
|
/* Just warn here */
|
||||||
expected_method_info = lookup_method_info_or_warn (proxy, target_method_name);
|
expected_method_info = lookup_method_info_or_warn (proxy, target_method_name);
|
||||||
|
|
||||||
g_dbus_connection_invoke_method (proxy->priv->connection,
|
g_dbus_connection_call (proxy->priv->connection,
|
||||||
proxy->priv->unique_bus_name,
|
proxy->priv->unique_bus_name,
|
||||||
proxy->priv->object_path,
|
proxy->priv->object_path,
|
||||||
target_interface_name,
|
target_interface_name,
|
||||||
target_method_name,
|
target_method_name,
|
||||||
parameters,
|
parameters,
|
||||||
flags,
|
flags,
|
||||||
timeout_msec == -1 ? proxy->priv->timeout_msec : timeout_msec,
|
timeout_msec == -1 ? proxy->priv->timeout_msec : timeout_msec,
|
||||||
cancellable,
|
cancellable,
|
||||||
(GAsyncReadyCallback) reply_cb,
|
(GAsyncReadyCallback) reply_cb,
|
||||||
simple);
|
simple);
|
||||||
|
|
||||||
g_free (split_interface_name);
|
g_free (split_interface_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* g_dbus_proxy_invoke_method_finish:
|
* g_dbus_proxy_call_finish:
|
||||||
* @proxy: A #GDBusProxy.
|
* @proxy: A #GDBusProxy.
|
||||||
* @res: A #GAsyncResult obtained from the #GAsyncReadyCallback passed to g_dbus_proxy_invoke_method().
|
* @res: A #GAsyncResult obtained from the #GAsyncReadyCallback passed to g_dbus_proxy_call().
|
||||||
* @error: Return location for error or %NULL.
|
* @error: Return location for error or %NULL.
|
||||||
*
|
*
|
||||||
* Finishes an operation started with g_dbus_proxy_invoke_method().
|
* Finishes an operation started with g_dbus_proxy_call().
|
||||||
*
|
*
|
||||||
* Returns: %NULL if @error is set. Otherwise a #GVariant tuple with
|
* Returns: %NULL if @error is set. Otherwise a #GVariant tuple with
|
||||||
* return values. Free with g_variant_unref().
|
* return values. Free with g_variant_unref().
|
||||||
@ -1458,7 +1458,7 @@ g_dbus_proxy_invoke_method (GDBusProxy *proxy,
|
|||||||
* Since: 2.26
|
* Since: 2.26
|
||||||
*/
|
*/
|
||||||
GVariant *
|
GVariant *
|
||||||
g_dbus_proxy_invoke_method_finish (GDBusProxy *proxy,
|
g_dbus_proxy_call_finish (GDBusProxy *proxy,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
@ -1471,7 +1471,7 @@ g_dbus_proxy_invoke_method_finish (GDBusProxy *proxy,
|
|||||||
g_return_val_if_fail (G_IS_ASYNC_RESULT (res), NULL);
|
g_return_val_if_fail (G_IS_ASYNC_RESULT (res), NULL);
|
||||||
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
||||||
|
|
||||||
g_warn_if_fail (g_simple_async_result_get_source_tag (simple) == g_dbus_proxy_invoke_method);
|
g_warn_if_fail (g_simple_async_result_get_source_tag (simple) == g_dbus_proxy_call);
|
||||||
|
|
||||||
value = NULL;
|
value = NULL;
|
||||||
|
|
||||||
@ -1497,11 +1497,11 @@ g_dbus_proxy_invoke_method_finish (GDBusProxy *proxy,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* g_dbus_proxy_invoke_method_sync:
|
* g_dbus_proxy_call_sync:
|
||||||
* @proxy: A #GDBusProxy.
|
* @proxy: A #GDBusProxy.
|
||||||
* @method_name: Name of method to invoke.
|
* @method_name: Name of method to invoke.
|
||||||
* @parameters: A #GVariant tuple with parameters for the signal or %NULL if not passing parameters.
|
* @parameters: A #GVariant tuple with parameters for the signal or %NULL if not passing parameters.
|
||||||
* @flags: Flags from the #GDBusInvokeMethodFlags enumeration.
|
* @flags: Flags from the #GDBusCallFlags enumeration.
|
||||||
* @timeout_msec: The timeout in milliseconds or -1 to use the proxy default timeout.
|
* @timeout_msec: The timeout in milliseconds or -1 to use the proxy default timeout.
|
||||||
* @cancellable: A #GCancellable or %NULL.
|
* @cancellable: A #GCancellable or %NULL.
|
||||||
* @error: Return location for error or %NULL.
|
* @error: Return location for error or %NULL.
|
||||||
@ -1520,7 +1520,7 @@ g_dbus_proxy_invoke_method_finish (GDBusProxy *proxy,
|
|||||||
* %G_IO_ERROR_INVALID_ARGUMENT.
|
* %G_IO_ERROR_INVALID_ARGUMENT.
|
||||||
*
|
*
|
||||||
* The calling thread is blocked until a reply is received. See
|
* The calling thread is blocked until a reply is received. See
|
||||||
* g_dbus_proxy_invoke_method() for the asynchronous version of this
|
* g_dbus_proxy_call() for the asynchronous version of this
|
||||||
* method.
|
* method.
|
||||||
*
|
*
|
||||||
* Returns: %NULL if @error is set. Otherwise a #GVariant tuple with
|
* Returns: %NULL if @error is set. Otherwise a #GVariant tuple with
|
||||||
@ -1529,10 +1529,10 @@ g_dbus_proxy_invoke_method_finish (GDBusProxy *proxy,
|
|||||||
* Since: 2.26
|
* Since: 2.26
|
||||||
*/
|
*/
|
||||||
GVariant *
|
GVariant *
|
||||||
g_dbus_proxy_invoke_method_sync (GDBusProxy *proxy,
|
g_dbus_proxy_call_sync (GDBusProxy *proxy,
|
||||||
const gchar *method_name,
|
const gchar *method_name,
|
||||||
GVariant *parameters,
|
GVariant *parameters,
|
||||||
GDBusInvokeMethodFlags flags,
|
GDBusCallFlags flags,
|
||||||
gint timeout_msec,
|
gint timeout_msec,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GError **error)
|
GError **error)
|
||||||
@ -1567,16 +1567,16 @@ g_dbus_proxy_invoke_method_sync (GDBusProxy *proxy,
|
|||||||
expected_method_info = NULL;
|
expected_method_info = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = g_dbus_connection_invoke_method_sync (proxy->priv->connection,
|
ret = g_dbus_connection_call_sync (proxy->priv->connection,
|
||||||
proxy->priv->unique_bus_name,
|
proxy->priv->unique_bus_name,
|
||||||
proxy->priv->object_path,
|
proxy->priv->object_path,
|
||||||
target_interface_name,
|
target_interface_name,
|
||||||
target_method_name,
|
target_method_name,
|
||||||
parameters,
|
parameters,
|
||||||
flags,
|
flags,
|
||||||
timeout_msec == -1 ? proxy->priv->timeout_msec : timeout_msec,
|
timeout_msec == -1 ? proxy->priv->timeout_msec : timeout_msec,
|
||||||
cancellable,
|
cancellable,
|
||||||
error);
|
error);
|
||||||
if (!validate_method_return (target_method_name, ret, expected_method_info, error))
|
if (!validate_method_return (target_method_name, ret, expected_method_info, error))
|
||||||
{
|
{
|
||||||
g_variant_unref (ret);
|
g_variant_unref (ret);
|
||||||
|
@ -126,21 +126,21 @@ GVariant *g_dbus_proxy_get_cached_property (GDBusProxy *pr
|
|||||||
GError **error);
|
GError **error);
|
||||||
gchar **g_dbus_proxy_get_cached_property_names (GDBusProxy *proxy,
|
gchar **g_dbus_proxy_get_cached_property_names (GDBusProxy *proxy,
|
||||||
GError **error);
|
GError **error);
|
||||||
void g_dbus_proxy_invoke_method (GDBusProxy *proxy,
|
void g_dbus_proxy_call (GDBusProxy *proxy,
|
||||||
const gchar *method_name,
|
const gchar *method_name,
|
||||||
GVariant *parameters,
|
GVariant *parameters,
|
||||||
GDBusInvokeMethodFlags flags,
|
GDBusCallFlags flags,
|
||||||
gint timeout_msec,
|
gint timeout_msec,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
GVariant *g_dbus_proxy_invoke_method_finish (GDBusProxy *proxy,
|
GVariant *g_dbus_proxy_call_finish (GDBusProxy *proxy,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
GError **error);
|
GError **error);
|
||||||
GVariant *g_dbus_proxy_invoke_method_sync (GDBusProxy *proxy,
|
GVariant *g_dbus_proxy_call_sync (GDBusProxy *proxy,
|
||||||
const gchar *method_name,
|
const gchar *method_name,
|
||||||
GVariant *parameters,
|
GVariant *parameters,
|
||||||
GDBusInvokeMethodFlags flags,
|
GDBusCallFlags flags,
|
||||||
gint timeout_msec,
|
gint timeout_msec,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
@ -994,7 +994,7 @@ g_bus_name_watcher_flags_get_type G_GNUC_CONST
|
|||||||
g_dbus_proxy_flags_get_type G_GNUC_CONST
|
g_dbus_proxy_flags_get_type G_GNUC_CONST
|
||||||
g_dbus_connection_flags_get_type G_GNUC_CONST
|
g_dbus_connection_flags_get_type G_GNUC_CONST
|
||||||
g_dbus_capability_flags_get_type G_GNUC_CONST
|
g_dbus_capability_flags_get_type G_GNUC_CONST
|
||||||
g_dbus_invoke_method_flags_get_type G_GNUC_CONST
|
g_dbus_call_flags_get_type G_GNUC_CONST
|
||||||
g_dbus_message_type_get_type G_GNUC_CONST
|
g_dbus_message_type_get_type G_GNUC_CONST
|
||||||
g_dbus_message_flags_get_type G_GNUC_CONST
|
g_dbus_message_flags_get_type G_GNUC_CONST
|
||||||
g_dbus_message_header_field_get_type G_GNUC_CONST
|
g_dbus_message_header_field_get_type G_GNUC_CONST
|
||||||
@ -1501,9 +1501,9 @@ g_dbus_connection_is_closed
|
|||||||
g_dbus_connection_set_exit_on_close
|
g_dbus_connection_set_exit_on_close
|
||||||
g_dbus_connection_close
|
g_dbus_connection_close
|
||||||
g_dbus_connection_emit_signal
|
g_dbus_connection_emit_signal
|
||||||
g_dbus_connection_invoke_method
|
g_dbus_connection_call
|
||||||
g_dbus_connection_invoke_method_finish
|
g_dbus_connection_call_finish
|
||||||
g_dbus_connection_invoke_method_sync
|
g_dbus_connection_call_sync
|
||||||
g_dbus_connection_signal_subscribe
|
g_dbus_connection_signal_subscribe
|
||||||
g_dbus_connection_signal_unsubscribe
|
g_dbus_connection_signal_unsubscribe
|
||||||
g_dbus_connection_add_filter
|
g_dbus_connection_add_filter
|
||||||
@ -1673,9 +1673,9 @@ g_dbus_proxy_get_object_path
|
|||||||
g_dbus_proxy_get_unique_bus_name
|
g_dbus_proxy_get_unique_bus_name
|
||||||
g_dbus_proxy_set_default_timeout
|
g_dbus_proxy_set_default_timeout
|
||||||
g_dbus_proxy_set_interface_info
|
g_dbus_proxy_set_interface_info
|
||||||
g_dbus_proxy_invoke_method
|
g_dbus_proxy_call
|
||||||
g_dbus_proxy_invoke_method_finish
|
g_dbus_proxy_call_finish
|
||||||
g_dbus_proxy_invoke_method_sync
|
g_dbus_proxy_call_sync
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -994,20 +994,20 @@ typedef enum {
|
|||||||
} GDBusCapabilityFlags;
|
} GDBusCapabilityFlags;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GDBusInvokeMethodFlags:
|
* GDBusCallFlags:
|
||||||
* @G_DBUS_INVOKE_METHOD_FLAGS_NONE: No flags set.
|
* @G_DBUS_CALL_FLAGS_NONE: No flags set.
|
||||||
* @G_DBUS_INVOKE_METHOD_FLAGS_NO_AUTO_START: The bus must not launch
|
* @G_DBUS_CALL_FLAGS_NO_AUTO_START: The bus must not launch
|
||||||
* an owner for the destination name in response to this method
|
* an owner for the destination name in response to this method
|
||||||
* invocation.
|
* invocation.
|
||||||
*
|
*
|
||||||
* Flags used in g_dbus_connection_invoke_method() and similar APIs.
|
* Flags used in g_dbus_connection_call() and similar APIs.
|
||||||
*
|
*
|
||||||
* Since: 2.26
|
* Since: 2.26
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE = 0,
|
G_DBUS_CALL_FLAGS_NONE = 0,
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NO_AUTO_START = (1<<0),
|
G_DBUS_CALL_FLAGS_NO_AUTO_START = (1<<0),
|
||||||
} GDBusInvokeMethodFlags;
|
} GDBusCallFlags;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GDBusMessageType:
|
* GDBusMessageType:
|
||||||
|
@ -118,9 +118,9 @@ msg_cb_expect_error_disconnected (GDBusConnection *connection,
|
|||||||
GVariant *result;
|
GVariant *result;
|
||||||
|
|
||||||
error = NULL;
|
error = NULL;
|
||||||
result = g_dbus_connection_invoke_method_finish (connection,
|
result = g_dbus_connection_call_finish (connection,
|
||||||
res,
|
res,
|
||||||
&error);
|
&error);
|
||||||
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_CLOSED);
|
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_CLOSED);
|
||||||
g_assert (!g_dbus_error_is_remote_error (error));
|
g_assert (!g_dbus_error_is_remote_error (error));
|
||||||
g_error_free (error);
|
g_error_free (error);
|
||||||
@ -138,9 +138,9 @@ msg_cb_expect_error_unknown_method (GDBusConnection *connection,
|
|||||||
GVariant *result;
|
GVariant *result;
|
||||||
|
|
||||||
error = NULL;
|
error = NULL;
|
||||||
result = g_dbus_connection_invoke_method_finish (connection,
|
result = g_dbus_connection_call_finish (connection,
|
||||||
res,
|
res,
|
||||||
&error);
|
&error);
|
||||||
g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD);
|
g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD);
|
||||||
g_assert (g_dbus_error_is_remote_error (error));
|
g_assert (g_dbus_error_is_remote_error (error));
|
||||||
g_assert (result == NULL);
|
g_assert (result == NULL);
|
||||||
@ -157,9 +157,9 @@ msg_cb_expect_success (GDBusConnection *connection,
|
|||||||
GVariant *result;
|
GVariant *result;
|
||||||
|
|
||||||
error = NULL;
|
error = NULL;
|
||||||
result = g_dbus_connection_invoke_method_finish (connection,
|
result = g_dbus_connection_call_finish (connection,
|
||||||
res,
|
res,
|
||||||
&error);
|
&error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert (result != NULL);
|
g_assert (result != NULL);
|
||||||
g_variant_unref (result);
|
g_variant_unref (result);
|
||||||
@ -176,9 +176,9 @@ msg_cb_expect_error_cancelled (GDBusConnection *connection,
|
|||||||
GVariant *result;
|
GVariant *result;
|
||||||
|
|
||||||
error = NULL;
|
error = NULL;
|
||||||
result = g_dbus_connection_invoke_method_finish (connection,
|
result = g_dbus_connection_call_finish (connection,
|
||||||
res,
|
res,
|
||||||
&error);
|
&error);
|
||||||
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_CANCELLED);
|
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_CANCELLED);
|
||||||
g_assert (!g_dbus_error_is_remote_error (error));
|
g_assert (!g_dbus_error_is_remote_error (error));
|
||||||
g_error_free (error);
|
g_error_free (error);
|
||||||
@ -196,9 +196,9 @@ msg_cb_expect_error_cancelled_2 (GDBusConnection *connection,
|
|||||||
GVariant *result;
|
GVariant *result;
|
||||||
|
|
||||||
error = NULL;
|
error = NULL;
|
||||||
result = g_dbus_connection_invoke_method_finish (connection,
|
result = g_dbus_connection_call_finish (connection,
|
||||||
res,
|
res,
|
||||||
&error);
|
&error);
|
||||||
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_CANCELLED);
|
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_CANCELLED);
|
||||||
g_assert (!g_dbus_error_is_remote_error (error));
|
g_assert (!g_dbus_error_is_remote_error (error));
|
||||||
g_error_free (error);
|
g_error_free (error);
|
||||||
@ -229,67 +229,67 @@ test_connection_send (void)
|
|||||||
*/
|
*/
|
||||||
ca = g_cancellable_new ();
|
ca = g_cancellable_new ();
|
||||||
g_cancellable_cancel (ca);
|
g_cancellable_cancel (ca);
|
||||||
g_dbus_connection_invoke_method (c,
|
g_dbus_connection_call (c,
|
||||||
"org.freedesktop.DBus", /* bus_name */
|
"org.freedesktop.DBus", /* bus_name */
|
||||||
"/org/freedesktop/DBus", /* object path */
|
"/org/freedesktop/DBus", /* object path */
|
||||||
"org.freedesktop.DBus", /* interface name */
|
"org.freedesktop.DBus", /* interface name */
|
||||||
"GetId", /* method name */
|
"GetId", /* method name */
|
||||||
NULL,
|
NULL,
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
-1,
|
-1,
|
||||||
ca,
|
ca,
|
||||||
(GAsyncReadyCallback) msg_cb_expect_error_cancelled,
|
(GAsyncReadyCallback) msg_cb_expect_error_cancelled,
|
||||||
NULL);
|
NULL);
|
||||||
g_main_loop_run (loop);
|
g_main_loop_run (loop);
|
||||||
g_object_unref (ca);
|
g_object_unref (ca);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check that we get a reply to the GetId() method call.
|
* Check that we get a reply to the GetId() method call.
|
||||||
*/
|
*/
|
||||||
g_dbus_connection_invoke_method (c,
|
g_dbus_connection_call (c,
|
||||||
"org.freedesktop.DBus", /* bus_name */
|
"org.freedesktop.DBus", /* bus_name */
|
||||||
"/org/freedesktop/DBus", /* object path */
|
"/org/freedesktop/DBus", /* object path */
|
||||||
"org.freedesktop.DBus", /* interface name */
|
"org.freedesktop.DBus", /* interface name */
|
||||||
"GetId", /* method name */
|
"GetId", /* method name */
|
||||||
NULL,
|
NULL,
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
-1,
|
-1,
|
||||||
NULL,
|
NULL,
|
||||||
(GAsyncReadyCallback) msg_cb_expect_success,
|
(GAsyncReadyCallback) msg_cb_expect_success,
|
||||||
NULL);
|
NULL);
|
||||||
g_main_loop_run (loop);
|
g_main_loop_run (loop);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check that we get an error reply to the NonExistantMethod() method call.
|
* Check that we get an error reply to the NonExistantMethod() method call.
|
||||||
*/
|
*/
|
||||||
g_dbus_connection_invoke_method (c,
|
g_dbus_connection_call (c,
|
||||||
"org.freedesktop.DBus", /* bus_name */
|
"org.freedesktop.DBus", /* bus_name */
|
||||||
"/org/freedesktop/DBus", /* object path */
|
"/org/freedesktop/DBus", /* object path */
|
||||||
"org.freedesktop.DBus", /* interface name */
|
"org.freedesktop.DBus", /* interface name */
|
||||||
"NonExistantMethod", /* method name */
|
"NonExistantMethod", /* method name */
|
||||||
NULL,
|
NULL,
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
-1,
|
-1,
|
||||||
NULL,
|
NULL,
|
||||||
(GAsyncReadyCallback) msg_cb_expect_error_unknown_method,
|
(GAsyncReadyCallback) msg_cb_expect_error_unknown_method,
|
||||||
NULL);
|
NULL);
|
||||||
g_main_loop_run (loop);
|
g_main_loop_run (loop);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check that cancellation works when the message is already in flight.
|
* Check that cancellation works when the message is already in flight.
|
||||||
*/
|
*/
|
||||||
ca = g_cancellable_new ();
|
ca = g_cancellable_new ();
|
||||||
g_dbus_connection_invoke_method (c,
|
g_dbus_connection_call (c,
|
||||||
"org.freedesktop.DBus", /* bus_name */
|
"org.freedesktop.DBus", /* bus_name */
|
||||||
"/org/freedesktop/DBus", /* object path */
|
"/org/freedesktop/DBus", /* object path */
|
||||||
"org.freedesktop.DBus", /* interface name */
|
"org.freedesktop.DBus", /* interface name */
|
||||||
"GetId", /* method name */
|
"GetId", /* method name */
|
||||||
NULL,
|
NULL,
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
-1,
|
-1,
|
||||||
ca,
|
ca,
|
||||||
(GAsyncReadyCallback) msg_cb_expect_error_cancelled_2,
|
(GAsyncReadyCallback) msg_cb_expect_error_cancelled_2,
|
||||||
NULL);
|
NULL);
|
||||||
g_cancellable_cancel (ca);
|
g_cancellable_cancel (ca);
|
||||||
g_main_loop_run (loop);
|
g_main_loop_run (loop);
|
||||||
g_object_unref (ca);
|
g_object_unref (ca);
|
||||||
@ -302,17 +302,17 @@ test_connection_send (void)
|
|||||||
_g_assert_signal_received (c, "closed");
|
_g_assert_signal_received (c, "closed");
|
||||||
g_assert (g_dbus_connection_is_closed (c));
|
g_assert (g_dbus_connection_is_closed (c));
|
||||||
|
|
||||||
g_dbus_connection_invoke_method (c,
|
g_dbus_connection_call (c,
|
||||||
"org.freedesktop.DBus", /* bus_name */
|
"org.freedesktop.DBus", /* bus_name */
|
||||||
"/org/freedesktop/DBus", /* object path */
|
"/org/freedesktop/DBus", /* object path */
|
||||||
"org.freedesktop.DBus", /* interface name */
|
"org.freedesktop.DBus", /* interface name */
|
||||||
"GetId", /* method name */
|
"GetId", /* method name */
|
||||||
NULL,
|
NULL,
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
-1,
|
-1,
|
||||||
NULL,
|
NULL,
|
||||||
(GAsyncReadyCallback) msg_cb_expect_error_disconnected,
|
(GAsyncReadyCallback) msg_cb_expect_error_disconnected,
|
||||||
NULL);
|
NULL);
|
||||||
g_main_loop_run (loop);
|
g_main_loop_run (loop);
|
||||||
|
|
||||||
_g_object_wait_for_single_ref (c);
|
_g_object_wait_for_single_ref (c);
|
||||||
@ -456,16 +456,16 @@ test_connection_signals (void)
|
|||||||
*
|
*
|
||||||
* To ensure this is not the case, do a synchronous call on c1.
|
* To ensure this is not the case, do a synchronous call on c1.
|
||||||
*/
|
*/
|
||||||
result = g_dbus_connection_invoke_method_sync (c1,
|
result = g_dbus_connection_call_sync (c1,
|
||||||
"org.freedesktop.DBus", /* bus name */
|
"org.freedesktop.DBus", /* bus name */
|
||||||
"/org/freedesktop/DBus", /* object path */
|
"/org/freedesktop/DBus", /* object path */
|
||||||
"org.freedesktop.DBus", /* interface name */
|
"org.freedesktop.DBus", /* interface name */
|
||||||
"GetId", /* method name */
|
"GetId", /* method name */
|
||||||
NULL, /* parameters */
|
NULL, /* parameters */
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
-1,
|
-1,
|
||||||
NULL,
|
NULL,
|
||||||
&error);
|
&error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert (result != NULL);
|
g_assert (result != NULL);
|
||||||
g_variant_unref (result);
|
g_variant_unref (result);
|
||||||
|
@ -287,16 +287,16 @@ main (int argc, char *argv[])
|
|||||||
g_dbus_connection_get_capabilities (connection) & G_DBUS_CAPABILITY_FLAGS_UNIX_FD_PASSING);
|
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));
|
greeting = g_strdup_printf ("Hey, it's %" G_GUINT64_FORMAT " already!", (guint64) time (NULL));
|
||||||
value = g_dbus_connection_invoke_method_sync (connection,
|
value = g_dbus_connection_call_sync (connection,
|
||||||
NULL, /* bus_name */
|
NULL, /* bus_name */
|
||||||
"/org/gtk/GDBus/TestObject",
|
"/org/gtk/GDBus/TestObject",
|
||||||
"org.gtk.GDBus.TestPeerInterface",
|
"org.gtk.GDBus.TestPeerInterface",
|
||||||
"HelloWorld",
|
"HelloWorld",
|
||||||
g_variant_new ("(s)", greeting),
|
g_variant_new ("(s)", greeting),
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
-1,
|
-1,
|
||||||
NULL,
|
NULL,
|
||||||
&error);
|
&error);
|
||||||
if (value == NULL)
|
if (value == NULL)
|
||||||
{
|
{
|
||||||
g_printerr ("Error invoking HelloWorld(): %s\n", error->message);
|
g_printerr ("Error invoking HelloWorld(): %s\n", error->message);
|
||||||
|
@ -320,7 +320,7 @@ introspect_callback (GDBusProxy *proxy,
|
|||||||
GError *error;
|
GError *error;
|
||||||
|
|
||||||
error = NULL;
|
error = NULL;
|
||||||
result = g_dbus_proxy_invoke_method_finish (proxy,
|
result = g_dbus_proxy_call_finish (proxy,
|
||||||
res,
|
res,
|
||||||
&error);
|
&error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
@ -359,14 +359,14 @@ get_nodes_at (GDBusConnection *c,
|
|||||||
|
|
||||||
/* do this async to avoid libdbus-1 deadlocks */
|
/* do this async to avoid libdbus-1 deadlocks */
|
||||||
xml_data = NULL;
|
xml_data = NULL;
|
||||||
g_dbus_proxy_invoke_method (proxy,
|
g_dbus_proxy_call (proxy,
|
||||||
"Introspect",
|
"Introspect",
|
||||||
NULL,
|
NULL,
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
-1,
|
-1,
|
||||||
NULL,
|
NULL,
|
||||||
(GAsyncReadyCallback) introspect_callback,
|
(GAsyncReadyCallback) introspect_callback,
|
||||||
&xml_data);
|
&xml_data);
|
||||||
g_main_loop_run (loop);
|
g_main_loop_run (loop);
|
||||||
g_assert (xml_data != NULL);
|
g_assert (xml_data != NULL);
|
||||||
|
|
||||||
@ -416,14 +416,14 @@ has_interface (GDBusConnection *c,
|
|||||||
|
|
||||||
/* do this async to avoid libdbus-1 deadlocks */
|
/* do this async to avoid libdbus-1 deadlocks */
|
||||||
xml_data = NULL;
|
xml_data = NULL;
|
||||||
g_dbus_proxy_invoke_method (proxy,
|
g_dbus_proxy_call (proxy,
|
||||||
"Introspect",
|
"Introspect",
|
||||||
NULL,
|
NULL,
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
-1,
|
-1,
|
||||||
NULL,
|
NULL,
|
||||||
(GAsyncReadyCallback) introspect_callback,
|
(GAsyncReadyCallback) introspect_callback,
|
||||||
&xml_data);
|
&xml_data);
|
||||||
g_main_loop_run (loop);
|
g_main_loop_run (loop);
|
||||||
g_assert (xml_data != NULL);
|
g_assert (xml_data != NULL);
|
||||||
|
|
||||||
@ -466,14 +466,14 @@ count_interfaces (GDBusConnection *c,
|
|||||||
|
|
||||||
/* do this async to avoid libdbus-1 deadlocks */
|
/* do this async to avoid libdbus-1 deadlocks */
|
||||||
xml_data = NULL;
|
xml_data = NULL;
|
||||||
g_dbus_proxy_invoke_method (proxy,
|
g_dbus_proxy_call (proxy,
|
||||||
"Introspect",
|
"Introspect",
|
||||||
NULL,
|
NULL,
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
-1,
|
-1,
|
||||||
NULL,
|
NULL,
|
||||||
(GAsyncReadyCallback) introspect_callback,
|
(GAsyncReadyCallback) introspect_callback,
|
||||||
&xml_data);
|
&xml_data);
|
||||||
g_main_loop_run (loop);
|
g_main_loop_run (loop);
|
||||||
g_assert (xml_data != NULL);
|
g_assert (xml_data != NULL);
|
||||||
|
|
||||||
@ -501,9 +501,9 @@ dyna_create_callback (GDBusProxy *proxy,
|
|||||||
GError *error;
|
GError *error;
|
||||||
|
|
||||||
error = NULL;
|
error = NULL;
|
||||||
result = g_dbus_proxy_invoke_method_finish (proxy,
|
result = g_dbus_proxy_call_finish (proxy,
|
||||||
res,
|
res,
|
||||||
&error);
|
&error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert (result != NULL);
|
g_assert (result != NULL);
|
||||||
g_variant_unref (result);
|
g_variant_unref (result);
|
||||||
@ -537,14 +537,14 @@ dyna_create (GDBusConnection *c,
|
|||||||
g_assert (proxy != NULL);
|
g_assert (proxy != NULL);
|
||||||
|
|
||||||
/* do this async to avoid libdbus-1 deadlocks */
|
/* do this async to avoid libdbus-1 deadlocks */
|
||||||
g_dbus_proxy_invoke_method (proxy,
|
g_dbus_proxy_call (proxy,
|
||||||
"DynaCyber",
|
"DynaCyber",
|
||||||
g_variant_new ("()"),
|
g_variant_new ("()"),
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
-1,
|
-1,
|
||||||
NULL,
|
NULL,
|
||||||
(GAsyncReadyCallback) dyna_create_callback,
|
(GAsyncReadyCallback) dyna_create_callback,
|
||||||
NULL);
|
NULL);
|
||||||
g_main_loop_run (loop);
|
g_main_loop_run (loop);
|
||||||
|
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
@ -760,26 +760,26 @@ test_dispatch_thread_func (gpointer user_data)
|
|||||||
|
|
||||||
/* generic interfaces */
|
/* generic interfaces */
|
||||||
error = NULL;
|
error = NULL;
|
||||||
value = g_dbus_proxy_invoke_method_sync (foo_proxy,
|
value = g_dbus_proxy_call_sync (foo_proxy,
|
||||||
"org.freedesktop.DBus.Peer.Ping",
|
"org.freedesktop.DBus.Peer.Ping",
|
||||||
NULL,
|
NULL,
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
-1,
|
-1,
|
||||||
NULL,
|
NULL,
|
||||||
&error);
|
&error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert (value != NULL);
|
g_assert (value != NULL);
|
||||||
g_variant_unref (value);
|
g_variant_unref (value);
|
||||||
|
|
||||||
/* user methods */
|
/* user methods */
|
||||||
error = NULL;
|
error = NULL;
|
||||||
value = g_dbus_proxy_invoke_method_sync (foo_proxy,
|
value = g_dbus_proxy_call_sync (foo_proxy,
|
||||||
"Method1",
|
"Method1",
|
||||||
g_variant_new ("(s)", "winwinwin"),
|
g_variant_new ("(s)", "winwinwin"),
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
-1,
|
-1,
|
||||||
NULL,
|
NULL,
|
||||||
&error);
|
&error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert (value != NULL);
|
g_assert (value != NULL);
|
||||||
g_assert (g_variant_is_of_type (value, G_VARIANT_TYPE ("(s)")));
|
g_assert (g_variant_is_of_type (value, G_VARIANT_TYPE ("(s)")));
|
||||||
@ -788,39 +788,39 @@ test_dispatch_thread_func (gpointer user_data)
|
|||||||
g_variant_unref (value);
|
g_variant_unref (value);
|
||||||
|
|
||||||
error = NULL;
|
error = NULL;
|
||||||
value = g_dbus_proxy_invoke_method_sync (foo_proxy,
|
value = g_dbus_proxy_call_sync (foo_proxy,
|
||||||
"Method2",
|
"Method2",
|
||||||
NULL,
|
NULL,
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
-1,
|
-1,
|
||||||
NULL,
|
NULL,
|
||||||
&error);
|
&error);
|
||||||
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_DBUS_ERROR);
|
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_DBUS_ERROR);
|
||||||
g_assert_cmpstr (error->message, ==, "GDBus.Error:org.example.SomeError: How do you like them apples, buddy!");
|
g_assert_cmpstr (error->message, ==, "GDBus.Error:org.example.SomeError: How do you like them apples, buddy!");
|
||||||
g_error_free (error);
|
g_error_free (error);
|
||||||
g_assert (value == NULL);
|
g_assert (value == NULL);
|
||||||
|
|
||||||
error = NULL;
|
error = NULL;
|
||||||
value = g_dbus_proxy_invoke_method_sync (foo_proxy,
|
value = g_dbus_proxy_call_sync (foo_proxy,
|
||||||
"Method2",
|
"Method2",
|
||||||
g_variant_new ("(s)", "failfailfail"),
|
g_variant_new ("(s)", "failfailfail"),
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
-1,
|
-1,
|
||||||
NULL,
|
NULL,
|
||||||
&error);
|
&error);
|
||||||
g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS);
|
g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS);
|
||||||
g_assert_cmpstr (error->message, ==, "GDBus.Error:org.freedesktop.DBus.Error.InvalidArgs: Signature of message, `s', does not match expected signature `'");
|
g_assert_cmpstr (error->message, ==, "GDBus.Error:org.freedesktop.DBus.Error.InvalidArgs: Signature of message, `s', does not match expected signature `'");
|
||||||
g_error_free (error);
|
g_error_free (error);
|
||||||
g_assert (value == NULL);
|
g_assert (value == NULL);
|
||||||
|
|
||||||
error = NULL;
|
error = NULL;
|
||||||
value = g_dbus_proxy_invoke_method_sync (foo_proxy,
|
value = g_dbus_proxy_call_sync (foo_proxy,
|
||||||
"NonExistantMethod",
|
"NonExistantMethod",
|
||||||
NULL,
|
NULL,
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
-1,
|
-1,
|
||||||
NULL,
|
NULL,
|
||||||
&error);
|
&error);
|
||||||
g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD);
|
g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD);
|
||||||
g_assert_cmpstr (error->message, ==, "GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such method `NonExistantMethod'");
|
g_assert_cmpstr (error->message, ==, "GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such method `NonExistantMethod'");
|
||||||
g_error_free (error);
|
g_error_free (error);
|
||||||
@ -828,15 +828,15 @@ test_dispatch_thread_func (gpointer user_data)
|
|||||||
|
|
||||||
/* user properties */
|
/* user properties */
|
||||||
error = NULL;
|
error = NULL;
|
||||||
value = g_dbus_proxy_invoke_method_sync (foo_proxy,
|
value = g_dbus_proxy_call_sync (foo_proxy,
|
||||||
"org.freedesktop.DBus.Properties.Get",
|
"org.freedesktop.DBus.Properties.Get",
|
||||||
g_variant_new ("(ss)",
|
g_variant_new ("(ss)",
|
||||||
"org.example.Foo",
|
"org.example.Foo",
|
||||||
"PropertyUno"),
|
"PropertyUno"),
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
-1,
|
-1,
|
||||||
NULL,
|
NULL,
|
||||||
&error);
|
&error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert (value != NULL);
|
g_assert (value != NULL);
|
||||||
g_assert (g_variant_is_of_type (value, G_VARIANT_TYPE ("(v)")));
|
g_assert (g_variant_is_of_type (value, G_VARIANT_TYPE ("(v)")));
|
||||||
@ -846,76 +846,76 @@ test_dispatch_thread_func (gpointer user_data)
|
|||||||
g_variant_unref (value);
|
g_variant_unref (value);
|
||||||
|
|
||||||
error = NULL;
|
error = NULL;
|
||||||
value = g_dbus_proxy_invoke_method_sync (foo_proxy,
|
value = g_dbus_proxy_call_sync (foo_proxy,
|
||||||
"org.freedesktop.DBus.Properties.Get",
|
"org.freedesktop.DBus.Properties.Get",
|
||||||
g_variant_new ("(ss)",
|
g_variant_new ("(ss)",
|
||||||
"org.example.Foo",
|
"org.example.Foo",
|
||||||
"ThisDoesntExist"),
|
"ThisDoesntExist"),
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
-1,
|
-1,
|
||||||
NULL,
|
NULL,
|
||||||
&error);
|
&error);
|
||||||
g_assert (value == NULL);
|
g_assert (value == NULL);
|
||||||
g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS);
|
g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS);
|
||||||
g_assert_cmpstr (error->message, ==, "GDBus.Error:org.freedesktop.DBus.Error.InvalidArgs: No such property `ThisDoesntExist'");
|
g_assert_cmpstr (error->message, ==, "GDBus.Error:org.freedesktop.DBus.Error.InvalidArgs: No such property `ThisDoesntExist'");
|
||||||
g_error_free (error);
|
g_error_free (error);
|
||||||
|
|
||||||
error = NULL;
|
error = NULL;
|
||||||
value = g_dbus_proxy_invoke_method_sync (foo_proxy,
|
value = g_dbus_proxy_call_sync (foo_proxy,
|
||||||
"org.freedesktop.DBus.Properties.Get",
|
"org.freedesktop.DBus.Properties.Get",
|
||||||
g_variant_new ("(ss)",
|
g_variant_new ("(ss)",
|
||||||
"org.example.Foo",
|
"org.example.Foo",
|
||||||
"NotReadable"),
|
"NotReadable"),
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
-1,
|
-1,
|
||||||
NULL,
|
NULL,
|
||||||
&error);
|
&error);
|
||||||
g_assert (value == NULL);
|
g_assert (value == NULL);
|
||||||
g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS);
|
g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS);
|
||||||
g_assert_cmpstr (error->message, ==, "GDBus.Error:org.freedesktop.DBus.Error.InvalidArgs: Property `NotReadable' is not readable");
|
g_assert_cmpstr (error->message, ==, "GDBus.Error:org.freedesktop.DBus.Error.InvalidArgs: Property `NotReadable' is not readable");
|
||||||
g_error_free (error);
|
g_error_free (error);
|
||||||
|
|
||||||
error = NULL;
|
error = NULL;
|
||||||
value = g_dbus_proxy_invoke_method_sync (foo_proxy,
|
value = g_dbus_proxy_call_sync (foo_proxy,
|
||||||
"org.freedesktop.DBus.Properties.Set",
|
"org.freedesktop.DBus.Properties.Set",
|
||||||
g_variant_new ("(ssv)",
|
g_variant_new ("(ssv)",
|
||||||
"org.example.Foo",
|
"org.example.Foo",
|
||||||
"NotReadable",
|
"NotReadable",
|
||||||
g_variant_new_string ("But Writable you are!")),
|
g_variant_new_string ("But Writable you are!")),
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
-1,
|
-1,
|
||||||
NULL,
|
NULL,
|
||||||
&error);
|
&error);
|
||||||
g_assert (value == NULL);
|
g_assert (value == NULL);
|
||||||
g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_SPAWN_FILE_INVALID);
|
g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_SPAWN_FILE_INVALID);
|
||||||
g_assert_cmpstr (error->message, ==, "GDBus.Error:org.freedesktop.DBus.Error.Spawn.FileInvalid: Returning some error instead of writing the value `NotReadable' to the property `'But Writable you are!''");
|
g_assert_cmpstr (error->message, ==, "GDBus.Error:org.freedesktop.DBus.Error.Spawn.FileInvalid: Returning some error instead of writing the value `NotReadable' to the property `'But Writable you are!''");
|
||||||
g_error_free (error);
|
g_error_free (error);
|
||||||
|
|
||||||
error = NULL;
|
error = NULL;
|
||||||
value = g_dbus_proxy_invoke_method_sync (foo_proxy,
|
value = g_dbus_proxy_call_sync (foo_proxy,
|
||||||
"org.freedesktop.DBus.Properties.Set",
|
"org.freedesktop.DBus.Properties.Set",
|
||||||
g_variant_new ("(ssv)",
|
g_variant_new ("(ssv)",
|
||||||
"org.example.Foo",
|
"org.example.Foo",
|
||||||
"NotWritable",
|
"NotWritable",
|
||||||
g_variant_new_uint32 (42)),
|
g_variant_new_uint32 (42)),
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
-1,
|
-1,
|
||||||
NULL,
|
NULL,
|
||||||
&error);
|
&error);
|
||||||
g_assert (value == NULL);
|
g_assert (value == NULL);
|
||||||
g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS);
|
g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS);
|
||||||
g_assert_cmpstr (error->message, ==, "GDBus.Error:org.freedesktop.DBus.Error.InvalidArgs: Property `NotWritable' is not writable");
|
g_assert_cmpstr (error->message, ==, "GDBus.Error:org.freedesktop.DBus.Error.InvalidArgs: Property `NotWritable' is not writable");
|
||||||
g_error_free (error);
|
g_error_free (error);
|
||||||
|
|
||||||
error = NULL;
|
error = NULL;
|
||||||
value = g_dbus_proxy_invoke_method_sync (foo_proxy,
|
value = g_dbus_proxy_call_sync (foo_proxy,
|
||||||
"org.freedesktop.DBus.Properties.GetAll",
|
"org.freedesktop.DBus.Properties.GetAll",
|
||||||
g_variant_new ("(s)",
|
g_variant_new ("(s)",
|
||||||
"org.example.Foo"),
|
"org.example.Foo"),
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
-1,
|
-1,
|
||||||
NULL,
|
NULL,
|
||||||
&error);
|
&error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert (value != NULL);
|
g_assert (value != NULL);
|
||||||
g_assert (g_variant_is_of_type (value, G_VARIANT_TYPE ("(a{sv})")));
|
g_assert (g_variant_is_of_type (value, G_VARIANT_TYPE ("(a{sv})")));
|
||||||
|
@ -53,13 +53,13 @@ introspection_on_proxy_appeared (GDBusConnection *connection,
|
|||||||
/*
|
/*
|
||||||
* Invoke Introspect(), then parse the output.
|
* Invoke Introspect(), then parse the output.
|
||||||
*/
|
*/
|
||||||
result = g_dbus_proxy_invoke_method_sync (proxy,
|
result = g_dbus_proxy_call_sync (proxy,
|
||||||
"org.freedesktop.DBus.Introspectable.Introspect",
|
"org.freedesktop.DBus.Introspectable.Introspect",
|
||||||
NULL,
|
NULL,
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
-1,
|
-1,
|
||||||
NULL,
|
NULL,
|
||||||
&error);
|
&error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert (result != NULL);
|
g_assert (result != NULL);
|
||||||
g_variant_get (result, "(s)", &xml_data);
|
g_variant_get (result, "(s)", &xml_data);
|
||||||
|
@ -170,16 +170,16 @@ test_bus_own_name (void)
|
|||||||
c = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
|
c = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
|
||||||
g_assert (c != NULL);
|
g_assert (c != NULL);
|
||||||
g_assert (!g_dbus_connection_is_closed (c));
|
g_assert (!g_dbus_connection_is_closed (c));
|
||||||
result = g_dbus_connection_invoke_method_sync (c,
|
result = g_dbus_connection_call_sync (c,
|
||||||
"org.freedesktop.DBus", /* bus name */
|
"org.freedesktop.DBus", /* bus name */
|
||||||
"/org/freedesktop/DBus", /* object path */
|
"/org/freedesktop/DBus", /* object path */
|
||||||
"org.freedesktop.DBus", /* interface name */
|
"org.freedesktop.DBus", /* interface name */
|
||||||
"NameHasOwner", /* method name */
|
"NameHasOwner", /* method name */
|
||||||
g_variant_new ("(s)", name),
|
g_variant_new ("(s)", name),
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
-1,
|
-1,
|
||||||
NULL,
|
NULL,
|
||||||
&error);
|
&error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert (result != NULL);
|
g_assert (result != NULL);
|
||||||
g_variant_get (result, "(b)", &name_has_owner_reply);
|
g_variant_get (result, "(b)", &name_has_owner_reply);
|
||||||
@ -195,16 +195,16 @@ test_bus_own_name (void)
|
|||||||
/*
|
/*
|
||||||
* Check that the name was actually released.
|
* Check that the name was actually released.
|
||||||
*/
|
*/
|
||||||
result = g_dbus_connection_invoke_method_sync (c,
|
result = g_dbus_connection_call_sync (c,
|
||||||
"org.freedesktop.DBus", /* bus name */
|
"org.freedesktop.DBus", /* bus name */
|
||||||
"/org/freedesktop/DBus", /* object path */
|
"/org/freedesktop/DBus", /* object path */
|
||||||
"org.freedesktop.DBus", /* interface name */
|
"org.freedesktop.DBus", /* interface name */
|
||||||
"NameHasOwner", /* method name */
|
"NameHasOwner", /* method name */
|
||||||
g_variant_new ("(s)", name),
|
g_variant_new ("(s)", name),
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
-1,
|
-1,
|
||||||
NULL,
|
NULL,
|
||||||
&error);
|
&error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert (result != NULL);
|
g_assert (result != NULL);
|
||||||
g_variant_get (result, "(b)", &name_has_owner_reply);
|
g_variant_get (result, "(b)", &name_has_owner_reply);
|
||||||
|
@ -537,13 +537,13 @@ test_peer (void)
|
|||||||
|
|
||||||
/* try invoking a method */
|
/* try invoking a method */
|
||||||
error = NULL;
|
error = NULL;
|
||||||
result = g_dbus_proxy_invoke_method_sync (proxy,
|
result = g_dbus_proxy_call_sync (proxy,
|
||||||
"HelloPeer",
|
"HelloPeer",
|
||||||
g_variant_new ("(s)", "Hey Peer!"),
|
g_variant_new ("(s)", "Hey Peer!"),
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
-1,
|
-1,
|
||||||
NULL, /* GCancellable */
|
NULL, /* GCancellable */
|
||||||
&error);
|
&error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_variant_get (result, "(s)", &s);
|
g_variant_get (result, "(s)", &s);
|
||||||
g_assert_cmpstr (s, ==, "You greeted me with 'Hey Peer!'.");
|
g_assert_cmpstr (s, ==, "You greeted me with 'Hey Peer!'.");
|
||||||
@ -556,14 +556,14 @@ test_peer (void)
|
|||||||
G_CALLBACK (on_proxy_signal_received),
|
G_CALLBACK (on_proxy_signal_received),
|
||||||
&data);
|
&data);
|
||||||
g_assert (!data.signal_received);
|
g_assert (!data.signal_received);
|
||||||
g_dbus_proxy_invoke_method (proxy,
|
g_dbus_proxy_call (proxy,
|
||||||
"EmitSignal",
|
"EmitSignal",
|
||||||
NULL, /* no arguments */
|
NULL, /* no arguments */
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
-1,
|
-1,
|
||||||
NULL, /* GCancellable */
|
NULL, /* GCancellable */
|
||||||
NULL, /* GAsyncReadyCallback - we don't care about the result */
|
NULL, /* GAsyncReadyCallback - we don't care about the result */
|
||||||
NULL); /* user_data */
|
NULL); /* user_data */
|
||||||
g_main_loop_run (loop);
|
g_main_loop_run (loop);
|
||||||
g_assert (data.signal_received);
|
g_assert (data.signal_received);
|
||||||
g_assert_cmpint (data.num_method_calls, ==, 2);
|
g_assert_cmpint (data.num_method_calls, ==, 2);
|
||||||
@ -679,13 +679,13 @@ test_peer (void)
|
|||||||
server = NULL;
|
server = NULL;
|
||||||
|
|
||||||
error = NULL;
|
error = NULL;
|
||||||
result = g_dbus_proxy_invoke_method_sync (proxy,
|
result = g_dbus_proxy_call_sync (proxy,
|
||||||
"HelloPeer",
|
"HelloPeer",
|
||||||
g_variant_new ("(s)", "Hey Again Peer!"),
|
g_variant_new ("(s)", "Hey Again Peer!"),
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
-1,
|
-1,
|
||||||
NULL, /* GCancellable */
|
NULL, /* GCancellable */
|
||||||
&error);
|
&error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_variant_get (result, "(s)", &s);
|
g_variant_get (result, "(s)", &s);
|
||||||
g_assert_cmpstr (s, ==, "You greeted me with 'Hey Again Peer!'.");
|
g_assert_cmpstr (s, ==, "You greeted me with 'Hey Again Peer!'.");
|
||||||
|
@ -46,13 +46,13 @@ test_methods (GDBusConnection *connection,
|
|||||||
|
|
||||||
/* check that we can invoke a method */
|
/* check that we can invoke a method */
|
||||||
error = NULL;
|
error = NULL;
|
||||||
result = g_dbus_proxy_invoke_method_sync (proxy,
|
result = g_dbus_proxy_call_sync (proxy,
|
||||||
"HelloWorld",
|
"HelloWorld",
|
||||||
g_variant_new ("(s)", "Hey"),
|
g_variant_new ("(s)", "Hey"),
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
-1,
|
-1,
|
||||||
NULL,
|
NULL,
|
||||||
&error);
|
&error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert (result != NULL);
|
g_assert (result != NULL);
|
||||||
g_assert_cmpstr (g_variant_get_type_string (result), ==, "(s)");
|
g_assert_cmpstr (g_variant_get_type_string (result), ==, "(s)");
|
||||||
@ -61,13 +61,13 @@ test_methods (GDBusConnection *connection,
|
|||||||
g_variant_unref (result);
|
g_variant_unref (result);
|
||||||
|
|
||||||
/* Check that we can completely recover the returned error */
|
/* Check that we can completely recover the returned error */
|
||||||
result = g_dbus_proxy_invoke_method_sync (proxy,
|
result = g_dbus_proxy_call_sync (proxy,
|
||||||
"HelloWorld",
|
"HelloWorld",
|
||||||
g_variant_new ("(s)", "Yo"),
|
g_variant_new ("(s)", "Yo"),
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
-1,
|
-1,
|
||||||
NULL,
|
NULL,
|
||||||
&error);
|
&error);
|
||||||
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_DBUS_ERROR);
|
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_DBUS_ERROR);
|
||||||
g_assert (g_dbus_error_is_remote_error (error));
|
g_assert (g_dbus_error_is_remote_error (error));
|
||||||
g_assert (g_dbus_error_is_remote_error (error));
|
g_assert (g_dbus_error_is_remote_error (error));
|
||||||
@ -81,13 +81,13 @@ test_methods (GDBusConnection *connection,
|
|||||||
|
|
||||||
/* Check that we get a timeout if the method handling is taking longer than timeout */
|
/* Check that we get a timeout if the method handling is taking longer than timeout */
|
||||||
error = NULL;
|
error = NULL;
|
||||||
result = g_dbus_proxy_invoke_method_sync (proxy,
|
result = g_dbus_proxy_call_sync (proxy,
|
||||||
"Sleep",
|
"Sleep",
|
||||||
g_variant_new ("(i)", 500 /* msec */),
|
g_variant_new ("(i)", 500 /* msec */),
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
100 /* msec */,
|
100 /* msec */,
|
||||||
NULL,
|
NULL,
|
||||||
&error);
|
&error);
|
||||||
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_TIMED_OUT);
|
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_TIMED_OUT);
|
||||||
g_assert (!g_dbus_error_is_remote_error (error));
|
g_assert (!g_dbus_error_is_remote_error (error));
|
||||||
g_assert (result == NULL);
|
g_assert (result == NULL);
|
||||||
@ -97,13 +97,13 @@ test_methods (GDBusConnection *connection,
|
|||||||
g_assert_cmpint (g_dbus_proxy_get_default_timeout (proxy), ==, -1);
|
g_assert_cmpint (g_dbus_proxy_get_default_timeout (proxy), ==, -1);
|
||||||
|
|
||||||
/* the default timeout is 25000 msec so this should work */
|
/* the default timeout is 25000 msec so this should work */
|
||||||
result = g_dbus_proxy_invoke_method_sync (proxy,
|
result = g_dbus_proxy_call_sync (proxy,
|
||||||
"Sleep",
|
"Sleep",
|
||||||
g_variant_new ("(i)", 500 /* msec */),
|
g_variant_new ("(i)", 500 /* msec */),
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
-1, /* use proxy default (e.g. -1 -> e.g. 25000 msec) */
|
-1, /* use proxy default (e.g. -1 -> e.g. 25000 msec) */
|
||||||
NULL,
|
NULL,
|
||||||
&error);
|
&error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert (result != NULL);
|
g_assert (result != NULL);
|
||||||
g_assert_cmpstr (g_variant_get_type_string (result), ==, "()");
|
g_assert_cmpstr (g_variant_get_type_string (result), ==, "()");
|
||||||
@ -112,13 +112,13 @@ test_methods (GDBusConnection *connection,
|
|||||||
/* now set the proxy-default timeout to 250 msec and try the 500 msec call - this should FAIL */
|
/* now set the proxy-default timeout to 250 msec and try the 500 msec call - this should FAIL */
|
||||||
g_dbus_proxy_set_default_timeout (proxy, 250);
|
g_dbus_proxy_set_default_timeout (proxy, 250);
|
||||||
g_assert_cmpint (g_dbus_proxy_get_default_timeout (proxy), ==, 250);
|
g_assert_cmpint (g_dbus_proxy_get_default_timeout (proxy), ==, 250);
|
||||||
result = g_dbus_proxy_invoke_method_sync (proxy,
|
result = g_dbus_proxy_call_sync (proxy,
|
||||||
"Sleep",
|
"Sleep",
|
||||||
g_variant_new ("(i)", 500 /* msec */),
|
g_variant_new ("(i)", 500 /* msec */),
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
-1, /* use proxy default (e.g. 250 msec) */
|
-1, /* use proxy default (e.g. 250 msec) */
|
||||||
NULL,
|
NULL,
|
||||||
&error);
|
&error);
|
||||||
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_TIMED_OUT);
|
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_TIMED_OUT);
|
||||||
g_assert (!g_dbus_error_is_remote_error (error));
|
g_assert (!g_dbus_error_is_remote_error (error));
|
||||||
g_assert (result == NULL);
|
g_assert (result == NULL);
|
||||||
@ -166,15 +166,15 @@ test_properties (GDBusConnection *connection,
|
|||||||
* is received. Also check that the cache is updated.
|
* is received. Also check that the cache is updated.
|
||||||
*/
|
*/
|
||||||
variant2 = g_variant_new_byte (42);
|
variant2 = g_variant_new_byte (42);
|
||||||
result = g_dbus_proxy_invoke_method_sync (proxy,
|
result = g_dbus_proxy_call_sync (proxy,
|
||||||
"FrobSetProperty",
|
"FrobSetProperty",
|
||||||
g_variant_new ("(sv)",
|
g_variant_new ("(sv)",
|
||||||
"y",
|
"y",
|
||||||
variant2),
|
variant2),
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
-1,
|
-1,
|
||||||
NULL,
|
NULL,
|
||||||
&error);
|
&error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert (result != NULL);
|
g_assert (result != NULL);
|
||||||
g_assert_cmpstr (g_variant_get_type_string (result), ==, "()");
|
g_assert_cmpstr (g_variant_get_type_string (result), ==, "()");
|
||||||
@ -222,9 +222,9 @@ test_proxy_signals_on_emit_signal_cb (GDBusProxy *proxy,
|
|||||||
GVariant *result;
|
GVariant *result;
|
||||||
|
|
||||||
error = NULL;
|
error = NULL;
|
||||||
result = g_dbus_proxy_invoke_method_finish (proxy,
|
result = g_dbus_proxy_call_finish (proxy,
|
||||||
res,
|
res,
|
||||||
&error);
|
&error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert (result != NULL);
|
g_assert (result != NULL);
|
||||||
g_assert_cmpstr (g_variant_get_type_string (result), ==, "()");
|
g_assert_cmpstr (g_variant_get_type_string (result), ==, "()");
|
||||||
@ -263,15 +263,15 @@ test_signals (GDBusConnection *connection,
|
|||||||
G_CALLBACK (test_proxy_signals_on_signal),
|
G_CALLBACK (test_proxy_signals_on_signal),
|
||||||
s);
|
s);
|
||||||
|
|
||||||
result = g_dbus_proxy_invoke_method_sync (proxy,
|
result = g_dbus_proxy_call_sync (proxy,
|
||||||
"EmitSignal",
|
"EmitSignal",
|
||||||
g_variant_new ("(so)",
|
g_variant_new ("(so)",
|
||||||
"Accept the next proposition you hear",
|
"Accept the next proposition you hear",
|
||||||
"/some/path"),
|
"/some/path"),
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
-1,
|
-1,
|
||||||
NULL,
|
NULL,
|
||||||
&error);
|
&error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert (result != NULL);
|
g_assert (result != NULL);
|
||||||
g_assert_cmpstr (g_variant_get_type_string (result), ==, "()");
|
g_assert_cmpstr (g_variant_get_type_string (result), ==, "()");
|
||||||
@ -296,16 +296,16 @@ test_signals (GDBusConnection *connection,
|
|||||||
"g-signal",
|
"g-signal",
|
||||||
G_CALLBACK (test_proxy_signals_on_signal),
|
G_CALLBACK (test_proxy_signals_on_signal),
|
||||||
s);
|
s);
|
||||||
g_dbus_proxy_invoke_method (proxy,
|
g_dbus_proxy_call (proxy,
|
||||||
"EmitSignal",
|
"EmitSignal",
|
||||||
g_variant_new ("(so)",
|
g_variant_new ("(so)",
|
||||||
"You will make a great programmer",
|
"You will make a great programmer",
|
||||||
"/some/other/path"),
|
"/some/other/path"),
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
-1,
|
-1,
|
||||||
NULL,
|
NULL,
|
||||||
(GAsyncReadyCallback) test_proxy_signals_on_emit_signal_cb,
|
(GAsyncReadyCallback) test_proxy_signals_on_emit_signal_cb,
|
||||||
&data);
|
&data);
|
||||||
g_main_loop_run (data.internal_loop);
|
g_main_loop_run (data.internal_loop);
|
||||||
g_main_loop_unref (data.internal_loop);
|
g_main_loop_unref (data.internal_loop);
|
||||||
g_assert_cmpstr (s->str,
|
g_assert_cmpstr (s->str,
|
||||||
@ -324,13 +324,13 @@ test_bogus_method_return (GDBusConnection *connection,
|
|||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
GVariant *result;
|
GVariant *result;
|
||||||
|
|
||||||
result = g_dbus_proxy_invoke_method_sync (proxy,
|
result = g_dbus_proxy_call_sync (proxy,
|
||||||
"PairReturn",
|
"PairReturn",
|
||||||
NULL,
|
NULL,
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
-1,
|
-1,
|
||||||
NULL,
|
NULL,
|
||||||
&error);
|
&error);
|
||||||
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT);
|
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT);
|
||||||
g_assert (result == NULL);
|
g_assert (result == NULL);
|
||||||
}
|
}
|
||||||
|
@ -52,9 +52,9 @@ msg_cb_expect_success (GDBusConnection *connection,
|
|||||||
GVariant *result;
|
GVariant *result;
|
||||||
|
|
||||||
error = NULL;
|
error = NULL;
|
||||||
result = g_dbus_connection_invoke_method_finish (connection,
|
result = g_dbus_connection_call_finish (connection,
|
||||||
res,
|
res,
|
||||||
&error);
|
&error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert (result != NULL);
|
g_assert (result != NULL);
|
||||||
g_variant_unref (result);
|
g_variant_unref (result);
|
||||||
@ -74,9 +74,9 @@ msg_cb_expect_error_cancelled (GDBusConnection *connection,
|
|||||||
GVariant *result;
|
GVariant *result;
|
||||||
|
|
||||||
error = NULL;
|
error = NULL;
|
||||||
result = g_dbus_connection_invoke_method_finish (connection,
|
result = g_dbus_connection_call_finish (connection,
|
||||||
res,
|
res,
|
||||||
&error);
|
&error);
|
||||||
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_CANCELLED);
|
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_CANCELLED);
|
||||||
g_assert (!g_dbus_error_is_remote_error (error));
|
g_assert (!g_dbus_error_is_remote_error (error));
|
||||||
g_error_free (error);
|
g_error_free (error);
|
||||||
@ -131,17 +131,17 @@ test_delivery_in_thread_func (gpointer _data)
|
|||||||
/*
|
/*
|
||||||
* Check that we get a reply to the GetId() method call.
|
* Check that we get a reply to the GetId() method call.
|
||||||
*/
|
*/
|
||||||
g_dbus_connection_invoke_method (c,
|
g_dbus_connection_call (c,
|
||||||
"org.freedesktop.DBus", /* bus_name */
|
"org.freedesktop.DBus", /* bus_name */
|
||||||
"/org/freedesktop/DBus", /* object path */
|
"/org/freedesktop/DBus", /* object path */
|
||||||
"org.freedesktop.DBus", /* interface name */
|
"org.freedesktop.DBus", /* interface name */
|
||||||
"GetId", /* method name */
|
"GetId", /* method name */
|
||||||
NULL,
|
NULL,
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
-1,
|
-1,
|
||||||
NULL,
|
NULL,
|
||||||
(GAsyncReadyCallback) msg_cb_expect_success,
|
(GAsyncReadyCallback) msg_cb_expect_success,
|
||||||
&data);
|
&data);
|
||||||
g_main_loop_run (thread_loop);
|
g_main_loop_run (thread_loop);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -151,17 +151,17 @@ test_delivery_in_thread_func (gpointer _data)
|
|||||||
*/
|
*/
|
||||||
ca = g_cancellable_new ();
|
ca = g_cancellable_new ();
|
||||||
g_cancellable_cancel (ca);
|
g_cancellable_cancel (ca);
|
||||||
g_dbus_connection_invoke_method (c,
|
g_dbus_connection_call (c,
|
||||||
"org.freedesktop.DBus", /* bus_name */
|
"org.freedesktop.DBus", /* bus_name */
|
||||||
"/org/freedesktop/DBus", /* object path */
|
"/org/freedesktop/DBus", /* object path */
|
||||||
"org.freedesktop.DBus", /* interface name */
|
"org.freedesktop.DBus", /* interface name */
|
||||||
"GetId", /* method name */
|
"GetId", /* method name */
|
||||||
NULL,
|
NULL,
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
-1,
|
-1,
|
||||||
ca,
|
ca,
|
||||||
(GAsyncReadyCallback) msg_cb_expect_error_cancelled,
|
(GAsyncReadyCallback) msg_cb_expect_error_cancelled,
|
||||||
&data);
|
&data);
|
||||||
g_main_loop_run (thread_loop);
|
g_main_loop_run (thread_loop);
|
||||||
g_object_unref (ca);
|
g_object_unref (ca);
|
||||||
|
|
||||||
@ -169,17 +169,17 @@ test_delivery_in_thread_func (gpointer _data)
|
|||||||
* Check that cancellation works when the message is already in flight.
|
* Check that cancellation works when the message is already in flight.
|
||||||
*/
|
*/
|
||||||
ca = g_cancellable_new ();
|
ca = g_cancellable_new ();
|
||||||
g_dbus_connection_invoke_method (c,
|
g_dbus_connection_call (c,
|
||||||
"org.freedesktop.DBus", /* bus_name */
|
"org.freedesktop.DBus", /* bus_name */
|
||||||
"/org/freedesktop/DBus", /* object path */
|
"/org/freedesktop/DBus", /* object path */
|
||||||
"org.freedesktop.DBus", /* interface name */
|
"org.freedesktop.DBus", /* interface name */
|
||||||
"GetId", /* method name */
|
"GetId", /* method name */
|
||||||
NULL,
|
NULL,
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
-1,
|
-1,
|
||||||
ca,
|
ca,
|
||||||
(GAsyncReadyCallback) msg_cb_expect_error_cancelled,
|
(GAsyncReadyCallback) msg_cb_expect_error_cancelled,
|
||||||
&data);
|
&data);
|
||||||
g_cancellable_cancel (ca);
|
g_cancellable_cancel (ca);
|
||||||
g_main_loop_run (thread_loop);
|
g_main_loop_run (thread_loop);
|
||||||
g_object_unref (ca);
|
g_object_unref (ca);
|
||||||
@ -269,9 +269,9 @@ sleep_cb (GDBusProxy *proxy,
|
|||||||
GVariant *result;
|
GVariant *result;
|
||||||
|
|
||||||
error = NULL;
|
error = NULL;
|
||||||
result = g_dbus_proxy_invoke_method_finish (proxy,
|
result = g_dbus_proxy_call_finish (proxy,
|
||||||
res,
|
res,
|
||||||
&error);
|
&error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert (result != NULL);
|
g_assert (result != NULL);
|
||||||
g_assert_cmpstr (g_variant_get_type_string (result), ==, "()");
|
g_assert_cmpstr (g_variant_get_type_string (result), ==, "()");
|
||||||
@ -302,14 +302,14 @@ test_sleep_in_thread_func (gpointer _data)
|
|||||||
if (data->async)
|
if (data->async)
|
||||||
{
|
{
|
||||||
//g_debug ("invoking async (%p)", g_thread_self ());
|
//g_debug ("invoking async (%p)", g_thread_self ());
|
||||||
g_dbus_proxy_invoke_method (data->proxy,
|
g_dbus_proxy_call (data->proxy,
|
||||||
"Sleep",
|
"Sleep",
|
||||||
g_variant_new ("(i)", data->msec),
|
g_variant_new ("(i)", data->msec),
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
-1,
|
-1,
|
||||||
NULL,
|
NULL,
|
||||||
(GAsyncReadyCallback) sleep_cb,
|
(GAsyncReadyCallback) sleep_cb,
|
||||||
data);
|
data);
|
||||||
g_main_loop_run (data->thread_loop);
|
g_main_loop_run (data->thread_loop);
|
||||||
g_print ("A");
|
g_print ("A");
|
||||||
//g_debug ("done invoking async (%p)", g_thread_self ());
|
//g_debug ("done invoking async (%p)", g_thread_self ());
|
||||||
@ -321,13 +321,13 @@ test_sleep_in_thread_func (gpointer _data)
|
|||||||
|
|
||||||
error = NULL;
|
error = NULL;
|
||||||
//g_debug ("invoking sync (%p)", g_thread_self ());
|
//g_debug ("invoking sync (%p)", g_thread_self ());
|
||||||
result = g_dbus_proxy_invoke_method_sync (data->proxy,
|
result = g_dbus_proxy_call_sync (data->proxy,
|
||||||
"Sleep",
|
"Sleep",
|
||||||
g_variant_new ("(i)", data->msec),
|
g_variant_new ("(i)", data->msec),
|
||||||
G_DBUS_INVOKE_METHOD_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
-1,
|
-1,
|
||||||
NULL,
|
NULL,
|
||||||
&error);
|
&error);
|
||||||
g_print ("S");
|
g_print ("S");
|
||||||
//g_debug ("done invoking sync (%p)", g_thread_self ());
|
//g_debug ("done invoking sync (%p)", g_thread_self ());
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user