It would be ideal to be able to create a new widget that uses builder to load its contents, eg.
public class MyDialog : Dialog
{
public MyDialog
{
Gtk.Builder builder = new Gtk.Builder ();
builder.add_from_file ("dialog.ui");
this = builder.get_object ("my_dialog") as Gtk.Widget;
}
}
Obviously this won't work because this =
is an invalid assignment, but I'm wondering if there is a way to set a widget's contents using those that have been loaded from builder.
For the meantime I've replaced the this = ...
with
var content = get_content_area ();
var dialog = builder.get_object ("my_dialog") as Gtk.Widget;
var _content = (dialog as Dialog).get_content_area ();
_content.reparent (content);
which does work, but it still would make sense to me to be able to load directly in.
Thanks.