GTK4 - UI - Error building template class - Unhandled tag: <packing>


I have installed GNOME Builder 42.1 version from Flathub. Also Glade 3.38 version from flathub too.

My Question:
I’m trying to develop a GTK4 Vala GNOME application, but if I edit the .ui file with Builder’s internal “Glade”, it adds <packing> tags, then the compilation is not working.

I’m using GtkTemplate to use .ui file inside .vala

I just checked the docs and I couldn’t find a method like “set_center_widget” in GTK3. I want a center widget in a Gtk.Box.

  • How do I set a center widget in GTK4?
  • How do I prevent the “internal Glade” of GNOME Builder is corrupting the .ui file?
  • If I must write the .ui by hand, any tutorial for that or GTK4 xml reference?


Glade does not support GTK4 UI definition files. Any attempt at using Glade will break those files.

Use GtkCenterBox

Don’t use Glade, or the UI editor inside GNOME Builder, as they are both using GTK3 and cannot use GTK4 in the same process.

You can start from the Getting Started tutorial.

The documentation for the XML format is available in the GtkBuilder description. Any type that adds elements or attributes to the UI definition also describes those additions in its own API reference.

If your UI file properly places the GTK requirement, Builder will refuse to open it with Glade.

<require lib="gtk" version="4.0"/>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.