Class method

Gtk.WidgetClass.bind_template_child_full

Declaration [src]

void
gtk_widget_class_bind_template_child_full (
  WidgetClass* self,
  const char* name,
  gboolean internal_child
  gssize struct_offset,
)

Description [src]

Automatically assign an object declared in the class template XML to be set to a location on a freshly built instance’s private data, or alternatively accessible via gtk_widget_get_template_child().

The struct can point either into the public instance, then you should use G_STRUCT_OFFSET(WidgetType, member) for struct_offset, or in the private struct, then you should use G_PRIVATE_OFFSET(WidgetType, member).

An explicit strong reference will be held automatically for the duration of your instance’s life cycle, it will be released automatically when GObjectClass.dispose()runs on your instance and if a `struct_offset` that is `!= 0` is specified, then the automatic location in your instance public or private data will be set to `NULL`. You can however access an automated child pointer the first time your classes `GObjectClass.`dispose() runs, or alternatively in GtkWidget::destroy.

If internal_child is specified, Gtk.BuildableIface.get_internal_child will be automatically implemented by the GtkWidget class so there is no need to implement it manually.

The wrapper macros gtk_widget_class_bind_template_child(), gtk_widget_class_bind_template_child_internal(), gtk_widget_class_bind_template_child_private() and gtk_widget_class_bind_template_child_internal_private() might be more convenient to use.

Note that this must be called from a composite widget classes class initializer after calling gtk_widget_class_set_template().

Parameters

name const char*
 

The “id” of the child defined in the template XML

 Ownership is not transferred to the callee
 The string is a NUL terminated UTF-8 string
internal_child gboolean
 

Whether the child should be accessible as an “internal-child” when this class is used in GtkBuilder XML

struct_offset gssize
 

The structure offset into the composite widget’s instance public or private structure where the automated child pointer should be set, or 0 to not assign the pointer.