Initializes the object implementing the interface.
The object must be initialized before any real use after initial construction, either with this function or 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 @ref and unref are considered to be invalid, and have undefined behaviour. See the 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.
this |
a Initable. |
cancellable |
optional Cancellable object, null to ignore. |
true if successful. If an error has occurred, this function will return false and set throws appropriately if present. |