Client.async


Description:

[ CCode ( cname = "nm_client_new_async" , has_construct_function = false ) ]
public async Client.async (Cancellable? cancellable) throws Error

Creates a new Client asynchronously.

callback will be called when it is done. Use Client.async.end to get the result.

This does nothing beside calling new_async. You are free to call new_async or @new/g_async_initable_init_async() directly for more control, to set GObject properties or get access to the NMClient instance while it is still initializing.

Creating an Client instance can only fail for two reasons. First, if you didn't provide a nm_client_dbus_connection and the call to @get fails. You can avoid that by using new_async directly and set a D-Bus connection. Second, if you cancelled the creation. If you do that, then note that after the failure there might still be idle actions pending which keep get_main_context alive. That means, in that case you must continue iterating the context to avoid leaks. See get_context_busy_watcher.

Creating an Client instance when NetworkManager is not running does not cause a failure.

Parameters:

cancellable

a Cancellable, or null

callback

callback to call when the client is created

user_data

data for callback