gtk4: unknown type name when subclassing
This program compiles fine with valac --pkg=gtk4 main.vala
:
void main(string[] args) {
var window = new Gtk.Window();
window.set_titlebar(new Gtk.HeaderBar());
}
but this one fails with an unknown type error:
class Header : Gtk.HeaderBar {}
void main(string[] args) {
var window = new Gtk.Window();
window.set_titlebar(new Header());
}
/*
/home/damien/Workspace/gtk4/src/main.vala.c:28:15: error: field ‘parent_instance’ has incomplete type
28 | GtkHeaderBar parent_instance;
| ^~~~~~~~~~~~~~~
/home/damien/Workspace/gtk4/src/main.vala.c:33:2: error: unknown type name ‘GtkHeaderBarClass’
33 | GtkHeaderBarClass parent_class;
| ^~~~~~~~~~~~~~~~~
error: cc exited with status 256
Compilation failed: 1 error(s), 0 warning(s)
*/
Interestingly, both of these compile successfully with valac --pkg=gtk+-3.0 main.vala
, so this issue appears to be limited to GTK4.
Vala version: 0.48.10
GTK4 version: 3.98.4-1.3