diff options
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | tests/Makefile.am | 1 | ||||
-rw-r--r-- | tests/gtktemplate/Makefile.am | 22 | ||||
-rw-r--r-- | tests/gtktemplate/gtktemplate.gresource.xml | 6 | ||||
-rw-r--r-- | tests/gtktemplate/gtktemplate.ui | 48 | ||||
-rw-r--r-- | tests/gtktemplate/gtktemplate.vala | 16 |
6 files changed, 94 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index 62656404d..cc02d2863 100644 --- a/configure.ac +++ b/configure.ac @@ -163,6 +163,7 @@ AC_CONFIG_FILES([Makefile vapi/Makefile tests/Makefile tests/girwriter/Makefile + tests/gtktemplate/Makefile doc/Makefile doc/manual/Makefile doc/manual/version.xml diff --git a/tests/Makefile.am b/tests/Makefile.am index 800ee136f..d2bb37be6 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -2,6 +2,7 @@ NULL = SUBDIRS = \ girwriter \ + gtktemplate \ $(NULL) AM_CPPFLAGS = \ diff --git a/tests/gtktemplate/Makefile.am b/tests/gtktemplate/Makefile.am new file mode 100644 index 000000000..05dfd84eb --- /dev/null +++ b/tests/gtktemplate/Makefile.am @@ -0,0 +1,22 @@ +NULL = + +check-gtktemplate: $(top_builddir)/compiler/valac + $(top_builddir)/compiler/valac \ + -C \ + --vapidir $(top_srcdir)/vapi \ + --pkg gtk+-3.0 \ + --gresources $(srcdir)/gtktemplate.gresource.xml \ + $(srcdir)/gtktemplate.vala; \ + rm -f gtktemplate.c + +check: check-gtktemplate + +EXTRA_DIST = \ + gtktemplate.gresource.xml \ + gtktemplate.ui \ + gtktemplate.vala \ + $(NULL) + +CLEANFILES = \ + gtktemplate.c \ + $(NULL) diff --git a/tests/gtktemplate/gtktemplate.gresource.xml b/tests/gtktemplate/gtktemplate.gresource.xml new file mode 100644 index 000000000..aa9b08299 --- /dev/null +++ b/tests/gtktemplate/gtktemplate.gresource.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<gresources> + <gresource prefix="/org/example/"> + <file preprocess="xml-stripblanks">gtktemplate.ui</file> + </gresource> +</gresources> diff --git a/tests/gtktemplate/gtktemplate.ui b/tests/gtktemplate/gtktemplate.ui new file mode 100644 index 000000000..1546d9472 --- /dev/null +++ b/tests/gtktemplate/gtktemplate.ui @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.22.1 --> +<interface> + <requires lib="gtk+" version="3.10"/> + <template class="GtkTemplateTest" parent="GtkApplicationWindow"> + <property name="can_focus">False</property> + <property name="title" translatable="yes">GtkTemplate</property> + <property name="default_width">300</property> + <property name="default_height">200</property> + <property name="show_menubar">False</property> + <child type="titlebar"> + <placeholder/> + </child> + <child> + <object class="GtkBox"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <child> + <object class="GtkButton" id="button0"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <signal name="clicked" handler="on_clicked_cb" swapped="yes"/> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="button1"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <signal name="activate" handler="on_activate_cb" swapped="yes"/> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + </child> + </template> +</interface> diff --git a/tests/gtktemplate/gtktemplate.vala b/tests/gtktemplate/gtktemplate.vala new file mode 100644 index 000000000..fa6317ff0 --- /dev/null +++ b/tests/gtktemplate/gtktemplate.vala @@ -0,0 +1,16 @@ +[GtkTemplate (ui = "/org/example/gtktemplate.ui")] +public class GtkTemplate : Gtk.ApplicationWindow { + [GtkChild] + public Gtk.Button button0 { get; set; } + + [GtkChild (internal = true)] + public Gtk.Button button1; + + [GtkCallback] + void on_clicked_cb (Gtk.Button button) { + } + + [GtkCallback (name = "on_activate_cb")] + void on_something_cb (Gtk.Button button) { + } +} |