24 lines
497 B
Vala
24 lines
497 B
Vala
|
public class MyButton : Object {
|
||
|
|
||
|
public signal void clicked ();
|
||
|
|
||
|
public void test () {
|
||
|
clicked (); // emit signal
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void handler_c (MyButton source) {
|
||
|
stdout.printf ("handler C\n");
|
||
|
}
|
||
|
|
||
|
void main () {
|
||
|
var b = new MyButton ();
|
||
|
b.clicked.connect ((s) => stdout.printf ("handler A\n"));
|
||
|
b.clicked.connect ((s) => {
|
||
|
stdout.printf ("handler B\n");
|
||
|
});
|
||
|
b.clicked.connect (handler_c);
|
||
|
b.test ();
|
||
|
b.clicked.disconnect (handler_c);
|
||
|
}
|