[Vala] Check if event-handler is registered already



Hi all,

suppose I have a class that can take callbacks to invoke them in case of any event:

public signal void DataReceived(uint8 byte);
//...
DataReceived(byte);


...and I have a client that registers its handler to it:

someInstance.DataReceived.connect(OnDataReceived);
//...
private void OnDataReceived(uint8 byte)
{
        //do something.
}


..how can I check if my handler was registered already to avoid it from being registered a several times?
I'd like to do something like this:

if( !someInstance.DataReceived.handler_is_connected(OnDataReceived) )
{
        someInstance.DataReceived.connect(OnDataReceived);
}


Thanks in advance for any hint.

gilzad


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