connect_sync


Description:

[ Version ( since = "3.8" ) ]
public static BookClient connect_sync (Source source, uint32 wait_for_connected_seconds, Cancellable? cancellable = null) throws Error

Creates a new BookClient for source.

If an error occurs, the function will set error and return false.

Unlike with BookClient, there is no need to call open_sync after obtaining the BookClient.

The wait_for_connected_seconds argument had been added since 3.16, to let the caller decide how long to wait for the backend to fully connect to its (possibly remote) data store. This is required due to a change in the authentication process, which is fully asynchronous and done on the client side, while not every client is supposed to response to authentication requests. In case the backend will not connect within the set interval, then it is opened in an offline mode. A special value -1 can be used to not wait for the connected state at all.

For error handling convenience, any error message returned by this function will have a descriptive prefix that includes the display name of source.

Parameters:

source

an Source

wait_for_connected_seconds

timeout, in seconds, to wait for the backend to be fully connected

cancellable

optional Cancellable object, or null

Returns:

a new BookClient, or null on error