summaryrefslogtreecommitdiffstats
path: root/test cases/vala/14 target glib version and gresources/test.vala
blob: f10bbe4ca5eac962bb802b17d8fddf70f3ff23b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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 unowned 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 ();
}