Skip to content

Gtk.BuilderCScope

class — extends GObject.Object, BuilderScope

A GtkBuilderScope implementation for the C language.

GtkBuilderCScope instances use symbols explicitly added to builder with prior calls to BuilderCScope.add_callback_symbol. If developers want to do that, they are encouraged to create their own scopes for that purpose.

In the case that symbols are not explicitly added; GTK will uses GModule’s introspective features (by opening the module None) to look at the application’s symbol table. From here it tries to match the signal function names given in the interface description with symbols in the application.

Note that unless BuilderCScope.add_callback_symbol is called for all signal callbacks which are referenced by the loaded XML, this functionality will require that GModule be supported on the platform.

Constructors

new

@classmethod
def new(cls) -> BuilderCScope

Creates a new GtkBuilderCScope object to use with future GtkBuilder instances.

Calling this function is only necessary if you want to add custom callbacks via BuilderCScope.add_callback_symbol.

Methods

add_callback_symbol

def add_callback_symbol(self, callback_name: str, callback_symbol: GObject.Callback) -> None

Adds the callback_symbol to the scope of builder under the given callback_name.

Using this function overrides the behavior of Builder.create_closure for any callback symbols that are added. Using this method allows for better encapsulation as it does not require that callback symbols be declared in the global namespace.

Parameters:

  • callback_name — The name of the callback, as expected in the XML
  • callback_symbol — The callback pointer