Re: [Vala] Signal disconnecting. Patch attempt.



On Don, 2007-03-15 at 23:38 -0300, Alexandre Moreira wrote:
I am completely aware to the fact that I know pretty much nothing
about the way Vala compiler works, but I tried what seemed to be an
"easy-to-make-work" patch.

I'm sure there is a lot of cases where this thing might break and the
code is not well factored, but it suits my immediate needs. I just
felt like uploading the patch for you guys, so you can see the idea
and improve on it.

The patch is to add the following syntax:

object.signal -= somefunction;

so one can disconnect from a signal.

I only tested it in a very simple use case (which is the use case I'll
use the most) : Disconnecting a method of the current object (self)
from a signal.

The patch itself is a very simple copy/paste with little modifications
from the original += behavior.

Thanks for the patch, I've only had to change it to use
g_signal_handlers_disconnect_matched instead of
g_signal_handlers_disconnect_by_func as the latter disconnects all
signals with the same handler, disregarding the signal you specify. I've
committed it to SVN.

Jürg





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]