-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgui.vala
54 lines (43 loc) · 1.16 KB
/
gui.vala
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// gui vala
int zzz () {
int status = 7;
return status;
}
[CCode (cname = "comFn", has_target = false)]
public delegate unowned string ComResult (int a);
public static ComResult afni = null;
public static void set_afni (ComResult fn) {
global::afni = fn;
stdout.printf("setting pointer \n");
}
[CCode ( cname = "myCallback", has_target = false)]
delegate int MyCallback (int a);
static int myMult (int x, int y, MyCallback fn ) {
var res = x * x;
stdout.printf("%d\n", res);
stdout.printf("Callbacked %d\n", fn (3) );
return (res * 2);
}
public static int vala_main (string[] args) {
var app = new Gui ();
return app.run (args);
}
public class Gui : Gtk.Application {
public Gui () {
Object (
application_id : "org.jacek.vala1",
flags : ApplicationFlags.FLAGS_NONE
);
}
protected override void activate () {
var main_window = new Gtk.ApplicationWindow (this);
main_window.default_height = 300;
main_window.default_width = 300;
main_window.title = "Hello World";
string res = global::afni(2+5);
string da_label = @"blah $res";
Gtk.Label label = new Gtk.Label (da_label);
main_window.add (label);
main_window.show_all ();
}
}