More builder work
This is a follow up to !1204 (merged) and addresses things pointed out by @sdroege, @ptomato and @kjellahl as well as new issues I've figured out. In particular:
-
It introduces the idea of a "current object", which is the template that's being constructed. Bindings should think of it as the
this
pointer, in particular when parsing templates. -
Replace the closure func with an actual scope object. This scope object can carry additional language-specific information and can be copied around and reused with different builder instances.
For C, this means we can move the oldgtk_builder_add_callback()
to the scope object and get the same callbacks in multiple builders. This is extra interesting for the listview work where GtkBuilder-using listitem factories want to inherit this scope - and having an object makes that easy.
This should hopefully also work without overrides having to be done in C, as g-i based languages can just create their custom Scope object and just replace thegtk_builder_new...()
overrides with custom ones that set this custom scope. -
Resurrect the old vfuncs that were deleted from GtkBuilder as new vfuncs in the GtkBuilderScope. This fixes #2267 (closed) and allows the C++ backends to keep the type mangling they did in GTK3.
-
Move all the module loading machinery out of gtkbuilder.c and into the scope. This is just cleanup work, but it makes the sources easier to read.