| 1 |
using Gtk; |
| 2 |
using GLib; |
| 3 |
|
| 4 |
[GtkTemplate (ui = "/org/Meson/test.ui")] |
| 5 |
public class TestWidget : Box { |
| 6 |
public string text { |
| 7 |
get { return entry.text; } |
| 8 |
set { entry.text = value; } |
| 9 |
} |
| 10 |
|
| 11 |
[GtkChild] |
| 12 |
private unowned Entry entry; |
| 13 |
|
| 14 |
public TestWidget (string text) { |
| 15 |
this.text = text; |
| 16 |
} |
| 17 |
} |
| 18 |
|
| 19 |
void main(string[] args) { |
| 20 |
Gtk.init (ref args); |
| 21 |
var win = new Window(); |
| 22 |
win.destroy.connect (Gtk.main_quit); |
| 23 |
|
| 24 |
var widget = new TestWidget ("SOME TEXT HERE"); |
| 25 |
|
| 26 |
win.add (widget); |
| 27 |
win.show_all (); |
| 28 |
|
| 29 |
/* Exit immediately */ |
| 30 |
Timeout.add_full (Priority.DEFAULT_IDLE, 1, () => |
| 31 |
{ |
| 32 |
Gtk.main_quit(); |
| 33 |
return false; |
| 34 |
}); |
| 35 |
|
| 36 |
Gtk.main (); |
| 37 |
} |