Synchronously invokes the method_name method on proxy.

If method_name contains any dots, then name is split into interface and method name parts. This allows using proxy for invoking methods on other interfaces.

If the gio.DBusConnection associated with proxy is disconnected then the operation will fail with G_IO_ERROR_CLOSED. If cancellable is canceled, the operation will fail with G_IO_ERROR_CANCELLED. If parameters contains a value not compatible with the D-Bus protocol, the operation fails with G_IO_ERROR_INVALID_ARGUMENT.

If the parameters glib.Variant is floating, it is consumed. This allows convenient 'inline' use of Variant.new, e.g.:

g_dbus_proxy_call_sync (proxy,
g_variant_new ("(ss)",
"Thing One",
"Thing Two"),

The calling thread is blocked until a reply is received. See g_dbus_proxy_call() for the asynchronous version of this method.

If proxy has an expected interface (see g-interface-info) and method_name is referenced by it, then the return value is checked against the return type.


methodName string

Name of method to invoke.

parameters Variant

A glib.Variant tuple with parameters for the signal or NULL if not passing parameters.

flags GDBusCallFlags

Flags from the GDBusCallFlags enumeration.

timeoutMsec int

The timeout in milliseconds (with G_MAXINT meaning "infinite") or -1 to use the proxy default timeout.

cancellable Cancellable

A gio.Cancellable or NULL.

Return Value

Type: Variant

NULL if error is set. Otherwise a glib.Variant tuple with return values. Free with Variant.unref.


GException on failure.