Change template syntax

Templates now use a TypeName instead of an identifier, which makes it
clearer that it's an extern symbol (or that it's a Gtk.ListItem).
This commit is contained in:
James Westman 2023-05-09 19:42:33 -05:00
parent aebf8be278
commit 04509e4b2e
31 changed files with 175 additions and 55 deletions

View file

@ -1,4 +1,4 @@
using Gtk 4.0;
template MyWidget : Gtk.Widget {}
template $MyWidget : Gtk.Widget {}
Gtk.Widget {}

View file

@ -1,3 +1,3 @@
using Gtk 4.0;
template TestTemplate : Gtk.NotARealClass {}
template $TestTemplate : Gtk.NotARealClass {}

View file

@ -1 +1 @@
3,29,13,Namespace Gtk does not contain a type called NotARealClass
3,30,13,Namespace Gtk does not contain a type called NotARealClass

View file

@ -1,7 +1,5 @@
using Gtk 4.0;
template GtkListItem {
Label {
label: bind GtkListItem.item.label;
}
$MyObject object {
foo: bind object.bar.baz;
}

View file

@ -1 +1 @@
5,34,5,Could not determine the type of the preceding expression
4,24,3,Could not determine the type of the preceding expression

View file

@ -0,0 +1,10 @@
using Gtk 4.0;
template TestTemplate : ApplicationWindow {
test-property: "Hello, world";
test-signal => $on_test_signal();
}
Dialog {
transient-for: TestTemplate;
}

View file

@ -0,0 +1,2 @@
3,10,12,Use type syntax here (introduced in blueprint 0.8.0)
9,18,12,Use 'template' instead of the class name (introduced in 0.8.0)

View file

@ -1,3 +1,3 @@
using Gtk 4.0;
template TestTemplate : Gtk.Orientable {}
template $TestTemplate : Gtk.Orientable {}

View file

@ -1 +1 @@
3,25,14,Gtk.Orientable is an interface, not a class
3,26,14,Gtk.Orientable is an interface, not a class

View file

@ -1,3 +1,3 @@
using Gtk 4.0;
template TestTemplate : Adw.ApplicationWindow {}
template $TestTemplate : Adw.ApplicationWindow {}

View file

@ -1 +1 @@
3,25,3,Namespace Adw was not imported
3,26,3,Namespace Adw was not imported

View file

@ -0,0 +1,3 @@
using Gtk 4.0;
template Gtk.ListItem : $WrongParent {}

View file

@ -0,0 +1 @@
3,1,39,Parent type may only be specified if the template type is extern

View file

@ -1,4 +1,6 @@
using Gtk 4.0;
template ClassName : Gtk.Button {}
template ClassName2 : Gtk.Button {}
template $ClassName : Gtk.Button {}
template $ClassName2 : Gtk.Button {}
Label template {}

View file

@ -1 +1,2 @@
4,10,10,Only one template may be defined per file, but this file contains 2
6,7,8,Duplicate object ID 'template'
4,1,8,Only one template may be defined per file, but this file contains 2