Method

GtkWidgetinit_template

since: 3.10

Declaration [src]

void
gtk_widget_init_template (
  GtkWidget* widget
)

Description [src]

Creates and initializes child widgets defined in templates. This function must be called in the instance initializer for any class which assigned itself a template using gtk_widget_class_set_template()

It is important to call this function in the instance initializer of a GtkWidget subclass and not in GObject.constructed() or GObject.constructor() for two reasons.

One reason is that generally derived widgets will assume that parent class composite widgets have been created in their instance initializers.

Another reason is that when calling g_object_new() on a widget with composite templates, it’s important to build the composite widgets before the construct properties are set. Properties passed to g_object_new() should take precedence over properties set in the private template XML.

Available since: 3.10