Gio.DBusProxy.prototype.call_sync

function call_sync(method_name: String, parameters: GLib.Variant, flags: Gio.DBusCallFlags, timeout_msec: Number(gint), cancellable: Gio.Cancellable): GLib.Variant {
    // Gjs wrapper for g_dbus_proxy_call_sync()
}
  

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 Gio.IOErrorEnum.closed. If cancellable is canceled, the operation will fail with Gio.IOErrorEnum.cancelled. If parameters contains a value not compatible with the D-Bus protocol, the operation fails with Gio.IOErrorEnum.invalid_argument.

If the parameters GLib.Variant is floating, it is consumed. This allows convenient 'inline' use of GLib.Variant.new, e.g.: |[<!-- language="C" --> g_dbus_proxy_call_sync (proxy, "TwoStrings", g_variant_new ("(ss)", "Thing One", "Thing Two"), G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error); ]|

The calling thread is blocked until a reply is received. See Gio.DBusProxy.prototype.call for the asynchronous version of this method.

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

Since 2.26

method_name

Name of method to invoke.

parameters

A GLib.Variant tuple with parameters for the signal or null if not passing parameters.

flags

Flags from the Gio.DBusCallFlags enumeration.

timeout_msec

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

cancellable

A Gio.Cancellable or null.

Returns

null if @error is set. Otherwise a GLib.Variant tuple with return values. Free with GLib.Variant.prototype.unref.