2.7 <GtkBuilderScope>

Interface: <GtkBuilderScope>

Provides language binding support to <GtkBuilder>.

The goal of <GtkBuilderScope> is to look up programming-language-specific values for strings that are given in a <GtkBuilder> UI file.

The primary intended audience is bindings that want to provide deeper integration of <GtkBuilder> into the language.

A <GtkBuilderScope> instance may be used with multiple <GtkBuilder> objects, even at once.

By default, GTK will use its own implementation of <GtkBuilderScope> for the C language which can be created via builder-cscope:new.

If you implement <GtkBuilderScope> for a language binding, you may want to (partially) derive from or fall back to a <GtkBuilderCScope>, as that class implements support for automatic lookups from C symbols.

Virtual methods

Virtual method: builder-scope:do-create-closure implementor self builder function-name flags object ⇒ %return

Create a closure with the given arguments. See builder:create-closure for more details on those. The C implementation will try to use dlsym() to locate the function name and then g_cclosure_new() to create a closure for the symbol. The default implementation just fails and returns #f.

To override it in a new class, give register-type #:vfuncs `((create-closure . ,procedure)). The procedure is called as (procedure self builder function-name flags object) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GtkBuilderScope>, or its GType number.

self

Passed: a <GtkBuilderScope>.

builder

Passed: a <GtkBuilder>.

function-name

Passed: a string.

flags

Passed: a <GtkBuilderClosureFlags>, or a list of its symbols, or one of them.

object

Passed: a <GObject>.

%return

Returned: a <GClosure>.

Virtual method: builder-scope:do-get-type-from-function implementor self builder function-name ⇒ %return

Try to lookup a GType via the given function name, specified explicitly in a GtkBuilder file, like via the "type-func" attribute in the <object> tag. This function is very rarely used. The C implementation will use dlsym() and call the resulting function as a GTypeFunc. The default implementation will fail and just return G_TYPE_INVALID.

To override it in a new class, give register-type #:vfuncs `((get-type-from-function . ,procedure)). The procedure is called as (procedure self builder function-name) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GtkBuilderScope>, or its GType number.

self

Passed: a <GtkBuilderScope>.

builder

Passed: a <GtkBuilder>.

function-name

Passed: a string.

%return

Returned: a class, or a GType number.

Virtual method: builder-scope:do-get-type-from-name implementor self builder type-name ⇒ %return

Try to lookup a GType via the its name. See builder:get-type-from-name for more details. The C implementation will use type-from-name and if that fails try to guess the correct function name for registering the type and then use dlsym() to load it. The default implementation just tries type-from-name and otherwise fails.

To override it in a new class, give register-type #:vfuncs `((get-type-from-name . ,procedure)). The procedure is called as (procedure self builder type-name) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GtkBuilderScope>, or its GType number.

self

Passed: a <GtkBuilderScope>.

builder

Passed: a <GtkBuilder>.

type-name

Passed: a string.

%return

Returned: a class, or a GType number.