InitableIF.init

Initializes the object implementing the interface. The object must be initialized before any real use after initial construction, either with this function or g_async_initable_init_async(). Implementations may also support cancellation. If cancellable is not NULL, then initialization can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED will be returned. If cancellable is not NULL and the object doesn't support cancellable initialization the error G_IO_ERROR_NOT_SUPPORTED will be returned. If the object is not initialized, or initialization returns with an error, then all operations on the object except g_object_ref() and g_object_unref() are considered to be invalid, and have undefined behaviour. See the ??? section introduction for more details. Implementations of this method must be idempotent, i.e. multiple calls to this function with the same argument should return the same results. Only the first call initializes the object, further calls return the result of the first call. This is so that it's safe to implement the singleton pattern in the GObject constructor function. Since 2.22

interface InitableIF
int
init

Parameters

cancellable Cancellable

optional GCancellable object, NULL to ignore.

Return Value

Type: int

TRUE if successful. If an error has occurred, this function will return FALSE and set error appropriately if present.

Throws

GException on failure.

Meta