Add native GLib.Initable support
@mpiechotka
Submitted by Maciej Marcin Piechotka Link to original bug (#583449)
Description
The git version of GIO include GLib.Initable interface. It was added to allow initialization of resources which may throw errors. Additionaly it provide a native support of it in the Vala.
For example:
class MyObject : GLib.Object, GLib.Initiable
{
MyObject(int i)
{
//...
}
init(Glib.Cancellable? cancel)
{
//'Magic' construction method as in construct to specify special use
// Initialization
}
}
my_object_new would be:
MyObject *my_object_new (gint i, GLib.Cancellable? cancel, GLib.Error **err)
{
MyObject *obj;
//...
obj = (MyObject *)g_initiable_new(MY_OBJECT_TYPE, cancel, err, ...);
}
Possibly AsyncInitable would be nice (after correct async support in Vala).
And use in code as:
MyObject m = new MyObject(j, cancel);
Edited by Rico Tzschichholz