[Vala] Passing a callback function as an argument and connect to activate signal, cannot convert error....
- From: Axel FILMORE <axel filmore gmail com>
- To: vala-list gnome org
- Subject: [Vala] Passing a callback function as an argument and connect to activate signal, cannot convert error....
- Date: Fri, 27 Apr 2012 19:15:32 +0200
Hi there,
I try to do the following in Vala without much success :
namespace Test {
public class Popup {
public void create (Callback action_callback) {
Gtk.Action action = new Gtk.Action ("", "", "", null);
action.activate.connect (action_callback);
}
}
}
Then :
Test.Popup test = new Test.Popup ();
test.create ((Callback) _test_template);
I get "Cannot convert from GLib.Callback to Gtk.Action.activate", I
tried also with (void *), or Gtk.ActionCallback
but I also get compilation errors.
Any idea ?
If I'm doing this, of course it works :
namespace Test {
public class Popup {
public void create (Callback action_callback) {
Gtk.Action action = new Gtk.Action ("", "", "", null);
action.activate.connect (_test_template);
}
private void _test_template (Gtk.Action action) {
}
}
}
But I try to add some actions dynamically so I'd like to pass the
callback as an argument.
What I'm doing wrong ?
:)
--
Axel FILMORE
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]