You need to set the can-focus
property of the text entry to True
to be able to focus it (although I don't get the run-time error with your code).
If you are using a recent version of GTK (3.10) you might want to read about template/composite widgets as this saves messing about with Gtk.Builder directly, you just put a couple of annotations and vala sets everything up for you.
In GTK3 the expand
& fill
child properties are deprecated in favour of the expand
, hexpand
, vexpand
, halign
& valign
widget properties which offer more flexibility in the distribution and use of extra space.
The vala warning about the unhandled error is because the code doesn't catch errors such as file not found or markup errors in the ui definition returned builder.add_from_file
.
Don't worry too much about the second warning, vala is generating code for an older version of glib than the one you have installed. Add --target-glib 2.36
to the vala command line to fix it.