diff options
Diffstat (limited to 'meson/test cases/vala/14 target glib version and gresources')
5 files changed, 77 insertions, 0 deletions
diff --git a/meson/test cases/vala/14 target glib version and gresources/gres/meson.build b/meson/test cases/vala/14 target glib version and gresources/gres/meson.build new file mode 100644 index 000000000..f222a0095 --- /dev/null +++ b/meson/test cases/vala/14 target glib version and gresources/gres/meson.build @@ -0,0 +1,3 @@ +res = gnome.compile_resources('testui', + 'test-resources.xml', + source_dir : '.') diff --git a/meson/test cases/vala/14 target glib version and gresources/gres/test-resources.xml b/meson/test cases/vala/14 target glib version and gresources/gres/test-resources.xml new file mode 100644 index 000000000..4e8a73f61 --- /dev/null +++ b/meson/test cases/vala/14 target glib version and gresources/gres/test-resources.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<gresources> + <gresource prefix="/org/Meson"> + <file compressed="true" preprocess="xml-stripblanks">test.ui</file> + </gresource> +</gresources> diff --git a/meson/test cases/vala/14 target glib version and gresources/gres/test.ui b/meson/test cases/vala/14 target glib version and gresources/gres/test.ui new file mode 100644 index 000000000..f90d941ff --- /dev/null +++ b/meson/test cases/vala/14 target glib version and gresources/gres/test.ui @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<interface> + <!-- interface-requires gtk+ 3.8 --> + <template class="TestWidget" parent="GtkBox"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="spacing">4</property> + <child> + <object class="GtkEntry" id="entry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + </object> + <packing> + <property name="position">0</property> + </packing> + </child> + </template> +</interface> diff --git a/meson/test cases/vala/14 target glib version and gresources/meson.build b/meson/test cases/vala/14 target glib version and gresources/meson.build new file mode 100644 index 000000000..dee26278d --- /dev/null +++ b/meson/test cases/vala/14 target glib version and gresources/meson.build @@ -0,0 +1,12 @@ +project('test glib target version and gresources', 'c', 'vala') + +gnome = import('gnome') + +glib = dependency('glib-2.0', version : '>=2.38') +gtk = dependency('gtk+-3.0') + +subdir('gres') + +e = executable('gtktemplate', 'test.vala', res, dependencies : [glib, gtk]) +# No X on the CI, so disable this for now +#test('test-target-glib', e) diff --git a/meson/test cases/vala/14 target glib version and gresources/test.vala b/meson/test cases/vala/14 target glib version and gresources/test.vala new file mode 100644 index 000000000..79ef47db0 --- /dev/null +++ b/meson/test cases/vala/14 target glib version and gresources/test.vala @@ -0,0 +1,37 @@ +using Gtk; +using GLib; + +[GtkTemplate (ui = "/org/Meson/test.ui")] +public class TestWidget : Box { + public string text { + get { return entry.text; } + set { entry.text = value; } + } + + [GtkChild] + private Entry entry; + + public TestWidget (string text) { + this.text = text; + } +} + +void main(string[] args) { + Gtk.init (ref args); + var win = new Window(); + win.destroy.connect (Gtk.main_quit); + + var widget = new TestWidget ("SOME TEXT HERE"); + + win.add (widget); + win.show_all (); + + /* Exit immediately */ + Timeout.add_full (Priority.DEFAULT_IDLE, 1, () => + { + Gtk.main_quit(); + return false; + }); + + Gtk.main (); +} |