3 class Maman
.Foo
: Object
{
4 public signal void activated (bool b
);
6 public void do_action (bool b
) {
11 class Maman
.Bar
: Object
{
12 void activated (Foo foo
, bool b
) {
14 stdout
.printf (" BAD");
25 foo
.activated
.connect ((foo
, b
) => {
33 foo
.activated
.connect (activated
);
37 foo
.do_action (false);
41 foo
.activated
.disconnect (activated
);
50 public static int main () {
51 stdout
.printf ("Signal Test: 1");
56 stdout
.printf (" 10\n");
58 stdout
.printf ("User Signal Test: 1");
60 var user_bar
= new
UserBar ();
63 stdout
.printf (" 6\n");
65 stdout
.printf ("Signal Return Test: 1");
67 var return_bar
= new
ReturnBar ();
70 stdout
.printf (" 8\n");
76 class Maman
.UserFoo
: Object
{
77 public signal void activated (int i1
, int i2
);
79 public void do_action () {
84 class Maman
.UserBar
: Object
{
88 var foo
= new
UserFoo ();
90 foo
.activated
.connect ((foo
, i1
, i2
) => {
91 stdout
.printf (" %d", i1
+ i2
);
102 class Maman
.ReturnFoo
: Object
{
103 public signal int int_activated (int arg
);
104 public signal string string_activated (string arg
);
107 class Maman
.ReturnBar
: Object
{
109 stdout
.printf (" 2");
111 var foo
= new
ReturnFoo ();
113 foo
.int_activated
.connect ((foo
, arg
) => {
114 stdout
.printf (" %d", arg
);
118 foo
.string_activated
.connect ((foo
, arg
) => {
123 stdout
.printf (" %d", foo
.int_activated (3));
125 stdout
.printf (foo
.string_activated (" 5"));
127 stdout
.printf (" 7");