mirror of
				https://gitlab.gnome.org/GNOME/glib.git
				synced 2025-11-04 01:58:54 +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:
		@@ -2361,10 +2361,10 @@ g_dbus_connection_get_guid
 | 
			
		||||
g_dbus_connection_get_unique_name
 | 
			
		||||
g_dbus_connection_get_capabilities
 | 
			
		||||
g_dbus_connection_get_peer_credentials
 | 
			
		||||
GDBusInvokeMethodFlags
 | 
			
		||||
g_dbus_connection_invoke_method
 | 
			
		||||
g_dbus_connection_invoke_method_finish
 | 
			
		||||
g_dbus_connection_invoke_method_sync
 | 
			
		||||
GDBusCallFlags
 | 
			
		||||
g_dbus_connection_call
 | 
			
		||||
g_dbus_connection_call_finish
 | 
			
		||||
g_dbus_connection_call_sync
 | 
			
		||||
g_dbus_connection_emit_signal
 | 
			
		||||
GDBusSignalCallback
 | 
			
		||||
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_set_interface_info
 | 
			
		||||
g_dbus_proxy_get_interface_info
 | 
			
		||||
g_dbus_proxy_invoke_method
 | 
			
		||||
g_dbus_proxy_invoke_method_finish
 | 
			
		||||
g_dbus_proxy_invoke_method_sync
 | 
			
		||||
g_dbus_proxy_call
 | 
			
		||||
g_dbus_proxy_call_finish
 | 
			
		||||
g_dbus_proxy_call_sync
 | 
			
		||||
<SUBSECTION Standard>
 | 
			
		||||
G_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_object_type_install_info()</entry><entry>introspection data is installed while registering
 | 
			
		||||
               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_end_call()</entry><entry>g_dbus_proxy_invoke_method_finish()</entry></row>
 | 
			
		||||
          <row><entry>dbus_g_proxy_call()</entry><entry>g_dbus_proxy_invoke_method_sync()</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_call_finish()</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_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>
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										160
									
								
								gio/gdbus-tool.c
									
									
									
									
									
								
							
							
						
						
									
										160
									
								
								gio/gdbus-tool.c
									
									
									
									
									
								
							@@ -143,16 +143,16 @@ print_methods (GDBusConnection *c,
 | 
			
		||||
  guint m;
 | 
			
		||||
 | 
			
		||||
  error = NULL;
 | 
			
		||||
  result = g_dbus_connection_invoke_method_sync (c,
 | 
			
		||||
                                                 name,
 | 
			
		||||
                                                 path,
 | 
			
		||||
                                                 "org.freedesktop.DBus.Introspectable",
 | 
			
		||||
                                                 "Introspect",
 | 
			
		||||
                                                 NULL,
 | 
			
		||||
                                                 G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                                                 3000, /* 3 secs */
 | 
			
		||||
                                                 NULL,
 | 
			
		||||
                                                 &error);
 | 
			
		||||
  result = g_dbus_connection_call_sync (c,
 | 
			
		||||
                                        name,
 | 
			
		||||
                                        path,
 | 
			
		||||
                                        "org.freedesktop.DBus.Introspectable",
 | 
			
		||||
                                        "Introspect",
 | 
			
		||||
                                        NULL,
 | 
			
		||||
                                        G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                                        3000, /* 3 secs */
 | 
			
		||||
                                        NULL,
 | 
			
		||||
                                        &error);
 | 
			
		||||
  if (result == NULL)
 | 
			
		||||
    {
 | 
			
		||||
      g_printerr (_("Error: %s\n"), error->message);
 | 
			
		||||
@@ -205,16 +205,16 @@ print_paths (GDBusConnection *c,
 | 
			
		||||
  guint n;
 | 
			
		||||
 | 
			
		||||
  error = NULL;
 | 
			
		||||
  result = g_dbus_connection_invoke_method_sync (c,
 | 
			
		||||
                                                 name,
 | 
			
		||||
                                                 path,
 | 
			
		||||
                                                 "org.freedesktop.DBus.Introspectable",
 | 
			
		||||
                                                 "Introspect",
 | 
			
		||||
                                                 NULL,
 | 
			
		||||
                                                 G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                                                 3000, /* 3 secs */
 | 
			
		||||
                                                 NULL,
 | 
			
		||||
                                                 &error);
 | 
			
		||||
  result = g_dbus_connection_call_sync (c,
 | 
			
		||||
                                        name,
 | 
			
		||||
                                        path,
 | 
			
		||||
                                        "org.freedesktop.DBus.Introspectable",
 | 
			
		||||
                                        "Introspect",
 | 
			
		||||
                                        NULL,
 | 
			
		||||
                                        G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                                        3000, /* 3 secs */
 | 
			
		||||
                                        NULL,
 | 
			
		||||
                                        &error);
 | 
			
		||||
  if (result == NULL)
 | 
			
		||||
    {
 | 
			
		||||
      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);
 | 
			
		||||
 | 
			
		||||
  error = NULL;
 | 
			
		||||
  result = g_dbus_connection_invoke_method_sync (c,
 | 
			
		||||
                                                 "org.freedesktop.DBus",
 | 
			
		||||
                                                 "/org/freedesktop/DBus",
 | 
			
		||||
                                                 "org.freedesktop.DBus",
 | 
			
		||||
                                                 "ListNames",
 | 
			
		||||
                                                 NULL,
 | 
			
		||||
                                                 G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                                                 3000, /* 3 secs */
 | 
			
		||||
                                                 NULL,
 | 
			
		||||
                                                 &error);
 | 
			
		||||
  result = g_dbus_connection_call_sync (c,
 | 
			
		||||
                                        "org.freedesktop.DBus",
 | 
			
		||||
                                        "/org/freedesktop/DBus",
 | 
			
		||||
                                        "org.freedesktop.DBus",
 | 
			
		||||
                                        "ListNames",
 | 
			
		||||
                                        NULL,
 | 
			
		||||
                                        G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                                        3000, /* 3 secs */
 | 
			
		||||
                                        NULL,
 | 
			
		||||
                                        &error);
 | 
			
		||||
  if (result == NULL)
 | 
			
		||||
    {
 | 
			
		||||
      g_printerr (_("Error: %s\n"), error->message);
 | 
			
		||||
@@ -312,16 +312,16 @@ print_names (GDBusConnection *c,
 | 
			
		||||
  g_variant_unref (result);
 | 
			
		||||
 | 
			
		||||
  error = NULL;
 | 
			
		||||
  result = g_dbus_connection_invoke_method_sync (c,
 | 
			
		||||
                                                 "org.freedesktop.DBus",
 | 
			
		||||
                                                 "/org/freedesktop/DBus",
 | 
			
		||||
                                                 "org.freedesktop.DBus",
 | 
			
		||||
                                                 "ListActivatableNames",
 | 
			
		||||
                                                 NULL,
 | 
			
		||||
                                                 G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                                                 3000, /* 3 secs */
 | 
			
		||||
                                                 NULL,
 | 
			
		||||
                                                 &error);
 | 
			
		||||
  result = g_dbus_connection_call_sync (c,
 | 
			
		||||
                                        "org.freedesktop.DBus",
 | 
			
		||||
                                        "/org/freedesktop/DBus",
 | 
			
		||||
                                        "org.freedesktop.DBus",
 | 
			
		||||
                                        "ListActivatableNames",
 | 
			
		||||
                                        NULL,
 | 
			
		||||
                                        G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                                        3000, /* 3 secs */
 | 
			
		||||
                                        NULL,
 | 
			
		||||
                                        &error);
 | 
			
		||||
  if (result == NULL)
 | 
			
		||||
    {
 | 
			
		||||
      g_printerr (_("Error: %s\n"), error->message);
 | 
			
		||||
@@ -453,16 +453,16 @@ call_helper_get_method_in_signature (GDBusConnection  *c,
 | 
			
		||||
  result = NULL;
 | 
			
		||||
  node_info = NULL;
 | 
			
		||||
 | 
			
		||||
  result = g_dbus_connection_invoke_method_sync (c,
 | 
			
		||||
                                                 dest,
 | 
			
		||||
                                                 path,
 | 
			
		||||
                                                 "org.freedesktop.DBus.Introspectable",
 | 
			
		||||
                                                 "Introspect",
 | 
			
		||||
                                                 NULL,
 | 
			
		||||
                                                 G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                                                 3000, /* 3 secs */
 | 
			
		||||
                                                 NULL,
 | 
			
		||||
                                                 error);
 | 
			
		||||
  result = g_dbus_connection_call_sync (c,
 | 
			
		||||
                                        dest,
 | 
			
		||||
                                        path,
 | 
			
		||||
                                        "org.freedesktop.DBus.Introspectable",
 | 
			
		||||
                                        "Introspect",
 | 
			
		||||
                                        NULL,
 | 
			
		||||
                                        G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                                        3000, /* 3 secs */
 | 
			
		||||
                                        NULL,
 | 
			
		||||
                                        error);
 | 
			
		||||
  if (result == NULL)
 | 
			
		||||
    goto out;
 | 
			
		||||
 | 
			
		||||
@@ -825,16 +825,16 @@ handle_call (gint        *argc,
 | 
			
		||||
 | 
			
		||||
  if (parameters != NULL)
 | 
			
		||||
    parameters = g_variant_ref_sink (parameters);
 | 
			
		||||
  result = g_dbus_connection_invoke_method_sync (c,
 | 
			
		||||
                                                 opt_call_dest,
 | 
			
		||||
                                                 opt_call_object_path,
 | 
			
		||||
                                                 interface_name,
 | 
			
		||||
                                                 method_name,
 | 
			
		||||
                                                 parameters,
 | 
			
		||||
                                                 G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                                                 -1,
 | 
			
		||||
                                                 NULL,
 | 
			
		||||
                                                 &error);
 | 
			
		||||
  result = g_dbus_connection_call_sync (c,
 | 
			
		||||
                                        opt_call_dest,
 | 
			
		||||
                                        opt_call_object_path,
 | 
			
		||||
                                        interface_name,
 | 
			
		||||
                                        method_name,
 | 
			
		||||
                                        parameters,
 | 
			
		||||
                                        G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                                        -1,
 | 
			
		||||
                                        NULL,
 | 
			
		||||
                                        &error);
 | 
			
		||||
  if (result == NULL)
 | 
			
		||||
    {
 | 
			
		||||
      g_printerr (_("Error: %s\n"), error->message);
 | 
			
		||||
@@ -1011,16 +1011,16 @@ dump_interface (GDBusConnection          *c,
 | 
			
		||||
  if (c != NULL && name != NULL && object_path != NULL)
 | 
			
		||||
    {
 | 
			
		||||
      GVariant *result;
 | 
			
		||||
      result = g_dbus_connection_invoke_method_sync (c,
 | 
			
		||||
                                                     name,
 | 
			
		||||
                                                     object_path,
 | 
			
		||||
                                                     "org.freedesktop.DBus.Properties",
 | 
			
		||||
                                                     "GetAll",
 | 
			
		||||
                                                     g_variant_new ("(s)", o->name),
 | 
			
		||||
                                                     G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                                                     3000,
 | 
			
		||||
                                                     NULL,
 | 
			
		||||
                                                     NULL);
 | 
			
		||||
      result = g_dbus_connection_call_sync (c,
 | 
			
		||||
                                            name,
 | 
			
		||||
                                            object_path,
 | 
			
		||||
                                            "org.freedesktop.DBus.Properties",
 | 
			
		||||
                                            "GetAll",
 | 
			
		||||
                                            g_variant_new ("(s)", o->name),
 | 
			
		||||
                                            G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                                            3000,
 | 
			
		||||
                                            NULL,
 | 
			
		||||
                                            NULL);
 | 
			
		||||
      if (result != NULL)
 | 
			
		||||
        {
 | 
			
		||||
          if (g_variant_is_of_type (result, G_VARIANT_TYPE ("(a{sv})")))
 | 
			
		||||
@@ -1259,16 +1259,16 @@ handle_introspect (gint        *argc,
 | 
			
		||||
  if (request_completion)
 | 
			
		||||
    goto out;
 | 
			
		||||
 | 
			
		||||
  result = g_dbus_connection_invoke_method_sync (c,
 | 
			
		||||
                                                 opt_introspect_dest,
 | 
			
		||||
                                                 opt_introspect_object_path,
 | 
			
		||||
                                                 "org.freedesktop.DBus.Introspectable",
 | 
			
		||||
                                                 "Introspect",
 | 
			
		||||
                                                 NULL,
 | 
			
		||||
                                                 G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                                                 3000, /* 3 sec */
 | 
			
		||||
                                                 NULL,
 | 
			
		||||
                                                 &error);
 | 
			
		||||
  result = g_dbus_connection_call_sync (c,
 | 
			
		||||
                                        opt_introspect_dest,
 | 
			
		||||
                                        opt_introspect_object_path,
 | 
			
		||||
                                        "org.freedesktop.DBus.Introspectable",
 | 
			
		||||
                                        "Introspect",
 | 
			
		||||
                                        NULL,
 | 
			
		||||
                                        G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                                        3000, /* 3 sec */
 | 
			
		||||
                                        NULL,
 | 
			
		||||
                                        &error);
 | 
			
		||||
  if (result == NULL)
 | 
			
		||||
    {
 | 
			
		||||
      g_printerr (_("Error: %s\n"), error->message);
 | 
			
		||||
 
 | 
			
		||||
@@ -351,7 +351,7 @@ mechanism_client_initiate (GDBusAuthMechanism   *mechanism,
 | 
			
		||||
 | 
			
		||||
  /* return the uid */
 | 
			
		||||
#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)
 | 
			
		||||
  initial_response = g_strdup_printf ("%s", g_credentials_get_windows_user ());
 | 
			
		||||
#else
 | 
			
		||||
 
 | 
			
		||||
@@ -1802,16 +1802,16 @@ initable_init (GInitable     *initable,
 | 
			
		||||
      GVariant *hello_result;
 | 
			
		||||
      const gchar *s;
 | 
			
		||||
 | 
			
		||||
      hello_result = g_dbus_connection_invoke_method_sync (connection,
 | 
			
		||||
                                                           "org.freedesktop.DBus", /* name */
 | 
			
		||||
                                                           "/org/freedesktop/DBus", /* path */
 | 
			
		||||
                                                           "org.freedesktop.DBus", /* interface */
 | 
			
		||||
                                                           "Hello",
 | 
			
		||||
                                                           NULL, /* parameters */
 | 
			
		||||
                                                           G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                                                           -1,
 | 
			
		||||
                                                           NULL, /* TODO: cancellable */
 | 
			
		||||
                                                           &connection->priv->initialization_error);
 | 
			
		||||
      hello_result = g_dbus_connection_call_sync (connection,
 | 
			
		||||
                                                  "org.freedesktop.DBus", /* name */
 | 
			
		||||
                                                  "/org/freedesktop/DBus", /* path */
 | 
			
		||||
                                                  "org.freedesktop.DBus", /* interface */
 | 
			
		||||
                                                  "Hello",
 | 
			
		||||
                                                  NULL, /* parameters */
 | 
			
		||||
                                                  G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                                                  -1,
 | 
			
		||||
                                                  NULL, /* TODO: cancellable */
 | 
			
		||||
                                                  &connection->priv->initialization_error);
 | 
			
		||||
      if (hello_result == NULL)
 | 
			
		||||
        goto out;
 | 
			
		||||
 | 
			
		||||
@@ -2274,7 +2274,7 @@ static guint _global_filter_id = 1;
 | 
			
		||||
 * worker thread. Also note that filters are rarely needed - use API
 | 
			
		||||
 * such as g_dbus_connection_send_message_with_reply(),
 | 
			
		||||
 * 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
 | 
			
		||||
 * g_dbus_connection_remove_filter().
 | 
			
		||||
@@ -3646,7 +3646,7 @@ handle_introspect (GDBusConnection *connection,
 | 
			
		||||
 | 
			
		||||
/* called in thread where object was registered - no locks held */
 | 
			
		||||
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);
 | 
			
		||||
  GDBusInterfaceVTable *vtable;
 | 
			
		||||
@@ -3753,7 +3753,7 @@ validate_and_maybe_schedule_method_call (GDBusConnection            *connection,
 | 
			
		||||
  idle_source = g_idle_source_new ();
 | 
			
		||||
  g_source_set_priority (idle_source, G_PRIORITY_DEFAULT);
 | 
			
		||||
  g_source_set_callback (idle_source,
 | 
			
		||||
                         invoke_method_in_idle_cb,
 | 
			
		||||
                         call_in_idle_cb,
 | 
			
		||||
                         invocation,
 | 
			
		||||
                         g_object_unref);
 | 
			
		||||
  g_source_attach (idle_source, main_context);
 | 
			
		||||
@@ -4068,22 +4068,22 @@ g_dbus_connection_emit_signal (GDBusConnection  *connection,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
add_invoke_method_flags (GDBusMessage           *message,
 | 
			
		||||
                         GDBusInvokeMethodFlags  flags)
 | 
			
		||||
add_call_flags (GDBusMessage           *message,
 | 
			
		||||
                         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_connection_invoke_method:
 | 
			
		||||
 * g_dbus_connection_call:
 | 
			
		||||
 * @connection: A #GDBusConnection.
 | 
			
		||||
 * @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.
 | 
			
		||||
 * @interface_name: D-Bus interface to invoke method on.
 | 
			
		||||
 * @method_name: The name of the method to invoke.
 | 
			
		||||
 * @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.
 | 
			
		||||
 * @cancellable: A #GCancellable or %NULL.
 | 
			
		||||
 * @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
 | 
			
		||||
 * 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
 | 
			
		||||
 * g_dbus_connection_invoke_method_finish() to get the result of the operation.
 | 
			
		||||
 * See g_dbus_connection_invoke_method_sync() for the synchronous version of this
 | 
			
		||||
 * g_dbus_connection_call_finish() to get the result of the operation.
 | 
			
		||||
 * See g_dbus_connection_call_sync() for the synchronous version of this
 | 
			
		||||
 * function.
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 2.26
 | 
			
		||||
 */
 | 
			
		||||
void
 | 
			
		||||
g_dbus_connection_invoke_method (GDBusConnection        *connection,
 | 
			
		||||
                                 const gchar            *bus_name,
 | 
			
		||||
                                 const gchar            *object_path,
 | 
			
		||||
                                 const gchar            *interface_name,
 | 
			
		||||
                                 const gchar            *method_name,
 | 
			
		||||
                                 GVariant               *parameters,
 | 
			
		||||
                                 GDBusInvokeMethodFlags  flags,
 | 
			
		||||
                                 gint                    timeout_msec,
 | 
			
		||||
                                 GCancellable           *cancellable,
 | 
			
		||||
                                 GAsyncReadyCallback     callback,
 | 
			
		||||
                                 gpointer                user_data)
 | 
			
		||||
g_dbus_connection_call (GDBusConnection        *connection,
 | 
			
		||||
                        const gchar            *bus_name,
 | 
			
		||||
                        const gchar            *object_path,
 | 
			
		||||
                        const gchar            *interface_name,
 | 
			
		||||
                        const gchar            *method_name,
 | 
			
		||||
                        GVariant               *parameters,
 | 
			
		||||
                        GDBusCallFlags          flags,
 | 
			
		||||
                        gint                    timeout_msec,
 | 
			
		||||
                        GCancellable           *cancellable,
 | 
			
		||||
                        GAsyncReadyCallback     callback,
 | 
			
		||||
                        gpointer                user_data)
 | 
			
		||||
{
 | 
			
		||||
  GDBusMessage *message;
 | 
			
		||||
 | 
			
		||||
@@ -4136,7 +4136,7 @@ g_dbus_connection_invoke_method (GDBusConnection        *connection,
 | 
			
		||||
                                            object_path,
 | 
			
		||||
                                            interface_name,
 | 
			
		||||
                                            method_name);
 | 
			
		||||
  add_invoke_method_flags (message, flags);
 | 
			
		||||
  add_call_flags (message, flags);
 | 
			
		||||
  if (parameters != NULL)
 | 
			
		||||
    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.
 | 
			
		||||
 * @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.
 | 
			
		||||
 *
 | 
			
		||||
 * 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
 | 
			
		||||
 * return values. Free with g_variant_unref().
 | 
			
		||||
@@ -4200,9 +4200,9 @@ decode_method_reply (GDBusMessage  *reply,
 | 
			
		||||
 * Since: 2.26
 | 
			
		||||
 */
 | 
			
		||||
GVariant *
 | 
			
		||||
g_dbus_connection_invoke_method_finish (GDBusConnection  *connection,
 | 
			
		||||
                                        GAsyncResult     *res,
 | 
			
		||||
                                        GError          **error)
 | 
			
		||||
g_dbus_connection_call_finish (GDBusConnection  *connection,
 | 
			
		||||
                               GAsyncResult     *res,
 | 
			
		||||
                               GError          **error)
 | 
			
		||||
{
 | 
			
		||||
  GDBusMessage *reply;
 | 
			
		||||
  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.
 | 
			
		||||
 * @bus_name: A unique or well-known bus name.
 | 
			
		||||
 * @object_path: Path of remote object.
 | 
			
		||||
 * @interface_name: D-Bus interface to invoke method on.
 | 
			
		||||
 * @method_name: The name of the method to invoke.
 | 
			
		||||
 * @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.
 | 
			
		||||
 * @cancellable: A #GCancellable 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.
 | 
			
		||||
 *
 | 
			
		||||
 * 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.
 | 
			
		||||
 *
 | 
			
		||||
 * 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
 | 
			
		||||
 */
 | 
			
		||||
GVariant *
 | 
			
		||||
g_dbus_connection_invoke_method_sync (GDBusConnection         *connection,
 | 
			
		||||
                                      const gchar             *bus_name,
 | 
			
		||||
                                      const gchar             *object_path,
 | 
			
		||||
                                      const gchar             *interface_name,
 | 
			
		||||
                                      const gchar             *method_name,
 | 
			
		||||
                                      GVariant                *parameters,
 | 
			
		||||
                                      GDBusInvokeMethodFlags   flags,
 | 
			
		||||
                                      gint                     timeout_msec,
 | 
			
		||||
                                      GCancellable            *cancellable,
 | 
			
		||||
                                      GError                 **error)
 | 
			
		||||
g_dbus_connection_call_sync (GDBusConnection         *connection,
 | 
			
		||||
                             const gchar             *bus_name,
 | 
			
		||||
                             const gchar             *object_path,
 | 
			
		||||
                             const gchar             *interface_name,
 | 
			
		||||
                             const gchar             *method_name,
 | 
			
		||||
                             GVariant                *parameters,
 | 
			
		||||
                             GDBusCallFlags           flags,
 | 
			
		||||
                             gint                     timeout_msec,
 | 
			
		||||
                             GCancellable            *cancellable,
 | 
			
		||||
                             GError                 **error)
 | 
			
		||||
{
 | 
			
		||||
  GDBusMessage *message;
 | 
			
		||||
  GDBusMessage *reply;
 | 
			
		||||
@@ -4291,7 +4291,7 @@ g_dbus_connection_invoke_method_sync (GDBusConnection         *connection,
 | 
			
		||||
                                            object_path,
 | 
			
		||||
                                            interface_name,
 | 
			
		||||
                                            method_name);
 | 
			
		||||
  add_invoke_method_flags (message, flags);
 | 
			
		||||
  add_call_flags (message, flags);
 | 
			
		||||
  if (parameters != NULL)
 | 
			
		||||
    g_dbus_message_set_body (message, parameters);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -171,27 +171,27 @@ gboolean  g_dbus_connection_emit_signal                       (GDBusConnection
 | 
			
		||||
                                                               const gchar        *signal_name,
 | 
			
		||||
                                                               GVariant           *parameters,
 | 
			
		||||
                                                               GError            **error);
 | 
			
		||||
void      g_dbus_connection_invoke_method                     (GDBusConnection    *connection,
 | 
			
		||||
void      g_dbus_connection_call                              (GDBusConnection    *connection,
 | 
			
		||||
                                                               const gchar        *bus_name,
 | 
			
		||||
                                                               const gchar        *object_path,
 | 
			
		||||
                                                               const gchar        *interface_name,
 | 
			
		||||
                                                               const gchar        *method_name,
 | 
			
		||||
                                                               GVariant           *parameters,
 | 
			
		||||
                                                               GDBusInvokeMethodFlags flags,
 | 
			
		||||
                                                               GDBusCallFlags      flags,
 | 
			
		||||
                                                               gint                timeout_msec,
 | 
			
		||||
                                                               GCancellable       *cancellable,
 | 
			
		||||
                                                               GAsyncReadyCallback callback,
 | 
			
		||||
                                                               gpointer            user_data);
 | 
			
		||||
GVariant *g_dbus_connection_invoke_method_finish              (GDBusConnection    *connection,
 | 
			
		||||
GVariant *g_dbus_connection_call_finish                       (GDBusConnection    *connection,
 | 
			
		||||
                                                               GAsyncResult       *res,
 | 
			
		||||
                                                               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        *object_path,
 | 
			
		||||
                                                               const gchar        *interface_name,
 | 
			
		||||
                                                               const gchar        *method_name,
 | 
			
		||||
                                                               GVariant           *parameters,
 | 
			
		||||
                                                               GDBusInvokeMethodFlags flags,
 | 
			
		||||
                                                               GDBusCallFlags      flags,
 | 
			
		||||
                                                               gint                timeout_msec,
 | 
			
		||||
                                                               GCancellable       *cancellable,
 | 
			
		||||
                                                               GError            **error);
 | 
			
		||||
 
 | 
			
		||||
@@ -41,9 +41,9 @@
 | 
			
		||||
 * @include: gio/gio.h
 | 
			
		||||
 *
 | 
			
		||||
 * All facilities that return errors from remote methods (such as
 | 
			
		||||
 * g_dbus_connection_invoke_method_sync()) use #GError to represent
 | 
			
		||||
 * both D-Bus errors (e.g. errors returned from the other peer) and
 | 
			
		||||
 * locally in-process generated errors.
 | 
			
		||||
 * g_dbus_connection_call_sync()) use #GError to represent both D-Bus
 | 
			
		||||
 * errors (e.g. errors returned from the other peer) and locally
 | 
			
		||||
 * in-process generated errors.
 | 
			
		||||
 *
 | 
			
		||||
 * 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,
 | 
			
		||||
@@ -488,9 +488,10 @@ g_dbus_error_is_remote_error (const GError *error)
 | 
			
		||||
 *
 | 
			
		||||
 * 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
 | 
			
		||||
 * functions handling remote method calls (e.g. g_dbus_connection_invoke_method_finish())
 | 
			
		||||
 * unless g_dbus_error_strip_remote_error() has been used on @error.
 | 
			
		||||
 * This function is guaranteed to return a D-Bus error name for all
 | 
			
		||||
 * #GError<!-- -->s returned from functions handling remote method
 | 
			
		||||
 * 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().
 | 
			
		||||
 *
 | 
			
		||||
 
 | 
			
		||||
@@ -294,9 +294,9 @@ request_name_cb (GObject      *source_object,
 | 
			
		||||
  request_name_reply = 0;
 | 
			
		||||
  result = NULL;
 | 
			
		||||
 | 
			
		||||
  result = g_dbus_connection_invoke_method_finish (client->connection,
 | 
			
		||||
                                                   res,
 | 
			
		||||
                                                   NULL);
 | 
			
		||||
  result = g_dbus_connection_call_finish (client->connection,
 | 
			
		||||
                                          res,
 | 
			
		||||
                                          NULL);
 | 
			
		||||
  if (result != NULL)
 | 
			
		||||
    {
 | 
			
		||||
      g_variant_get (result, "(u)", &request_name_reply);
 | 
			
		||||
@@ -395,19 +395,19 @@ has_connection (Client *client)
 | 
			
		||||
                                                             client);
 | 
			
		||||
 | 
			
		||||
  /* attempt to acquire the name */
 | 
			
		||||
  g_dbus_connection_invoke_method (client->connection,
 | 
			
		||||
                                   "org.freedesktop.DBus",  /* bus name */
 | 
			
		||||
                                   "/org/freedesktop/DBus", /* object path */
 | 
			
		||||
                                   "org.freedesktop.DBus",  /* interface name */
 | 
			
		||||
                                   "RequestName",           /* method name */
 | 
			
		||||
                                   g_variant_new ("(su)",
 | 
			
		||||
                                                  client->name,
 | 
			
		||||
                                                  client->flags),
 | 
			
		||||
                                   G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                                   -1,
 | 
			
		||||
                                   NULL,
 | 
			
		||||
                                   (GAsyncReadyCallback) request_name_cb,
 | 
			
		||||
                                   client_ref (client));
 | 
			
		||||
  g_dbus_connection_call (client->connection,
 | 
			
		||||
                          "org.freedesktop.DBus",  /* bus name */
 | 
			
		||||
                          "/org/freedesktop/DBus", /* object path */
 | 
			
		||||
                          "org.freedesktop.DBus",  /* interface name */
 | 
			
		||||
                          "RequestName",           /* method name */
 | 
			
		||||
                          g_variant_new ("(su)",
 | 
			
		||||
                                         client->name,
 | 
			
		||||
                                         client->flags),
 | 
			
		||||
                          G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                          -1,
 | 
			
		||||
                          NULL,
 | 
			
		||||
                          (GAsyncReadyCallback) request_name_cb,
 | 
			
		||||
                          client_ref (client));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -676,16 +676,16 @@ g_bus_unown_name (guint owner_id)
 | 
			
		||||
           * I believe this is a bug in the bus daemon.
 | 
			
		||||
           */
 | 
			
		||||
          error = NULL;
 | 
			
		||||
          result = g_dbus_connection_invoke_method_sync (client->connection,
 | 
			
		||||
                                                         "org.freedesktop.DBus",  /* bus name */
 | 
			
		||||
                                                         "/org/freedesktop/DBus", /* object path */
 | 
			
		||||
                                                         "org.freedesktop.DBus",  /* interface name */
 | 
			
		||||
                                                         "ReleaseName",           /* method name */
 | 
			
		||||
                                                         g_variant_new ("(s)", client->name),
 | 
			
		||||
                                                         G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                                                         -1,
 | 
			
		||||
                                                         NULL,
 | 
			
		||||
                                                         &error);
 | 
			
		||||
          result = g_dbus_connection_call_sync (client->connection,
 | 
			
		||||
                                                "org.freedesktop.DBus",  /* bus name */
 | 
			
		||||
                                                "/org/freedesktop/DBus", /* object path */
 | 
			
		||||
                                                "org.freedesktop.DBus",  /* interface name */
 | 
			
		||||
                                                "ReleaseName",           /* method name */
 | 
			
		||||
                                                g_variant_new ("(s)", client->name),
 | 
			
		||||
                                                G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                                                -1,
 | 
			
		||||
                                                NULL,
 | 
			
		||||
                                                &error);
 | 
			
		||||
          if (result == NULL)
 | 
			
		||||
            {
 | 
			
		||||
              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;
 | 
			
		||||
  result = NULL;
 | 
			
		||||
 | 
			
		||||
  result = g_dbus_connection_invoke_method_finish (client->connection,
 | 
			
		||||
                                                   res,
 | 
			
		||||
                                                   NULL);
 | 
			
		||||
  result = g_dbus_connection_call_finish (client->connection,
 | 
			
		||||
                                          res,
 | 
			
		||||
                                          NULL);
 | 
			
		||||
  if (result != NULL)
 | 
			
		||||
    {
 | 
			
		||||
      g_variant_get (result, "(s)", &name_owner);
 | 
			
		||||
@@ -362,17 +362,17 @@ get_name_owner_cb (GObject      *source_object,
 | 
			
		||||
static void
 | 
			
		||||
invoke_get_name_owner (Client *client)
 | 
			
		||||
{
 | 
			
		||||
  g_dbus_connection_invoke_method (client->connection,
 | 
			
		||||
                                   "org.freedesktop.DBus",  /* bus name */
 | 
			
		||||
                                   "/org/freedesktop/DBus", /* object path */
 | 
			
		||||
                                   "org.freedesktop.DBus",  /* interface name */
 | 
			
		||||
                                   "GetNameOwner",          /* method name */
 | 
			
		||||
                                   g_variant_new ("(s)", client->name),
 | 
			
		||||
                                   G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                                   -1,
 | 
			
		||||
                                   NULL,
 | 
			
		||||
                                   (GAsyncReadyCallback) get_name_owner_cb,
 | 
			
		||||
                                   client_ref (client));
 | 
			
		||||
  g_dbus_connection_call (client->connection,
 | 
			
		||||
                          "org.freedesktop.DBus",  /* bus name */
 | 
			
		||||
                          "/org/freedesktop/DBus", /* object path */
 | 
			
		||||
                          "org.freedesktop.DBus",  /* interface name */
 | 
			
		||||
                          "GetNameOwner",          /* method name */
 | 
			
		||||
                          g_variant_new ("(s)", client->name),
 | 
			
		||||
                          G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                          -1,
 | 
			
		||||
                          NULL,
 | 
			
		||||
                          (GAsyncReadyCallback) get_name_owner_cb,
 | 
			
		||||
                          client_ref (client));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* ---------------------------------------------------------------------------------------------------- */
 | 
			
		||||
@@ -387,9 +387,9 @@ start_service_by_name_cb (GObject      *source_object,
 | 
			
		||||
 | 
			
		||||
  result = NULL;
 | 
			
		||||
 | 
			
		||||
  result = g_dbus_connection_invoke_method_finish (client->connection,
 | 
			
		||||
                                                   res,
 | 
			
		||||
                                                   NULL);
 | 
			
		||||
  result = g_dbus_connection_call_finish (client->connection,
 | 
			
		||||
                                          res,
 | 
			
		||||
                                          NULL);
 | 
			
		||||
  if (result != NULL)
 | 
			
		||||
    {
 | 
			
		||||
      guint32 start_service_result;
 | 
			
		||||
@@ -452,17 +452,17 @@ has_connection (Client *client)
 | 
			
		||||
 | 
			
		||||
  if (client->flags & G_BUS_NAME_WATCHER_FLAGS_AUTO_START)
 | 
			
		||||
    {
 | 
			
		||||
      g_dbus_connection_invoke_method (client->connection,
 | 
			
		||||
                                       "org.freedesktop.DBus",  /* bus name */
 | 
			
		||||
                                       "/org/freedesktop/DBus", /* object path */
 | 
			
		||||
                                       "org.freedesktop.DBus",  /* interface name */
 | 
			
		||||
                                       "StartServiceByName",    /* method name */
 | 
			
		||||
                                       g_variant_new ("(su)", client->name, 0),
 | 
			
		||||
                                       G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                                       -1,
 | 
			
		||||
                                       NULL,
 | 
			
		||||
                                       (GAsyncReadyCallback) start_service_by_name_cb,
 | 
			
		||||
                                       client_ref (client));
 | 
			
		||||
      g_dbus_connection_call (client->connection,
 | 
			
		||||
                              "org.freedesktop.DBus",  /* bus name */
 | 
			
		||||
                              "/org/freedesktop/DBus", /* object path */
 | 
			
		||||
                              "org.freedesktop.DBus",  /* interface name */
 | 
			
		||||
                              "StartServiceByName",    /* method name */
 | 
			
		||||
                              g_variant_new ("(su)", client->name, 0),
 | 
			
		||||
                              G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                              -1,
 | 
			
		||||
                              NULL,
 | 
			
		||||
                              (GAsyncReadyCallback) start_service_by_name_cb,
 | 
			
		||||
                              client_ref (client));
 | 
			
		||||
    }
 | 
			
		||||
  else
 | 
			
		||||
    {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										142
									
								
								gio/gdbusproxy.c
									
									
									
									
									
								
							
							
						
						
									
										142
									
								
								gio/gdbusproxy.c
									
									
									
									
									
								
							@@ -359,8 +359,8 @@ g_dbus_proxy_class_init (GDBusProxyClass *klass)
 | 
			
		||||
   * GDBusProxy:g-default-timeout:
 | 
			
		||||
   *
 | 
			
		||||
   * The timeout to use if -1 (specifying default timeout) is passed
 | 
			
		||||
   * as @timeout_msec in the g_dbus_proxy_invoke_method() and
 | 
			
		||||
   * g_dbus_proxy_invoke_method_sync() functions.
 | 
			
		||||
   * as @timeout_msec in the g_dbus_proxy_call() and
 | 
			
		||||
   * g_dbus_proxy_call_sync() functions.
 | 
			
		||||
   *
 | 
			
		||||
   * This allows applications to set a proxy-wide timeout for all
 | 
			
		||||
   * 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))
 | 
			
		||||
    {
 | 
			
		||||
      /* load all properties synchronously */
 | 
			
		||||
      result = g_dbus_connection_invoke_method_sync (proxy->priv->connection,
 | 
			
		||||
                                                     proxy->priv->unique_bus_name,
 | 
			
		||||
                                                     proxy->priv->object_path,
 | 
			
		||||
                                                     "org.freedesktop.DBus.Properties",
 | 
			
		||||
                                                     "GetAll",
 | 
			
		||||
                                                     g_variant_new ("(s)", proxy->priv->interface_name),
 | 
			
		||||
                                                     G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                                                     -1,           /* timeout */
 | 
			
		||||
                                                     cancellable,
 | 
			
		||||
                                                     error);
 | 
			
		||||
      result = g_dbus_connection_call_sync (proxy->priv->connection,
 | 
			
		||||
                                            proxy->priv->unique_bus_name,
 | 
			
		||||
                                            proxy->priv->object_path,
 | 
			
		||||
                                            "org.freedesktop.DBus.Properties",
 | 
			
		||||
                                            "GetAll",
 | 
			
		||||
                                            g_variant_new ("(s)", proxy->priv->interface_name),
 | 
			
		||||
                                            G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                                            -1,           /* timeout */
 | 
			
		||||
                                            cancellable,
 | 
			
		||||
                                            error);
 | 
			
		||||
      if (result == NULL)
 | 
			
		||||
        goto out;
 | 
			
		||||
 | 
			
		||||
@@ -796,9 +796,9 @@ get_all_cb (GDBusConnection *connection,
 | 
			
		||||
  GError *error;
 | 
			
		||||
 | 
			
		||||
  error = NULL;
 | 
			
		||||
  result = g_dbus_connection_invoke_method_finish (connection,
 | 
			
		||||
                                                   res,
 | 
			
		||||
                                                   &error);
 | 
			
		||||
  result = g_dbus_connection_call_finish (connection,
 | 
			
		||||
                                          res,
 | 
			
		||||
                                          &error);
 | 
			
		||||
  if (result == NULL)
 | 
			
		||||
    {
 | 
			
		||||
      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))
 | 
			
		||||
    {
 | 
			
		||||
      /* load all properties asynchronously */
 | 
			
		||||
      g_dbus_connection_invoke_method (proxy->priv->connection,
 | 
			
		||||
                                       proxy->priv->unique_bus_name,
 | 
			
		||||
                                       proxy->priv->object_path,
 | 
			
		||||
                                       "org.freedesktop.DBus.Properties",
 | 
			
		||||
                                       "GetAll",
 | 
			
		||||
                                       g_variant_new ("(s)", proxy->priv->interface_name),
 | 
			
		||||
                                       G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                                       -1,           /* timeout */
 | 
			
		||||
                                       cancellable,
 | 
			
		||||
                                       (GAsyncReadyCallback) get_all_cb,
 | 
			
		||||
                                       simple);
 | 
			
		||||
      g_dbus_connection_call (proxy->priv->connection,
 | 
			
		||||
                              proxy->priv->unique_bus_name,
 | 
			
		||||
                              proxy->priv->object_path,
 | 
			
		||||
                              "org.freedesktop.DBus.Properties",
 | 
			
		||||
                              "GetAll",
 | 
			
		||||
                              g_variant_new ("(s)", proxy->priv->interface_name),
 | 
			
		||||
                              G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                              -1,           /* timeout */
 | 
			
		||||
                              cancellable,
 | 
			
		||||
                              (GAsyncReadyCallback) get_all_cb,
 | 
			
		||||
                              simple);
 | 
			
		||||
    }
 | 
			
		||||
  else
 | 
			
		||||
    {
 | 
			
		||||
@@ -1148,8 +1148,8 @@ g_dbus_proxy_get_interface_name (GDBusProxy *proxy)
 | 
			
		||||
 * @proxy: A #GDBusProxy.
 | 
			
		||||
 *
 | 
			
		||||
 * Gets the timeout to use if -1 (specifying default timeout) is
 | 
			
		||||
 * passed as @timeout_msec in the g_dbus_proxy_invoke_method() and
 | 
			
		||||
 * g_dbus_proxy_invoke_method_sync() functions.
 | 
			
		||||
 * passed as @timeout_msec in the g_dbus_proxy_call() and
 | 
			
		||||
 * g_dbus_proxy_call_sync() functions.
 | 
			
		||||
 *
 | 
			
		||||
 * 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.
 | 
			
		||||
 *
 | 
			
		||||
 * Sets the timeout to use if -1 (specifying default timeout) is
 | 
			
		||||
 * passed as @timeout_msec in the g_dbus_proxy_invoke_method() and
 | 
			
		||||
 * g_dbus_proxy_invoke_method_sync() functions.
 | 
			
		||||
 * passed as @timeout_msec in the g_dbus_proxy_call() and
 | 
			
		||||
 * g_dbus_proxy_call_sync() functions.
 | 
			
		||||
 *
 | 
			
		||||
 * See the #GDBusProxy:g-default-timeout property for more details.
 | 
			
		||||
 *
 | 
			
		||||
@@ -1282,9 +1282,9 @@ reply_cb (GDBusConnection *connection,
 | 
			
		||||
  GError *error;
 | 
			
		||||
 | 
			
		||||
  error = NULL;
 | 
			
		||||
  value = g_dbus_connection_invoke_method_finish (connection,
 | 
			
		||||
                                                  res,
 | 
			
		||||
                                                  &error);
 | 
			
		||||
  value = g_dbus_connection_call_finish (connection,
 | 
			
		||||
                                         res,
 | 
			
		||||
                                         &error);
 | 
			
		||||
  if (error != NULL)
 | 
			
		||||
    {
 | 
			
		||||
      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.
 | 
			
		||||
 * @method_name: Name of method to invoke.
 | 
			
		||||
 * @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.
 | 
			
		||||
 * @cancellable: A #GCancellable or %NULL.
 | 
			
		||||
 * @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
 | 
			
		||||
 * 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
 | 
			
		||||
 * g_dbus_proxy_invoke_method_finish() to get the result of the operation.
 | 
			
		||||
 * See g_dbus_proxy_invoke_method_sync() for the
 | 
			
		||||
 * g_dbus_proxy_call_finish() to get the result of the operation.
 | 
			
		||||
 * See g_dbus_proxy_call_sync() for the
 | 
			
		||||
 * synchronous version of this method.
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 2.26
 | 
			
		||||
 */
 | 
			
		||||
void
 | 
			
		||||
g_dbus_proxy_invoke_method (GDBusProxy             *proxy,
 | 
			
		||||
g_dbus_proxy_call (GDBusProxy             *proxy,
 | 
			
		||||
                            const gchar            *method_name,
 | 
			
		||||
                            GVariant               *parameters,
 | 
			
		||||
                            GDBusInvokeMethodFlags  flags,
 | 
			
		||||
                            GDBusCallFlags          flags,
 | 
			
		||||
                            gint                    timeout_msec,
 | 
			
		||||
                            GCancellable           *cancellable,
 | 
			
		||||
                            GAsyncReadyCallback     callback,
 | 
			
		||||
@@ -1418,7 +1418,7 @@ g_dbus_proxy_invoke_method (GDBusProxy             *proxy,
 | 
			
		||||
  simple = g_simple_async_result_new (G_OBJECT (proxy),
 | 
			
		||||
                                      callback,
 | 
			
		||||
                                      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);
 | 
			
		||||
  target_method_name = was_split ? split_method_name : method_name;
 | 
			
		||||
@@ -1429,28 +1429,28 @@ g_dbus_proxy_invoke_method (GDBusProxy             *proxy,
 | 
			
		||||
  /* Just warn here */
 | 
			
		||||
  expected_method_info = lookup_method_info_or_warn (proxy, target_method_name);
 | 
			
		||||
 | 
			
		||||
  g_dbus_connection_invoke_method (proxy->priv->connection,
 | 
			
		||||
                                   proxy->priv->unique_bus_name,
 | 
			
		||||
                                   proxy->priv->object_path,
 | 
			
		||||
                                   target_interface_name,
 | 
			
		||||
                                   target_method_name,
 | 
			
		||||
                                   parameters,
 | 
			
		||||
                                   flags,
 | 
			
		||||
                                   timeout_msec == -1 ? proxy->priv->timeout_msec : timeout_msec,
 | 
			
		||||
                                   cancellable,
 | 
			
		||||
                                   (GAsyncReadyCallback) reply_cb,
 | 
			
		||||
                                   simple);
 | 
			
		||||
  g_dbus_connection_call (proxy->priv->connection,
 | 
			
		||||
                          proxy->priv->unique_bus_name,
 | 
			
		||||
                          proxy->priv->object_path,
 | 
			
		||||
                          target_interface_name,
 | 
			
		||||
                          target_method_name,
 | 
			
		||||
                          parameters,
 | 
			
		||||
                          flags,
 | 
			
		||||
                          timeout_msec == -1 ? proxy->priv->timeout_msec : timeout_msec,
 | 
			
		||||
                          cancellable,
 | 
			
		||||
                          (GAsyncReadyCallback) reply_cb,
 | 
			
		||||
                          simple);
 | 
			
		||||
 | 
			
		||||
  g_free (split_interface_name);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * g_dbus_proxy_invoke_method_finish:
 | 
			
		||||
 * g_dbus_proxy_call_finish:
 | 
			
		||||
 * @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.
 | 
			
		||||
 *
 | 
			
		||||
 * 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
 | 
			
		||||
 * return values. Free with g_variant_unref().
 | 
			
		||||
@@ -1458,7 +1458,7 @@ g_dbus_proxy_invoke_method (GDBusProxy             *proxy,
 | 
			
		||||
 * Since: 2.26
 | 
			
		||||
 */
 | 
			
		||||
GVariant *
 | 
			
		||||
g_dbus_proxy_invoke_method_finish (GDBusProxy    *proxy,
 | 
			
		||||
g_dbus_proxy_call_finish (GDBusProxy    *proxy,
 | 
			
		||||
                                   GAsyncResult  *res,
 | 
			
		||||
                                   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 (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;
 | 
			
		||||
 | 
			
		||||
@@ -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.
 | 
			
		||||
 * @method_name: Name of method to invoke.
 | 
			
		||||
 * @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.
 | 
			
		||||
 * @cancellable: A #GCancellable 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.
 | 
			
		||||
 *
 | 
			
		||||
 * 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.
 | 
			
		||||
 *
 | 
			
		||||
 * 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
 | 
			
		||||
 */
 | 
			
		||||
GVariant *
 | 
			
		||||
g_dbus_proxy_invoke_method_sync (GDBusProxy              *proxy,
 | 
			
		||||
g_dbus_proxy_call_sync (GDBusProxy              *proxy,
 | 
			
		||||
                                 const gchar             *method_name,
 | 
			
		||||
                                 GVariant                *parameters,
 | 
			
		||||
                                 GDBusInvokeMethodFlags   flags,
 | 
			
		||||
                                 GDBusCallFlags           flags,
 | 
			
		||||
                                 gint                     timeout_msec,
 | 
			
		||||
                                 GCancellable            *cancellable,
 | 
			
		||||
                                 GError                 **error)
 | 
			
		||||
@@ -1567,16 +1567,16 @@ g_dbus_proxy_invoke_method_sync (GDBusProxy              *proxy,
 | 
			
		||||
      expected_method_info = NULL;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  ret = g_dbus_connection_invoke_method_sync (proxy->priv->connection,
 | 
			
		||||
                                              proxy->priv->unique_bus_name,
 | 
			
		||||
                                              proxy->priv->object_path,
 | 
			
		||||
                                              target_interface_name,
 | 
			
		||||
                                              target_method_name,
 | 
			
		||||
                                              parameters,
 | 
			
		||||
                                              flags,
 | 
			
		||||
                                              timeout_msec == -1 ? proxy->priv->timeout_msec : timeout_msec,
 | 
			
		||||
                                              cancellable,
 | 
			
		||||
                                              error);
 | 
			
		||||
  ret = g_dbus_connection_call_sync (proxy->priv->connection,
 | 
			
		||||
                                     proxy->priv->unique_bus_name,
 | 
			
		||||
                                     proxy->priv->object_path,
 | 
			
		||||
                                     target_interface_name,
 | 
			
		||||
                                     target_method_name,
 | 
			
		||||
                                     parameters,
 | 
			
		||||
                                     flags,
 | 
			
		||||
                                     timeout_msec == -1 ? proxy->priv->timeout_msec : timeout_msec,
 | 
			
		||||
                                     cancellable,
 | 
			
		||||
                                     error);
 | 
			
		||||
  if (!validate_method_return (target_method_name, ret, expected_method_info, error))
 | 
			
		||||
    {
 | 
			
		||||
      g_variant_unref (ret);
 | 
			
		||||
 
 | 
			
		||||
@@ -126,21 +126,21 @@ GVariant        *g_dbus_proxy_get_cached_property       (GDBusProxy          *pr
 | 
			
		||||
                                                         GError             **error);
 | 
			
		||||
gchar          **g_dbus_proxy_get_cached_property_names (GDBusProxy          *proxy,
 | 
			
		||||
                                                         GError             **error);
 | 
			
		||||
void             g_dbus_proxy_invoke_method             (GDBusProxy          *proxy,
 | 
			
		||||
void             g_dbus_proxy_call                      (GDBusProxy          *proxy,
 | 
			
		||||
                                                         const gchar         *method_name,
 | 
			
		||||
                                                         GVariant            *parameters,
 | 
			
		||||
                                                         GDBusInvokeMethodFlags flags,
 | 
			
		||||
                                                         GDBusCallFlags       flags,
 | 
			
		||||
                                                         gint                 timeout_msec,
 | 
			
		||||
                                                         GCancellable        *cancellable,
 | 
			
		||||
                                                         GAsyncReadyCallback  callback,
 | 
			
		||||
                                                         gpointer             user_data);
 | 
			
		||||
GVariant        *g_dbus_proxy_invoke_method_finish      (GDBusProxy          *proxy,
 | 
			
		||||
GVariant        *g_dbus_proxy_call_finish               (GDBusProxy          *proxy,
 | 
			
		||||
                                                         GAsyncResult        *res,
 | 
			
		||||
                                                         GError             **error);
 | 
			
		||||
GVariant        *g_dbus_proxy_invoke_method_sync        (GDBusProxy          *proxy,
 | 
			
		||||
GVariant        *g_dbus_proxy_call_sync                 (GDBusProxy          *proxy,
 | 
			
		||||
                                                         const gchar         *method_name,
 | 
			
		||||
                                                         GVariant            *parameters,
 | 
			
		||||
                                                         GDBusInvokeMethodFlags flags,
 | 
			
		||||
                                                         GDBusCallFlags       flags,
 | 
			
		||||
                                                         gint                 timeout_msec,
 | 
			
		||||
                                                         GCancellable        *cancellable,
 | 
			
		||||
                                                         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_connection_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_flags_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_close
 | 
			
		||||
g_dbus_connection_emit_signal
 | 
			
		||||
g_dbus_connection_invoke_method
 | 
			
		||||
g_dbus_connection_invoke_method_finish
 | 
			
		||||
g_dbus_connection_invoke_method_sync
 | 
			
		||||
g_dbus_connection_call
 | 
			
		||||
g_dbus_connection_call_finish
 | 
			
		||||
g_dbus_connection_call_sync
 | 
			
		||||
g_dbus_connection_signal_subscribe
 | 
			
		||||
g_dbus_connection_signal_unsubscribe
 | 
			
		||||
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_set_default_timeout
 | 
			
		||||
g_dbus_proxy_set_interface_info
 | 
			
		||||
g_dbus_proxy_invoke_method
 | 
			
		||||
g_dbus_proxy_invoke_method_finish
 | 
			
		||||
g_dbus_proxy_invoke_method_sync
 | 
			
		||||
g_dbus_proxy_call
 | 
			
		||||
g_dbus_proxy_call_finish
 | 
			
		||||
g_dbus_proxy_call_sync
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -994,20 +994,20 @@ typedef enum {
 | 
			
		||||
} GDBusCapabilityFlags;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * GDBusInvokeMethodFlags:
 | 
			
		||||
 * @G_DBUS_INVOKE_METHOD_FLAGS_NONE: No flags set.
 | 
			
		||||
 * @G_DBUS_INVOKE_METHOD_FLAGS_NO_AUTO_START: The bus must not launch
 | 
			
		||||
 * GDBusCallFlags:
 | 
			
		||||
 * @G_DBUS_CALL_FLAGS_NONE: No flags set.
 | 
			
		||||
 * @G_DBUS_CALL_FLAGS_NO_AUTO_START: The bus must not launch
 | 
			
		||||
 * an owner for the destination name in response to this method
 | 
			
		||||
 * 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
 | 
			
		||||
 */
 | 
			
		||||
typedef enum {
 | 
			
		||||
  G_DBUS_INVOKE_METHOD_FLAGS_NONE = 0,
 | 
			
		||||
  G_DBUS_INVOKE_METHOD_FLAGS_NO_AUTO_START = (1<<0),
 | 
			
		||||
} GDBusInvokeMethodFlags;
 | 
			
		||||
  G_DBUS_CALL_FLAGS_NONE = 0,
 | 
			
		||||
  G_DBUS_CALL_FLAGS_NO_AUTO_START = (1<<0),
 | 
			
		||||
} GDBusCallFlags;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * GDBusMessageType:
 | 
			
		||||
 
 | 
			
		||||
@@ -118,9 +118,9 @@ msg_cb_expect_error_disconnected (GDBusConnection *connection,
 | 
			
		||||
  GVariant *result;
 | 
			
		||||
 | 
			
		||||
  error = NULL;
 | 
			
		||||
  result = g_dbus_connection_invoke_method_finish (connection,
 | 
			
		||||
                                                   res,
 | 
			
		||||
                                                   &error);
 | 
			
		||||
  result = g_dbus_connection_call_finish (connection,
 | 
			
		||||
                                          res,
 | 
			
		||||
                                          &error);
 | 
			
		||||
  g_assert_error (error, G_IO_ERROR, G_IO_ERROR_CLOSED);
 | 
			
		||||
  g_assert (!g_dbus_error_is_remote_error (error));
 | 
			
		||||
  g_error_free (error);
 | 
			
		||||
@@ -138,9 +138,9 @@ msg_cb_expect_error_unknown_method (GDBusConnection *connection,
 | 
			
		||||
  GVariant *result;
 | 
			
		||||
 | 
			
		||||
  error = NULL;
 | 
			
		||||
  result = g_dbus_connection_invoke_method_finish (connection,
 | 
			
		||||
                                                   res,
 | 
			
		||||
                                                   &error);
 | 
			
		||||
  result = g_dbus_connection_call_finish (connection,
 | 
			
		||||
                                          res,
 | 
			
		||||
                                          &error);
 | 
			
		||||
  g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD);
 | 
			
		||||
  g_assert (g_dbus_error_is_remote_error (error));
 | 
			
		||||
  g_assert (result == NULL);
 | 
			
		||||
@@ -157,9 +157,9 @@ msg_cb_expect_success (GDBusConnection *connection,
 | 
			
		||||
  GVariant *result;
 | 
			
		||||
 | 
			
		||||
  error = NULL;
 | 
			
		||||
  result = g_dbus_connection_invoke_method_finish (connection,
 | 
			
		||||
                                                   res,
 | 
			
		||||
                                                   &error);
 | 
			
		||||
  result = g_dbus_connection_call_finish (connection,
 | 
			
		||||
                                          res,
 | 
			
		||||
                                          &error);
 | 
			
		||||
  g_assert_no_error (error);
 | 
			
		||||
  g_assert (result != NULL);
 | 
			
		||||
  g_variant_unref (result);
 | 
			
		||||
@@ -176,9 +176,9 @@ msg_cb_expect_error_cancelled (GDBusConnection *connection,
 | 
			
		||||
  GVariant *result;
 | 
			
		||||
 | 
			
		||||
  error = NULL;
 | 
			
		||||
  result = g_dbus_connection_invoke_method_finish (connection,
 | 
			
		||||
                                                   res,
 | 
			
		||||
                                                   &error);
 | 
			
		||||
  result = g_dbus_connection_call_finish (connection,
 | 
			
		||||
                                          res,
 | 
			
		||||
                                          &error);
 | 
			
		||||
  g_assert_error (error, G_IO_ERROR, G_IO_ERROR_CANCELLED);
 | 
			
		||||
  g_assert (!g_dbus_error_is_remote_error (error));
 | 
			
		||||
  g_error_free (error);
 | 
			
		||||
@@ -196,9 +196,9 @@ msg_cb_expect_error_cancelled_2 (GDBusConnection *connection,
 | 
			
		||||
  GVariant *result;
 | 
			
		||||
 | 
			
		||||
  error = NULL;
 | 
			
		||||
  result = g_dbus_connection_invoke_method_finish (connection,
 | 
			
		||||
                                                   res,
 | 
			
		||||
                                                   &error);
 | 
			
		||||
  result = g_dbus_connection_call_finish (connection,
 | 
			
		||||
                                          res,
 | 
			
		||||
                                          &error);
 | 
			
		||||
  g_assert_error (error, G_IO_ERROR, G_IO_ERROR_CANCELLED);
 | 
			
		||||
  g_assert (!g_dbus_error_is_remote_error (error));
 | 
			
		||||
  g_error_free (error);
 | 
			
		||||
@@ -229,67 +229,67 @@ test_connection_send (void)
 | 
			
		||||
   */
 | 
			
		||||
  ca = g_cancellable_new ();
 | 
			
		||||
  g_cancellable_cancel (ca);
 | 
			
		||||
  g_dbus_connection_invoke_method (c,
 | 
			
		||||
                                   "org.freedesktop.DBus",  /* bus_name */
 | 
			
		||||
                                   "/org/freedesktop/DBus", /* object path */
 | 
			
		||||
                                   "org.freedesktop.DBus",  /* interface name */
 | 
			
		||||
                                   "GetId",                 /* method name */
 | 
			
		||||
                                   NULL,
 | 
			
		||||
                                   G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                                   -1,
 | 
			
		||||
                                   ca,
 | 
			
		||||
                                   (GAsyncReadyCallback) msg_cb_expect_error_cancelled,
 | 
			
		||||
                                   NULL);
 | 
			
		||||
  g_dbus_connection_call (c,
 | 
			
		||||
                          "org.freedesktop.DBus",  /* bus_name */
 | 
			
		||||
                          "/org/freedesktop/DBus", /* object path */
 | 
			
		||||
                          "org.freedesktop.DBus",  /* interface name */
 | 
			
		||||
                          "GetId",                 /* method name */
 | 
			
		||||
                          NULL,
 | 
			
		||||
                          G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                          -1,
 | 
			
		||||
                          ca,
 | 
			
		||||
                          (GAsyncReadyCallback) msg_cb_expect_error_cancelled,
 | 
			
		||||
                          NULL);
 | 
			
		||||
  g_main_loop_run (loop);
 | 
			
		||||
  g_object_unref (ca);
 | 
			
		||||
 | 
			
		||||
  /*
 | 
			
		||||
   * Check that we get a reply to the GetId() method call.
 | 
			
		||||
   */
 | 
			
		||||
  g_dbus_connection_invoke_method (c,
 | 
			
		||||
                                   "org.freedesktop.DBus",  /* bus_name */
 | 
			
		||||
                                   "/org/freedesktop/DBus", /* object path */
 | 
			
		||||
                                   "org.freedesktop.DBus",  /* interface name */
 | 
			
		||||
                                   "GetId",                 /* method name */
 | 
			
		||||
                                   NULL,
 | 
			
		||||
                                   G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                                   -1,
 | 
			
		||||
                                   NULL,
 | 
			
		||||
                                   (GAsyncReadyCallback) msg_cb_expect_success,
 | 
			
		||||
                                   NULL);
 | 
			
		||||
  g_dbus_connection_call (c,
 | 
			
		||||
                          "org.freedesktop.DBus",  /* bus_name */
 | 
			
		||||
                          "/org/freedesktop/DBus", /* object path */
 | 
			
		||||
                          "org.freedesktop.DBus",  /* interface name */
 | 
			
		||||
                          "GetId",                 /* method name */
 | 
			
		||||
                          NULL,
 | 
			
		||||
                          G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                          -1,
 | 
			
		||||
                          NULL,
 | 
			
		||||
                          (GAsyncReadyCallback) msg_cb_expect_success,
 | 
			
		||||
                          NULL);
 | 
			
		||||
  g_main_loop_run (loop);
 | 
			
		||||
 | 
			
		||||
  /*
 | 
			
		||||
   * Check that we get an error reply to the NonExistantMethod() method call.
 | 
			
		||||
   */
 | 
			
		||||
  g_dbus_connection_invoke_method (c,
 | 
			
		||||
                                   "org.freedesktop.DBus",  /* bus_name */
 | 
			
		||||
                                   "/org/freedesktop/DBus", /* object path */
 | 
			
		||||
                                   "org.freedesktop.DBus",  /* interface name */
 | 
			
		||||
                                   "NonExistantMethod",     /* method name */
 | 
			
		||||
                                   NULL,
 | 
			
		||||
                                   G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                                   -1,
 | 
			
		||||
                                   NULL,
 | 
			
		||||
                                   (GAsyncReadyCallback) msg_cb_expect_error_unknown_method,
 | 
			
		||||
                                   NULL);
 | 
			
		||||
  g_dbus_connection_call (c,
 | 
			
		||||
                          "org.freedesktop.DBus",  /* bus_name */
 | 
			
		||||
                          "/org/freedesktop/DBus", /* object path */
 | 
			
		||||
                          "org.freedesktop.DBus",  /* interface name */
 | 
			
		||||
                          "NonExistantMethod",     /* method name */
 | 
			
		||||
                          NULL,
 | 
			
		||||
                          G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                          -1,
 | 
			
		||||
                          NULL,
 | 
			
		||||
                          (GAsyncReadyCallback) msg_cb_expect_error_unknown_method,
 | 
			
		||||
                          NULL);
 | 
			
		||||
  g_main_loop_run (loop);
 | 
			
		||||
 | 
			
		||||
  /*
 | 
			
		||||
   * Check that cancellation works when the message is already in flight.
 | 
			
		||||
   */
 | 
			
		||||
  ca = g_cancellable_new ();
 | 
			
		||||
  g_dbus_connection_invoke_method (c,
 | 
			
		||||
                                   "org.freedesktop.DBus",  /* bus_name */
 | 
			
		||||
                                   "/org/freedesktop/DBus", /* object path */
 | 
			
		||||
                                   "org.freedesktop.DBus",  /* interface name */
 | 
			
		||||
                                   "GetId",                 /* method name */
 | 
			
		||||
                                   NULL,
 | 
			
		||||
                                   G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                                   -1,
 | 
			
		||||
                                   ca,
 | 
			
		||||
                                   (GAsyncReadyCallback) msg_cb_expect_error_cancelled_2,
 | 
			
		||||
                                   NULL);
 | 
			
		||||
  g_dbus_connection_call (c,
 | 
			
		||||
                          "org.freedesktop.DBus",  /* bus_name */
 | 
			
		||||
                          "/org/freedesktop/DBus", /* object path */
 | 
			
		||||
                          "org.freedesktop.DBus",  /* interface name */
 | 
			
		||||
                          "GetId",                 /* method name */
 | 
			
		||||
                          NULL,
 | 
			
		||||
                          G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                          -1,
 | 
			
		||||
                          ca,
 | 
			
		||||
                          (GAsyncReadyCallback) msg_cb_expect_error_cancelled_2,
 | 
			
		||||
                          NULL);
 | 
			
		||||
  g_cancellable_cancel (ca);
 | 
			
		||||
  g_main_loop_run (loop);
 | 
			
		||||
  g_object_unref (ca);
 | 
			
		||||
@@ -302,17 +302,17 @@ test_connection_send (void)
 | 
			
		||||
  _g_assert_signal_received (c, "closed");
 | 
			
		||||
  g_assert (g_dbus_connection_is_closed (c));
 | 
			
		||||
 | 
			
		||||
  g_dbus_connection_invoke_method (c,
 | 
			
		||||
                                   "org.freedesktop.DBus",  /* bus_name */
 | 
			
		||||
                                   "/org/freedesktop/DBus", /* object path */
 | 
			
		||||
                                   "org.freedesktop.DBus",  /* interface name */
 | 
			
		||||
                                   "GetId",                 /* method name */
 | 
			
		||||
                                   NULL,
 | 
			
		||||
                                   G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                                   -1,
 | 
			
		||||
                                   NULL,
 | 
			
		||||
                                   (GAsyncReadyCallback) msg_cb_expect_error_disconnected,
 | 
			
		||||
                                   NULL);
 | 
			
		||||
  g_dbus_connection_call (c,
 | 
			
		||||
                          "org.freedesktop.DBus",  /* bus_name */
 | 
			
		||||
                          "/org/freedesktop/DBus", /* object path */
 | 
			
		||||
                          "org.freedesktop.DBus",  /* interface name */
 | 
			
		||||
                          "GetId",                 /* method name */
 | 
			
		||||
                          NULL,
 | 
			
		||||
                          G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                          -1,
 | 
			
		||||
                          NULL,
 | 
			
		||||
                          (GAsyncReadyCallback) msg_cb_expect_error_disconnected,
 | 
			
		||||
                          NULL);
 | 
			
		||||
  g_main_loop_run (loop);
 | 
			
		||||
 | 
			
		||||
  _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.
 | 
			
		||||
   */
 | 
			
		||||
  result = g_dbus_connection_invoke_method_sync (c1,
 | 
			
		||||
                                                 "org.freedesktop.DBus",  /* bus name */
 | 
			
		||||
                                                 "/org/freedesktop/DBus", /* object path */
 | 
			
		||||
                                                 "org.freedesktop.DBus",  /* interface name */
 | 
			
		||||
                                                 "GetId",                 /* method name */
 | 
			
		||||
                                                 NULL,                    /* parameters */
 | 
			
		||||
                                                 G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                                                 -1,
 | 
			
		||||
                                                 NULL,
 | 
			
		||||
                                                 &error);
 | 
			
		||||
  result = g_dbus_connection_call_sync (c1,
 | 
			
		||||
                                        "org.freedesktop.DBus",  /* bus name */
 | 
			
		||||
                                        "/org/freedesktop/DBus", /* object path */
 | 
			
		||||
                                        "org.freedesktop.DBus",  /* interface name */
 | 
			
		||||
                                        "GetId",                 /* method name */
 | 
			
		||||
                                        NULL,                    /* parameters */
 | 
			
		||||
                                        G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                                        -1,
 | 
			
		||||
                                        NULL,
 | 
			
		||||
                                        &error);
 | 
			
		||||
  g_assert_no_error (error);
 | 
			
		||||
  g_assert (result != NULL);
 | 
			
		||||
  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);
 | 
			
		||||
 | 
			
		||||
      greeting = g_strdup_printf ("Hey, it's %" G_GUINT64_FORMAT " already!", (guint64) time (NULL));
 | 
			
		||||
      value = g_dbus_connection_invoke_method_sync (connection,
 | 
			
		||||
                                                    NULL, /* bus_name */
 | 
			
		||||
                                                    "/org/gtk/GDBus/TestObject",
 | 
			
		||||
                                                    "org.gtk.GDBus.TestPeerInterface",
 | 
			
		||||
                                                    "HelloWorld",
 | 
			
		||||
                                                    g_variant_new ("(s)", greeting),
 | 
			
		||||
                                                    G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                                                    -1,
 | 
			
		||||
                                                    NULL,
 | 
			
		||||
                                                    &error);
 | 
			
		||||
      value = g_dbus_connection_call_sync (connection,
 | 
			
		||||
                                           NULL, /* bus_name */
 | 
			
		||||
                                           "/org/gtk/GDBus/TestObject",
 | 
			
		||||
                                           "org.gtk.GDBus.TestPeerInterface",
 | 
			
		||||
                                           "HelloWorld",
 | 
			
		||||
                                           g_variant_new ("(s)", greeting),
 | 
			
		||||
                                           G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                                           -1,
 | 
			
		||||
                                           NULL,
 | 
			
		||||
                                           &error);
 | 
			
		||||
      if (value == NULL)
 | 
			
		||||
        {
 | 
			
		||||
          g_printerr ("Error invoking HelloWorld(): %s\n", error->message);
 | 
			
		||||
 
 | 
			
		||||
@@ -320,7 +320,7 @@ introspect_callback (GDBusProxy   *proxy,
 | 
			
		||||
  GError *error;
 | 
			
		||||
 | 
			
		||||
  error = NULL;
 | 
			
		||||
  result = g_dbus_proxy_invoke_method_finish (proxy,
 | 
			
		||||
  result = g_dbus_proxy_call_finish (proxy,
 | 
			
		||||
                                              res,
 | 
			
		||||
                                              &error);
 | 
			
		||||
  g_assert_no_error (error);
 | 
			
		||||
@@ -359,14 +359,14 @@ get_nodes_at (GDBusConnection  *c,
 | 
			
		||||
 | 
			
		||||
  /* do this async to avoid libdbus-1 deadlocks */
 | 
			
		||||
  xml_data = NULL;
 | 
			
		||||
  g_dbus_proxy_invoke_method (proxy,
 | 
			
		||||
                              "Introspect",
 | 
			
		||||
                              NULL,
 | 
			
		||||
                              G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                              -1,
 | 
			
		||||
                              NULL,
 | 
			
		||||
                              (GAsyncReadyCallback) introspect_callback,
 | 
			
		||||
                              &xml_data);
 | 
			
		||||
  g_dbus_proxy_call (proxy,
 | 
			
		||||
                     "Introspect",
 | 
			
		||||
                     NULL,
 | 
			
		||||
                     G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                     -1,
 | 
			
		||||
                     NULL,
 | 
			
		||||
                     (GAsyncReadyCallback) introspect_callback,
 | 
			
		||||
                     &xml_data);
 | 
			
		||||
  g_main_loop_run (loop);
 | 
			
		||||
  g_assert (xml_data != NULL);
 | 
			
		||||
 | 
			
		||||
@@ -416,14 +416,14 @@ has_interface (GDBusConnection *c,
 | 
			
		||||
 | 
			
		||||
  /* do this async to avoid libdbus-1 deadlocks */
 | 
			
		||||
  xml_data = NULL;
 | 
			
		||||
  g_dbus_proxy_invoke_method (proxy,
 | 
			
		||||
                              "Introspect",
 | 
			
		||||
                              NULL,
 | 
			
		||||
                              G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                              -1,
 | 
			
		||||
                              NULL,
 | 
			
		||||
                              (GAsyncReadyCallback) introspect_callback,
 | 
			
		||||
                              &xml_data);
 | 
			
		||||
  g_dbus_proxy_call (proxy,
 | 
			
		||||
                     "Introspect",
 | 
			
		||||
                     NULL,
 | 
			
		||||
                     G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                     -1,
 | 
			
		||||
                     NULL,
 | 
			
		||||
                     (GAsyncReadyCallback) introspect_callback,
 | 
			
		||||
                     &xml_data);
 | 
			
		||||
  g_main_loop_run (loop);
 | 
			
		||||
  g_assert (xml_data != NULL);
 | 
			
		||||
 | 
			
		||||
@@ -466,14 +466,14 @@ count_interfaces (GDBusConnection *c,
 | 
			
		||||
 | 
			
		||||
  /* do this async to avoid libdbus-1 deadlocks */
 | 
			
		||||
  xml_data = NULL;
 | 
			
		||||
  g_dbus_proxy_invoke_method (proxy,
 | 
			
		||||
                              "Introspect",
 | 
			
		||||
                              NULL,
 | 
			
		||||
                              G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                              -1,
 | 
			
		||||
                              NULL,
 | 
			
		||||
                              (GAsyncReadyCallback) introspect_callback,
 | 
			
		||||
                              &xml_data);
 | 
			
		||||
  g_dbus_proxy_call (proxy,
 | 
			
		||||
                     "Introspect",
 | 
			
		||||
                     NULL,
 | 
			
		||||
                     G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                     -1,
 | 
			
		||||
                     NULL,
 | 
			
		||||
                     (GAsyncReadyCallback) introspect_callback,
 | 
			
		||||
                     &xml_data);
 | 
			
		||||
  g_main_loop_run (loop);
 | 
			
		||||
  g_assert (xml_data != NULL);
 | 
			
		||||
 | 
			
		||||
@@ -501,9 +501,9 @@ dyna_create_callback (GDBusProxy   *proxy,
 | 
			
		||||
  GError *error;
 | 
			
		||||
 | 
			
		||||
  error = NULL;
 | 
			
		||||
  result = g_dbus_proxy_invoke_method_finish (proxy,
 | 
			
		||||
                                              res,
 | 
			
		||||
                                              &error);
 | 
			
		||||
  result = g_dbus_proxy_call_finish (proxy,
 | 
			
		||||
                                     res,
 | 
			
		||||
                                     &error);
 | 
			
		||||
  g_assert_no_error (error);
 | 
			
		||||
  g_assert (result != NULL);
 | 
			
		||||
  g_variant_unref (result);
 | 
			
		||||
@@ -537,14 +537,14 @@ dyna_create (GDBusConnection *c,
 | 
			
		||||
  g_assert (proxy != NULL);
 | 
			
		||||
 | 
			
		||||
  /* do this async to avoid libdbus-1 deadlocks */
 | 
			
		||||
  g_dbus_proxy_invoke_method (proxy,
 | 
			
		||||
                              "DynaCyber",
 | 
			
		||||
                              g_variant_new ("()"),
 | 
			
		||||
                              G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                              -1,
 | 
			
		||||
                              NULL,
 | 
			
		||||
                              (GAsyncReadyCallback) dyna_create_callback,
 | 
			
		||||
                              NULL);
 | 
			
		||||
  g_dbus_proxy_call (proxy,
 | 
			
		||||
                     "DynaCyber",
 | 
			
		||||
                     g_variant_new ("()"),
 | 
			
		||||
                     G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                     -1,
 | 
			
		||||
                     NULL,
 | 
			
		||||
                     (GAsyncReadyCallback) dyna_create_callback,
 | 
			
		||||
                     NULL);
 | 
			
		||||
  g_main_loop_run (loop);
 | 
			
		||||
 | 
			
		||||
  g_assert_no_error (error);
 | 
			
		||||
@@ -760,26 +760,26 @@ test_dispatch_thread_func (gpointer user_data)
 | 
			
		||||
 | 
			
		||||
  /* generic interfaces */
 | 
			
		||||
  error = NULL;
 | 
			
		||||
  value = g_dbus_proxy_invoke_method_sync (foo_proxy,
 | 
			
		||||
                                           "org.freedesktop.DBus.Peer.Ping",
 | 
			
		||||
                                           NULL,
 | 
			
		||||
                                           G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                                           -1,
 | 
			
		||||
                                           NULL,
 | 
			
		||||
                                           &error);
 | 
			
		||||
  value = g_dbus_proxy_call_sync (foo_proxy,
 | 
			
		||||
                                  "org.freedesktop.DBus.Peer.Ping",
 | 
			
		||||
                                  NULL,
 | 
			
		||||
                                  G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                                  -1,
 | 
			
		||||
                                  NULL,
 | 
			
		||||
                                  &error);
 | 
			
		||||
  g_assert_no_error (error);
 | 
			
		||||
  g_assert (value != NULL);
 | 
			
		||||
  g_variant_unref (value);
 | 
			
		||||
 | 
			
		||||
  /* user methods */
 | 
			
		||||
  error = NULL;
 | 
			
		||||
  value = g_dbus_proxy_invoke_method_sync (foo_proxy,
 | 
			
		||||
                                           "Method1",
 | 
			
		||||
                                           g_variant_new ("(s)", "winwinwin"),
 | 
			
		||||
                                           G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                                           -1,
 | 
			
		||||
                                           NULL,
 | 
			
		||||
                                           &error);
 | 
			
		||||
  value = g_dbus_proxy_call_sync (foo_proxy,
 | 
			
		||||
                                  "Method1",
 | 
			
		||||
                                  g_variant_new ("(s)", "winwinwin"),
 | 
			
		||||
                                  G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                                  -1,
 | 
			
		||||
                                  NULL,
 | 
			
		||||
                                  &error);
 | 
			
		||||
  g_assert_no_error (error);
 | 
			
		||||
  g_assert (value != NULL);
 | 
			
		||||
  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);
 | 
			
		||||
 | 
			
		||||
  error = NULL;
 | 
			
		||||
  value = g_dbus_proxy_invoke_method_sync (foo_proxy,
 | 
			
		||||
                                           "Method2",
 | 
			
		||||
                                           NULL,
 | 
			
		||||
                                           G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                                           -1,
 | 
			
		||||
                                           NULL,
 | 
			
		||||
                                           &error);
 | 
			
		||||
  value = g_dbus_proxy_call_sync (foo_proxy,
 | 
			
		||||
                                  "Method2",
 | 
			
		||||
                                  NULL,
 | 
			
		||||
                                  G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                                  -1,
 | 
			
		||||
                                  NULL,
 | 
			
		||||
                                  &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_error_free (error);
 | 
			
		||||
  g_assert (value == NULL);
 | 
			
		||||
 | 
			
		||||
  error = NULL;
 | 
			
		||||
  value = g_dbus_proxy_invoke_method_sync (foo_proxy,
 | 
			
		||||
                                           "Method2",
 | 
			
		||||
                                           g_variant_new ("(s)", "failfailfail"),
 | 
			
		||||
                                           G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                                           -1,
 | 
			
		||||
                                           NULL,
 | 
			
		||||
                                           &error);
 | 
			
		||||
  value = g_dbus_proxy_call_sync (foo_proxy,
 | 
			
		||||
                                  "Method2",
 | 
			
		||||
                                  g_variant_new ("(s)", "failfailfail"),
 | 
			
		||||
                                  G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                                  -1,
 | 
			
		||||
                                  NULL,
 | 
			
		||||
                                  &error);
 | 
			
		||||
  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_error_free (error);
 | 
			
		||||
  g_assert (value == NULL);
 | 
			
		||||
 | 
			
		||||
  error = NULL;
 | 
			
		||||
  value = g_dbus_proxy_invoke_method_sync (foo_proxy,
 | 
			
		||||
                                           "NonExistantMethod",
 | 
			
		||||
                                           NULL,
 | 
			
		||||
                                           G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                                           -1,
 | 
			
		||||
                                           NULL,
 | 
			
		||||
                                           &error);
 | 
			
		||||
  value = g_dbus_proxy_call_sync (foo_proxy,
 | 
			
		||||
                                  "NonExistantMethod",
 | 
			
		||||
                                  NULL,
 | 
			
		||||
                                  G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                                  -1,
 | 
			
		||||
                                  NULL,
 | 
			
		||||
                                  &error);
 | 
			
		||||
  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_error_free (error);
 | 
			
		||||
@@ -828,15 +828,15 @@ test_dispatch_thread_func (gpointer user_data)
 | 
			
		||||
 | 
			
		||||
  /* user properties */
 | 
			
		||||
  error = NULL;
 | 
			
		||||
  value = g_dbus_proxy_invoke_method_sync (foo_proxy,
 | 
			
		||||
                                           "org.freedesktop.DBus.Properties.Get",
 | 
			
		||||
                                           g_variant_new ("(ss)",
 | 
			
		||||
                                                          "org.example.Foo",
 | 
			
		||||
                                                          "PropertyUno"),
 | 
			
		||||
                                           G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                                           -1,
 | 
			
		||||
                                           NULL,
 | 
			
		||||
                                           &error);
 | 
			
		||||
  value = g_dbus_proxy_call_sync (foo_proxy,
 | 
			
		||||
                                  "org.freedesktop.DBus.Properties.Get",
 | 
			
		||||
                                  g_variant_new ("(ss)",
 | 
			
		||||
                                                 "org.example.Foo",
 | 
			
		||||
                                                 "PropertyUno"),
 | 
			
		||||
                                  G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                                  -1,
 | 
			
		||||
                                  NULL,
 | 
			
		||||
                                  &error);
 | 
			
		||||
  g_assert_no_error (error);
 | 
			
		||||
  g_assert (value != NULL);
 | 
			
		||||
  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);
 | 
			
		||||
 | 
			
		||||
  error = NULL;
 | 
			
		||||
  value = g_dbus_proxy_invoke_method_sync (foo_proxy,
 | 
			
		||||
                                           "org.freedesktop.DBus.Properties.Get",
 | 
			
		||||
                                           g_variant_new ("(ss)",
 | 
			
		||||
                                                          "org.example.Foo",
 | 
			
		||||
                                                          "ThisDoesntExist"),
 | 
			
		||||
                                           G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                                           -1,
 | 
			
		||||
                                           NULL,
 | 
			
		||||
                                           &error);
 | 
			
		||||
  value = g_dbus_proxy_call_sync (foo_proxy,
 | 
			
		||||
                                  "org.freedesktop.DBus.Properties.Get",
 | 
			
		||||
                                  g_variant_new ("(ss)",
 | 
			
		||||
                                                 "org.example.Foo",
 | 
			
		||||
                                                 "ThisDoesntExist"),
 | 
			
		||||
                                  G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                                  -1,
 | 
			
		||||
                                  NULL,
 | 
			
		||||
                                  &error);
 | 
			
		||||
  g_assert (value == NULL);
 | 
			
		||||
  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_error_free (error);
 | 
			
		||||
 | 
			
		||||
  error = NULL;
 | 
			
		||||
  value = g_dbus_proxy_invoke_method_sync (foo_proxy,
 | 
			
		||||
                                           "org.freedesktop.DBus.Properties.Get",
 | 
			
		||||
                                           g_variant_new ("(ss)",
 | 
			
		||||
                                                          "org.example.Foo",
 | 
			
		||||
                                                          "NotReadable"),
 | 
			
		||||
                                           G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                                           -1,
 | 
			
		||||
                                           NULL,
 | 
			
		||||
                                           &error);
 | 
			
		||||
  value = g_dbus_proxy_call_sync (foo_proxy,
 | 
			
		||||
                                  "org.freedesktop.DBus.Properties.Get",
 | 
			
		||||
                                  g_variant_new ("(ss)",
 | 
			
		||||
                                                 "org.example.Foo",
 | 
			
		||||
                                                 "NotReadable"),
 | 
			
		||||
                                  G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                                  -1,
 | 
			
		||||
                                  NULL,
 | 
			
		||||
                                  &error);
 | 
			
		||||
  g_assert (value == NULL);
 | 
			
		||||
  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_error_free (error);
 | 
			
		||||
 | 
			
		||||
  error = NULL;
 | 
			
		||||
  value = g_dbus_proxy_invoke_method_sync (foo_proxy,
 | 
			
		||||
                                           "org.freedesktop.DBus.Properties.Set",
 | 
			
		||||
                                           g_variant_new ("(ssv)",
 | 
			
		||||
                                                          "org.example.Foo",
 | 
			
		||||
                                                          "NotReadable",
 | 
			
		||||
                                                          g_variant_new_string ("But Writable you are!")),
 | 
			
		||||
                                           G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                                           -1,
 | 
			
		||||
                                           NULL,
 | 
			
		||||
                                           &error);
 | 
			
		||||
  value = g_dbus_proxy_call_sync (foo_proxy,
 | 
			
		||||
                                  "org.freedesktop.DBus.Properties.Set",
 | 
			
		||||
                                  g_variant_new ("(ssv)",
 | 
			
		||||
                                                 "org.example.Foo",
 | 
			
		||||
                                                 "NotReadable",
 | 
			
		||||
                                                 g_variant_new_string ("But Writable you are!")),
 | 
			
		||||
                                  G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                                  -1,
 | 
			
		||||
                                  NULL,
 | 
			
		||||
                                  &error);
 | 
			
		||||
  g_assert (value == NULL);
 | 
			
		||||
  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_error_free (error);
 | 
			
		||||
 | 
			
		||||
  error = NULL;
 | 
			
		||||
  value = g_dbus_proxy_invoke_method_sync (foo_proxy,
 | 
			
		||||
                                           "org.freedesktop.DBus.Properties.Set",
 | 
			
		||||
                                           g_variant_new ("(ssv)",
 | 
			
		||||
                                                          "org.example.Foo",
 | 
			
		||||
                                                          "NotWritable",
 | 
			
		||||
                                                          g_variant_new_uint32 (42)),
 | 
			
		||||
                                           G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                                           -1,
 | 
			
		||||
                                           NULL,
 | 
			
		||||
                                           &error);
 | 
			
		||||
  value = g_dbus_proxy_call_sync (foo_proxy,
 | 
			
		||||
                                  "org.freedesktop.DBus.Properties.Set",
 | 
			
		||||
                                  g_variant_new ("(ssv)",
 | 
			
		||||
                                                 "org.example.Foo",
 | 
			
		||||
                                                 "NotWritable",
 | 
			
		||||
                                                 g_variant_new_uint32 (42)),
 | 
			
		||||
                                  G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                                  -1,
 | 
			
		||||
                                  NULL,
 | 
			
		||||
                                  &error);
 | 
			
		||||
  g_assert (value == NULL);
 | 
			
		||||
  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_error_free (error);
 | 
			
		||||
 | 
			
		||||
  error = NULL;
 | 
			
		||||
  value = g_dbus_proxy_invoke_method_sync (foo_proxy,
 | 
			
		||||
                                           "org.freedesktop.DBus.Properties.GetAll",
 | 
			
		||||
                                           g_variant_new ("(s)",
 | 
			
		||||
                                                          "org.example.Foo"),
 | 
			
		||||
                                           G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                                           -1,
 | 
			
		||||
                                           NULL,
 | 
			
		||||
                                           &error);
 | 
			
		||||
  value = g_dbus_proxy_call_sync (foo_proxy,
 | 
			
		||||
                                  "org.freedesktop.DBus.Properties.GetAll",
 | 
			
		||||
                                  g_variant_new ("(s)",
 | 
			
		||||
                                                 "org.example.Foo"),
 | 
			
		||||
                                  G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                                  -1,
 | 
			
		||||
                                  NULL,
 | 
			
		||||
                                  &error);
 | 
			
		||||
  g_assert_no_error (error);
 | 
			
		||||
  g_assert (value != NULL);
 | 
			
		||||
  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.
 | 
			
		||||
   */
 | 
			
		||||
  result = g_dbus_proxy_invoke_method_sync (proxy,
 | 
			
		||||
                                            "org.freedesktop.DBus.Introspectable.Introspect",
 | 
			
		||||
                                            NULL,
 | 
			
		||||
                                            G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                                            -1,
 | 
			
		||||
                                            NULL,
 | 
			
		||||
                                            &error);
 | 
			
		||||
  result = g_dbus_proxy_call_sync (proxy,
 | 
			
		||||
                                   "org.freedesktop.DBus.Introspectable.Introspect",
 | 
			
		||||
                                   NULL,
 | 
			
		||||
                                   G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                                   -1,
 | 
			
		||||
                                   NULL,
 | 
			
		||||
                                   &error);
 | 
			
		||||
  g_assert_no_error (error);
 | 
			
		||||
  g_assert (result != NULL);
 | 
			
		||||
  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);
 | 
			
		||||
  g_assert (c != NULL);
 | 
			
		||||
  g_assert (!g_dbus_connection_is_closed (c));
 | 
			
		||||
  result = g_dbus_connection_invoke_method_sync (c,
 | 
			
		||||
                                                 "org.freedesktop.DBus",  /* bus name */
 | 
			
		||||
                                                 "/org/freedesktop/DBus", /* object path */
 | 
			
		||||
                                                 "org.freedesktop.DBus",  /* interface name */
 | 
			
		||||
                                                 "NameHasOwner",          /* method name */
 | 
			
		||||
                                                 g_variant_new ("(s)", name),
 | 
			
		||||
                                                 G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                                                 -1,
 | 
			
		||||
                                                 NULL,
 | 
			
		||||
                                                 &error);
 | 
			
		||||
  result = g_dbus_connection_call_sync (c,
 | 
			
		||||
                                        "org.freedesktop.DBus",  /* bus name */
 | 
			
		||||
                                        "/org/freedesktop/DBus", /* object path */
 | 
			
		||||
                                        "org.freedesktop.DBus",  /* interface name */
 | 
			
		||||
                                        "NameHasOwner",          /* method name */
 | 
			
		||||
                                        g_variant_new ("(s)", name),
 | 
			
		||||
                                        G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                                        -1,
 | 
			
		||||
                                        NULL,
 | 
			
		||||
                                        &error);
 | 
			
		||||
  g_assert_no_error (error);
 | 
			
		||||
  g_assert (result != NULL);
 | 
			
		||||
  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.
 | 
			
		||||
   */
 | 
			
		||||
  result = g_dbus_connection_invoke_method_sync (c,
 | 
			
		||||
                                                 "org.freedesktop.DBus",  /* bus name */
 | 
			
		||||
                                                 "/org/freedesktop/DBus", /* object path */
 | 
			
		||||
                                                 "org.freedesktop.DBus",  /* interface name */
 | 
			
		||||
                                                 "NameHasOwner",          /* method name */
 | 
			
		||||
                                                 g_variant_new ("(s)", name),
 | 
			
		||||
                                                 G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                                                 -1,
 | 
			
		||||
                                                 NULL,
 | 
			
		||||
                                                 &error);
 | 
			
		||||
  result = g_dbus_connection_call_sync (c,
 | 
			
		||||
                                        "org.freedesktop.DBus",  /* bus name */
 | 
			
		||||
                                        "/org/freedesktop/DBus", /* object path */
 | 
			
		||||
                                        "org.freedesktop.DBus",  /* interface name */
 | 
			
		||||
                                        "NameHasOwner",          /* method name */
 | 
			
		||||
                                        g_variant_new ("(s)", name),
 | 
			
		||||
                                        G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                                        -1,
 | 
			
		||||
                                        NULL,
 | 
			
		||||
                                        &error);
 | 
			
		||||
  g_assert_no_error (error);
 | 
			
		||||
  g_assert (result != NULL);
 | 
			
		||||
  g_variant_get (result, "(b)", &name_has_owner_reply);
 | 
			
		||||
 
 | 
			
		||||
@@ -537,13 +537,13 @@ test_peer (void)
 | 
			
		||||
 | 
			
		||||
  /* try invoking a method */
 | 
			
		||||
  error = NULL;
 | 
			
		||||
  result = g_dbus_proxy_invoke_method_sync (proxy,
 | 
			
		||||
                                            "HelloPeer",
 | 
			
		||||
                                            g_variant_new ("(s)", "Hey Peer!"),
 | 
			
		||||
                                            G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                                            -1,
 | 
			
		||||
                                            NULL,  /* GCancellable */
 | 
			
		||||
                                            &error);
 | 
			
		||||
  result = g_dbus_proxy_call_sync (proxy,
 | 
			
		||||
                                   "HelloPeer",
 | 
			
		||||
                                   g_variant_new ("(s)", "Hey Peer!"),
 | 
			
		||||
                                   G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                                   -1,
 | 
			
		||||
                                   NULL,  /* GCancellable */
 | 
			
		||||
                                   &error);
 | 
			
		||||
  g_assert_no_error (error);
 | 
			
		||||
  g_variant_get (result, "(s)", &s);
 | 
			
		||||
  g_assert_cmpstr (s, ==, "You greeted me with 'Hey Peer!'.");
 | 
			
		||||
@@ -556,14 +556,14 @@ test_peer (void)
 | 
			
		||||
                    G_CALLBACK (on_proxy_signal_received),
 | 
			
		||||
                    &data);
 | 
			
		||||
  g_assert (!data.signal_received);
 | 
			
		||||
  g_dbus_proxy_invoke_method (proxy,
 | 
			
		||||
                              "EmitSignal",
 | 
			
		||||
                              NULL,  /* no arguments */
 | 
			
		||||
                              G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                              -1,
 | 
			
		||||
                              NULL,  /* GCancellable */
 | 
			
		||||
                              NULL,  /* GAsyncReadyCallback - we don't care about the result */
 | 
			
		||||
                              NULL); /* user_data */
 | 
			
		||||
  g_dbus_proxy_call (proxy,
 | 
			
		||||
                     "EmitSignal",
 | 
			
		||||
                     NULL,  /* no arguments */
 | 
			
		||||
                     G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                     -1,
 | 
			
		||||
                     NULL,  /* GCancellable */
 | 
			
		||||
                     NULL,  /* GAsyncReadyCallback - we don't care about the result */
 | 
			
		||||
                     NULL); /* user_data */
 | 
			
		||||
  g_main_loop_run (loop);
 | 
			
		||||
  g_assert (data.signal_received);
 | 
			
		||||
  g_assert_cmpint (data.num_method_calls, ==, 2);
 | 
			
		||||
@@ -679,13 +679,13 @@ test_peer (void)
 | 
			
		||||
  server = NULL;
 | 
			
		||||
 | 
			
		||||
  error = NULL;
 | 
			
		||||
  result = g_dbus_proxy_invoke_method_sync (proxy,
 | 
			
		||||
                                            "HelloPeer",
 | 
			
		||||
                                            g_variant_new ("(s)", "Hey Again Peer!"),
 | 
			
		||||
                                            G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                                            -1,
 | 
			
		||||
                                            NULL,  /* GCancellable */
 | 
			
		||||
                                            &error);
 | 
			
		||||
  result = g_dbus_proxy_call_sync (proxy,
 | 
			
		||||
                                   "HelloPeer",
 | 
			
		||||
                                   g_variant_new ("(s)", "Hey Again Peer!"),
 | 
			
		||||
                                   G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                                   -1,
 | 
			
		||||
                                   NULL,  /* GCancellable */
 | 
			
		||||
                                   &error);
 | 
			
		||||
  g_assert_no_error (error);
 | 
			
		||||
  g_variant_get (result, "(s)", &s);
 | 
			
		||||
  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 */
 | 
			
		||||
  error = NULL;
 | 
			
		||||
  result = g_dbus_proxy_invoke_method_sync (proxy,
 | 
			
		||||
                                            "HelloWorld",
 | 
			
		||||
                                            g_variant_new ("(s)", "Hey"),
 | 
			
		||||
                                            G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                                            -1,
 | 
			
		||||
                                            NULL,
 | 
			
		||||
                                            &error);
 | 
			
		||||
  result = g_dbus_proxy_call_sync (proxy,
 | 
			
		||||
                                   "HelloWorld",
 | 
			
		||||
                                   g_variant_new ("(s)", "Hey"),
 | 
			
		||||
                                   G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                                   -1,
 | 
			
		||||
                                   NULL,
 | 
			
		||||
                                   &error);
 | 
			
		||||
  g_assert_no_error (error);
 | 
			
		||||
  g_assert (result != NULL);
 | 
			
		||||
  g_assert_cmpstr (g_variant_get_type_string (result), ==, "(s)");
 | 
			
		||||
@@ -61,13 +61,13 @@ test_methods (GDBusConnection *connection,
 | 
			
		||||
  g_variant_unref (result);
 | 
			
		||||
 | 
			
		||||
  /* Check that we can completely recover the returned error */
 | 
			
		||||
  result = g_dbus_proxy_invoke_method_sync (proxy,
 | 
			
		||||
                                            "HelloWorld",
 | 
			
		||||
                                            g_variant_new ("(s)", "Yo"),
 | 
			
		||||
                                            G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                                            -1,
 | 
			
		||||
                                            NULL,
 | 
			
		||||
                                            &error);
 | 
			
		||||
  result = g_dbus_proxy_call_sync (proxy,
 | 
			
		||||
                                   "HelloWorld",
 | 
			
		||||
                                   g_variant_new ("(s)", "Yo"),
 | 
			
		||||
                                   G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                                   -1,
 | 
			
		||||
                                   NULL,
 | 
			
		||||
                                   &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));
 | 
			
		||||
@@ -81,13 +81,13 @@ test_methods (GDBusConnection *connection,
 | 
			
		||||
 | 
			
		||||
  /* Check that we get a timeout if the method handling is taking longer than timeout */
 | 
			
		||||
  error = NULL;
 | 
			
		||||
  result = g_dbus_proxy_invoke_method_sync (proxy,
 | 
			
		||||
                                            "Sleep",
 | 
			
		||||
                                            g_variant_new ("(i)", 500 /* msec */),
 | 
			
		||||
                                            G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                                            100 /* msec */,
 | 
			
		||||
                                            NULL,
 | 
			
		||||
                                            &error);
 | 
			
		||||
  result = g_dbus_proxy_call_sync (proxy,
 | 
			
		||||
                                   "Sleep",
 | 
			
		||||
                                   g_variant_new ("(i)", 500 /* msec */),
 | 
			
		||||
                                   G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                                   100 /* msec */,
 | 
			
		||||
                                   NULL,
 | 
			
		||||
                                   &error);
 | 
			
		||||
  g_assert_error (error, G_IO_ERROR, G_IO_ERROR_TIMED_OUT);
 | 
			
		||||
  g_assert (!g_dbus_error_is_remote_error (error));
 | 
			
		||||
  g_assert (result == NULL);
 | 
			
		||||
@@ -97,13 +97,13 @@ test_methods (GDBusConnection *connection,
 | 
			
		||||
  g_assert_cmpint (g_dbus_proxy_get_default_timeout (proxy), ==, -1);
 | 
			
		||||
 | 
			
		||||
  /* the default timeout is 25000 msec so this should work */
 | 
			
		||||
  result = g_dbus_proxy_invoke_method_sync (proxy,
 | 
			
		||||
                                            "Sleep",
 | 
			
		||||
                                            g_variant_new ("(i)", 500 /* msec */),
 | 
			
		||||
                                            G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                                            -1, /* use proxy default (e.g. -1 -> e.g. 25000 msec) */
 | 
			
		||||
                                            NULL,
 | 
			
		||||
                                            &error);
 | 
			
		||||
  result = g_dbus_proxy_call_sync (proxy,
 | 
			
		||||
                                   "Sleep",
 | 
			
		||||
                                   g_variant_new ("(i)", 500 /* msec */),
 | 
			
		||||
                                   G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                                   -1, /* use proxy default (e.g. -1 -> e.g. 25000 msec) */
 | 
			
		||||
                                   NULL,
 | 
			
		||||
                                   &error);
 | 
			
		||||
  g_assert_no_error (error);
 | 
			
		||||
  g_assert (result != NULL);
 | 
			
		||||
  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 */
 | 
			
		||||
  g_dbus_proxy_set_default_timeout (proxy, 250);
 | 
			
		||||
  g_assert_cmpint (g_dbus_proxy_get_default_timeout (proxy), ==, 250);
 | 
			
		||||
  result = g_dbus_proxy_invoke_method_sync (proxy,
 | 
			
		||||
                                            "Sleep",
 | 
			
		||||
                                            g_variant_new ("(i)", 500 /* msec */),
 | 
			
		||||
                                            G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                                            -1, /* use proxy default (e.g. 250 msec) */
 | 
			
		||||
                                            NULL,
 | 
			
		||||
                                            &error);
 | 
			
		||||
  result = g_dbus_proxy_call_sync (proxy,
 | 
			
		||||
                                   "Sleep",
 | 
			
		||||
                                   g_variant_new ("(i)", 500 /* msec */),
 | 
			
		||||
                                   G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                                   -1, /* use proxy default (e.g. 250 msec) */
 | 
			
		||||
                                   NULL,
 | 
			
		||||
                                   &error);
 | 
			
		||||
  g_assert_error (error, G_IO_ERROR, G_IO_ERROR_TIMED_OUT);
 | 
			
		||||
  g_assert (!g_dbus_error_is_remote_error (error));
 | 
			
		||||
  g_assert (result == NULL);
 | 
			
		||||
@@ -166,15 +166,15 @@ test_properties (GDBusConnection *connection,
 | 
			
		||||
   * is received. Also check that the cache is updated.
 | 
			
		||||
   */
 | 
			
		||||
  variant2 = g_variant_new_byte (42);
 | 
			
		||||
  result = g_dbus_proxy_invoke_method_sync (proxy,
 | 
			
		||||
                                            "FrobSetProperty",
 | 
			
		||||
                                            g_variant_new ("(sv)",
 | 
			
		||||
                                                           "y",
 | 
			
		||||
                                                           variant2),
 | 
			
		||||
                                            G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                                            -1,
 | 
			
		||||
                                            NULL,
 | 
			
		||||
                                            &error);
 | 
			
		||||
  result = g_dbus_proxy_call_sync (proxy,
 | 
			
		||||
                                   "FrobSetProperty",
 | 
			
		||||
                                   g_variant_new ("(sv)",
 | 
			
		||||
                                                  "y",
 | 
			
		||||
                                                  variant2),
 | 
			
		||||
                                   G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                                   -1,
 | 
			
		||||
                                   NULL,
 | 
			
		||||
                                   &error);
 | 
			
		||||
  g_assert_no_error (error);
 | 
			
		||||
  g_assert (result != NULL);
 | 
			
		||||
  g_assert_cmpstr (g_variant_get_type_string (result), ==, "()");
 | 
			
		||||
@@ -222,9 +222,9 @@ test_proxy_signals_on_emit_signal_cb (GDBusProxy   *proxy,
 | 
			
		||||
  GVariant *result;
 | 
			
		||||
 | 
			
		||||
  error = NULL;
 | 
			
		||||
  result = g_dbus_proxy_invoke_method_finish (proxy,
 | 
			
		||||
                                              res,
 | 
			
		||||
                                              &error);
 | 
			
		||||
  result = g_dbus_proxy_call_finish (proxy,
 | 
			
		||||
                                     res,
 | 
			
		||||
                                     &error);
 | 
			
		||||
  g_assert_no_error (error);
 | 
			
		||||
  g_assert (result != NULL);
 | 
			
		||||
  g_assert_cmpstr (g_variant_get_type_string (result), ==, "()");
 | 
			
		||||
@@ -263,15 +263,15 @@ test_signals (GDBusConnection *connection,
 | 
			
		||||
                                        G_CALLBACK (test_proxy_signals_on_signal),
 | 
			
		||||
                                        s);
 | 
			
		||||
 | 
			
		||||
  result = g_dbus_proxy_invoke_method_sync (proxy,
 | 
			
		||||
                                            "EmitSignal",
 | 
			
		||||
                                            g_variant_new ("(so)",
 | 
			
		||||
                                                           "Accept the next proposition you hear",
 | 
			
		||||
                                                           "/some/path"),
 | 
			
		||||
                                            G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                                            -1,
 | 
			
		||||
                                            NULL,
 | 
			
		||||
                                            &error);
 | 
			
		||||
  result = g_dbus_proxy_call_sync (proxy,
 | 
			
		||||
                                   "EmitSignal",
 | 
			
		||||
                                   g_variant_new ("(so)",
 | 
			
		||||
                                                  "Accept the next proposition you hear",
 | 
			
		||||
                                                  "/some/path"),
 | 
			
		||||
                                   G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                                   -1,
 | 
			
		||||
                                   NULL,
 | 
			
		||||
                                   &error);
 | 
			
		||||
  g_assert_no_error (error);
 | 
			
		||||
  g_assert (result != NULL);
 | 
			
		||||
  g_assert_cmpstr (g_variant_get_type_string (result), ==, "()");
 | 
			
		||||
@@ -296,16 +296,16 @@ test_signals (GDBusConnection *connection,
 | 
			
		||||
                                        "g-signal",
 | 
			
		||||
                                        G_CALLBACK (test_proxy_signals_on_signal),
 | 
			
		||||
                                        s);
 | 
			
		||||
  g_dbus_proxy_invoke_method (proxy,
 | 
			
		||||
                              "EmitSignal",
 | 
			
		||||
                              g_variant_new ("(so)",
 | 
			
		||||
                                             "You will make a great programmer",
 | 
			
		||||
                                             "/some/other/path"),
 | 
			
		||||
                              G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                              -1,
 | 
			
		||||
                              NULL,
 | 
			
		||||
                              (GAsyncReadyCallback) test_proxy_signals_on_emit_signal_cb,
 | 
			
		||||
                              &data);
 | 
			
		||||
  g_dbus_proxy_call (proxy,
 | 
			
		||||
                     "EmitSignal",
 | 
			
		||||
                     g_variant_new ("(so)",
 | 
			
		||||
                                    "You will make a great programmer",
 | 
			
		||||
                                    "/some/other/path"),
 | 
			
		||||
                     G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                     -1,
 | 
			
		||||
                     NULL,
 | 
			
		||||
                     (GAsyncReadyCallback) test_proxy_signals_on_emit_signal_cb,
 | 
			
		||||
                     &data);
 | 
			
		||||
  g_main_loop_run (data.internal_loop);
 | 
			
		||||
  g_main_loop_unref (data.internal_loop);
 | 
			
		||||
  g_assert_cmpstr (s->str,
 | 
			
		||||
@@ -324,13 +324,13 @@ test_bogus_method_return (GDBusConnection *connection,
 | 
			
		||||
  GError *error = NULL;
 | 
			
		||||
  GVariant *result;
 | 
			
		||||
 | 
			
		||||
  result = g_dbus_proxy_invoke_method_sync (proxy,
 | 
			
		||||
                                            "PairReturn",
 | 
			
		||||
                                            NULL,
 | 
			
		||||
                                            G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                                            -1,
 | 
			
		||||
                                            NULL,
 | 
			
		||||
                                            &error);
 | 
			
		||||
  result = g_dbus_proxy_call_sync (proxy,
 | 
			
		||||
                                   "PairReturn",
 | 
			
		||||
                                   NULL,
 | 
			
		||||
                                   G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                                   -1,
 | 
			
		||||
                                   NULL,
 | 
			
		||||
                                   &error);
 | 
			
		||||
  g_assert_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT);
 | 
			
		||||
  g_assert (result == NULL);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -52,9 +52,9 @@ msg_cb_expect_success (GDBusConnection *connection,
 | 
			
		||||
  GVariant *result;
 | 
			
		||||
 | 
			
		||||
  error = NULL;
 | 
			
		||||
  result = g_dbus_connection_invoke_method_finish (connection,
 | 
			
		||||
                                                   res,
 | 
			
		||||
                                                   &error);
 | 
			
		||||
  result = g_dbus_connection_call_finish (connection,
 | 
			
		||||
                                          res,
 | 
			
		||||
                                          &error);
 | 
			
		||||
  g_assert_no_error (error);
 | 
			
		||||
  g_assert (result != NULL);
 | 
			
		||||
  g_variant_unref (result);
 | 
			
		||||
@@ -74,9 +74,9 @@ msg_cb_expect_error_cancelled (GDBusConnection *connection,
 | 
			
		||||
  GVariant *result;
 | 
			
		||||
 | 
			
		||||
  error = NULL;
 | 
			
		||||
  result = g_dbus_connection_invoke_method_finish (connection,
 | 
			
		||||
                                                   res,
 | 
			
		||||
                                                   &error);
 | 
			
		||||
  result = g_dbus_connection_call_finish (connection,
 | 
			
		||||
                                          res,
 | 
			
		||||
                                          &error);
 | 
			
		||||
  g_assert_error (error, G_IO_ERROR, G_IO_ERROR_CANCELLED);
 | 
			
		||||
  g_assert (!g_dbus_error_is_remote_error (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.
 | 
			
		||||
   */
 | 
			
		||||
  g_dbus_connection_invoke_method (c,
 | 
			
		||||
                                   "org.freedesktop.DBus",  /* bus_name */
 | 
			
		||||
                                   "/org/freedesktop/DBus", /* object path */
 | 
			
		||||
                                   "org.freedesktop.DBus",  /* interface name */
 | 
			
		||||
                                   "GetId",                 /* method name */
 | 
			
		||||
                                   NULL,
 | 
			
		||||
                                   G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                                   -1,
 | 
			
		||||
                                   NULL,
 | 
			
		||||
                                   (GAsyncReadyCallback) msg_cb_expect_success,
 | 
			
		||||
                                   &data);
 | 
			
		||||
  g_dbus_connection_call (c,
 | 
			
		||||
                          "org.freedesktop.DBus",  /* bus_name */
 | 
			
		||||
                          "/org/freedesktop/DBus", /* object path */
 | 
			
		||||
                          "org.freedesktop.DBus",  /* interface name */
 | 
			
		||||
                          "GetId",                 /* method name */
 | 
			
		||||
                          NULL,
 | 
			
		||||
                          G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                          -1,
 | 
			
		||||
                          NULL,
 | 
			
		||||
                          (GAsyncReadyCallback) msg_cb_expect_success,
 | 
			
		||||
                          &data);
 | 
			
		||||
  g_main_loop_run (thread_loop);
 | 
			
		||||
 | 
			
		||||
  /*
 | 
			
		||||
@@ -151,17 +151,17 @@ test_delivery_in_thread_func (gpointer _data)
 | 
			
		||||
   */
 | 
			
		||||
  ca = g_cancellable_new ();
 | 
			
		||||
  g_cancellable_cancel (ca);
 | 
			
		||||
  g_dbus_connection_invoke_method (c,
 | 
			
		||||
                                   "org.freedesktop.DBus",  /* bus_name */
 | 
			
		||||
                                   "/org/freedesktop/DBus", /* object path */
 | 
			
		||||
                                   "org.freedesktop.DBus",  /* interface name */
 | 
			
		||||
                                   "GetId",                 /* method name */
 | 
			
		||||
                                   NULL,
 | 
			
		||||
                                   G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                                   -1,
 | 
			
		||||
                                   ca,
 | 
			
		||||
                                   (GAsyncReadyCallback) msg_cb_expect_error_cancelled,
 | 
			
		||||
                                   &data);
 | 
			
		||||
  g_dbus_connection_call (c,
 | 
			
		||||
                          "org.freedesktop.DBus",  /* bus_name */
 | 
			
		||||
                          "/org/freedesktop/DBus", /* object path */
 | 
			
		||||
                          "org.freedesktop.DBus",  /* interface name */
 | 
			
		||||
                          "GetId",                 /* method name */
 | 
			
		||||
                          NULL,
 | 
			
		||||
                          G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                          -1,
 | 
			
		||||
                          ca,
 | 
			
		||||
                          (GAsyncReadyCallback) msg_cb_expect_error_cancelled,
 | 
			
		||||
                          &data);
 | 
			
		||||
  g_main_loop_run (thread_loop);
 | 
			
		||||
  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.
 | 
			
		||||
   */
 | 
			
		||||
  ca = g_cancellable_new ();
 | 
			
		||||
  g_dbus_connection_invoke_method (c,
 | 
			
		||||
                                   "org.freedesktop.DBus",  /* bus_name */
 | 
			
		||||
                                   "/org/freedesktop/DBus", /* object path */
 | 
			
		||||
                                   "org.freedesktop.DBus",  /* interface name */
 | 
			
		||||
                                   "GetId",                 /* method name */
 | 
			
		||||
                                   NULL,
 | 
			
		||||
                                   G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                                   -1,
 | 
			
		||||
                                   ca,
 | 
			
		||||
                                   (GAsyncReadyCallback) msg_cb_expect_error_cancelled,
 | 
			
		||||
                                   &data);
 | 
			
		||||
  g_dbus_connection_call (c,
 | 
			
		||||
                          "org.freedesktop.DBus",  /* bus_name */
 | 
			
		||||
                          "/org/freedesktop/DBus", /* object path */
 | 
			
		||||
                          "org.freedesktop.DBus",  /* interface name */
 | 
			
		||||
                          "GetId",                 /* method name */
 | 
			
		||||
                          NULL,
 | 
			
		||||
                          G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                          -1,
 | 
			
		||||
                          ca,
 | 
			
		||||
                          (GAsyncReadyCallback) msg_cb_expect_error_cancelled,
 | 
			
		||||
                          &data);
 | 
			
		||||
  g_cancellable_cancel (ca);
 | 
			
		||||
  g_main_loop_run (thread_loop);
 | 
			
		||||
  g_object_unref (ca);
 | 
			
		||||
@@ -269,9 +269,9 @@ sleep_cb (GDBusProxy   *proxy,
 | 
			
		||||
  GVariant *result;
 | 
			
		||||
 | 
			
		||||
  error = NULL;
 | 
			
		||||
  result = g_dbus_proxy_invoke_method_finish (proxy,
 | 
			
		||||
                                              res,
 | 
			
		||||
                                              &error);
 | 
			
		||||
  result = g_dbus_proxy_call_finish (proxy,
 | 
			
		||||
                                     res,
 | 
			
		||||
                                     &error);
 | 
			
		||||
  g_assert_no_error (error);
 | 
			
		||||
  g_assert (result != NULL);
 | 
			
		||||
  g_assert_cmpstr (g_variant_get_type_string (result), ==, "()");
 | 
			
		||||
@@ -302,14 +302,14 @@ test_sleep_in_thread_func (gpointer _data)
 | 
			
		||||
      if (data->async)
 | 
			
		||||
        {
 | 
			
		||||
          //g_debug ("invoking async (%p)", g_thread_self ());
 | 
			
		||||
          g_dbus_proxy_invoke_method (data->proxy,
 | 
			
		||||
                                      "Sleep",
 | 
			
		||||
                                      g_variant_new ("(i)", data->msec),
 | 
			
		||||
                                      G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                                      -1,
 | 
			
		||||
                                      NULL,
 | 
			
		||||
                                      (GAsyncReadyCallback) sleep_cb,
 | 
			
		||||
                                      data);
 | 
			
		||||
          g_dbus_proxy_call (data->proxy,
 | 
			
		||||
                             "Sleep",
 | 
			
		||||
                             g_variant_new ("(i)", data->msec),
 | 
			
		||||
                             G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                             -1,
 | 
			
		||||
                             NULL,
 | 
			
		||||
                             (GAsyncReadyCallback) sleep_cb,
 | 
			
		||||
                             data);
 | 
			
		||||
          g_main_loop_run (data->thread_loop);
 | 
			
		||||
          g_print ("A");
 | 
			
		||||
          //g_debug ("done invoking async (%p)", g_thread_self ());
 | 
			
		||||
@@ -321,13 +321,13 @@ test_sleep_in_thread_func (gpointer _data)
 | 
			
		||||
 | 
			
		||||
          error = NULL;
 | 
			
		||||
          //g_debug ("invoking sync (%p)", g_thread_self ());
 | 
			
		||||
          result = g_dbus_proxy_invoke_method_sync (data->proxy,
 | 
			
		||||
                                                    "Sleep",
 | 
			
		||||
                                                    g_variant_new ("(i)", data->msec),
 | 
			
		||||
                                                    G_DBUS_INVOKE_METHOD_FLAGS_NONE,
 | 
			
		||||
                                                    -1,
 | 
			
		||||
                                                    NULL,
 | 
			
		||||
                                                    &error);
 | 
			
		||||
          result = g_dbus_proxy_call_sync (data->proxy,
 | 
			
		||||
                                           "Sleep",
 | 
			
		||||
                                           g_variant_new ("(i)", data->msec),
 | 
			
		||||
                                           G_DBUS_CALL_FLAGS_NONE,
 | 
			
		||||
                                           -1,
 | 
			
		||||
                                           NULL,
 | 
			
		||||
                                           &error);
 | 
			
		||||
          g_print ("S");
 | 
			
		||||
          //g_debug ("done invoking sync (%p)", g_thread_self ());
 | 
			
		||||
          g_assert_no_error (error);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user