Re: [Vala] Question about signal connection
- From: Jan Hudec <bulb ucw cz>
- To: Johan <johan wolke7 net>
- Cc: vala-list gnome org
- Subject: Re: [Vala] Question about signal connection
- Date: Sat, 7 Nov 2009 23:41:20 +0100
On Sat, Nov 07, 2009 at 13:16:02 +0100, Johan wrote:
Hi Andrea,
Thanks for the fast reply.
I am still doing something wrong, I changed this:
public virtual signal void handler2 (...)
No 'signal' keyword here. A handler is just a function. It must have
a signature that matches the signal it will connect to and of course it must
have a body.
(The handler also does not need to be public, if the connect is in a method
of that class)
monitor.changed.connect((void) this.handler2);
You should not have any cast here. A (void) cast in particular is complete
nonsense -- it would be (void *) if you meant just untyped reference.
Generally, you should need very few casts in correct vala code. Whenever you
seem to need a cast, it's quite likely something else is wrong, so
make sure you really understand what is going on before you write a cast.
and get the following:
macro "g_signal_connect" requires 4 arguments, but only 3 given
That is how the C-code looks like: // g_signal_connect
(monitor, "changed", (GCallback) ((void) g_signal_emit_by_name
(self, "handler2")));
Vala should not have generated this. It should have probably errored out
saying the signal 'handler2' can't be used as value.
and that is how it should be:
// g_signal_connect (instance, detailed_signal, c_handler, data)
any idea?
--
Jan 'Bulb' Hudec <bulb ucw cz>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]