From 7b6e527f440cd7e6f8be2b07cee320ee6ca18786 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 29 Apr 2024 06:41:38 +0200 Subject: Adding upstream version 1.0.1. Signed-off-by: Daniel Baumann --- manual tests/7 vala composite widgets/meson.build | 21 +++++++ .../7 vala composite widgets/my-resources.xml | 6 ++ manual tests/7 vala composite widgets/mywidget.ui | 70 ++++++++++++++++++++++ .../7 vala composite widgets/mywidget.vala | 41 +++++++++++++ 4 files changed, 138 insertions(+) create mode 100644 manual tests/7 vala composite widgets/meson.build create mode 100644 manual tests/7 vala composite widgets/my-resources.xml create mode 100644 manual tests/7 vala composite widgets/mywidget.ui create mode 100644 manual tests/7 vala composite widgets/mywidget.vala (limited to 'manual tests/7 vala composite widgets') diff --git a/manual tests/7 vala composite widgets/meson.build b/manual tests/7 vala composite widgets/meson.build new file mode 100644 index 0000000..579ca51 --- /dev/null +++ b/manual tests/7 vala composite widgets/meson.build @@ -0,0 +1,21 @@ +project('composite', 'vala', 'c') +gnome = import('gnome') +deps = [ + dependency('glib-2.0', version : '>=2.38'), + dependency('gobject-2.0'), + dependency('gtk+-3.0'), +] +res = files('my-resources.xml') +gres = gnome.compile_resources( + 'my', res, + source_dir : '.', +) +executable( + 'demo', + sources : [ + 'mywidget.vala', + gres, + ], + dependencies : deps, + vala_args : ['--gresources', res], +) diff --git a/manual tests/7 vala composite widgets/my-resources.xml b/manual tests/7 vala composite widgets/my-resources.xml new file mode 100644 index 0000000..b5743c1 --- /dev/null +++ b/manual tests/7 vala composite widgets/my-resources.xml @@ -0,0 +1,6 @@ + + + + mywidget.ui + + diff --git a/manual tests/7 vala composite widgets/mywidget.ui b/manual tests/7 vala composite widgets/mywidget.ui new file mode 100644 index 0000000..2d6286c --- /dev/null +++ b/manual tests/7 vala composite widgets/mywidget.ui @@ -0,0 +1,70 @@ + + + + + diff --git a/manual tests/7 vala composite widgets/mywidget.vala b/manual tests/7 vala composite widgets/mywidget.vala new file mode 100644 index 0000000..68eaecc --- /dev/null +++ b/manual tests/7 vala composite widgets/mywidget.vala @@ -0,0 +1,41 @@ +using Gtk; + +[GtkTemplate (ui = "/org/foo/my/mywidget.ui")] +public class MyWidget : Box { + public string text { + get { return entry.text; } + set { entry.text = value; } + } + + [GtkChild] + private Entry entry; + + public MyWidget (string text) { + this.text = text; + } + + [GtkCallback] + private void on_button_clicked (Button button) { + print ("The button was clicked with entry text: %s\n", entry.text); + } + + [GtkCallback] + private void on_entry_changed (Editable editable) { + print ("The entry text changed: %s\n", entry.text); + + notify_property ("text"); + } +} + +void main(string[] args) { + Gtk.init (ref args); + var win = new Window(); + win.destroy.connect (Gtk.main_quit); + + var widget = new MyWidget ("The entry text!"); + + win.add (widget); + win.show_all (); + + Gtk.main (); +} -- cgit v1.2.3