Package: gobject

Function gobject:signal-has-handler-pending

Lambda List

gobject:signal-has-handler-pending (instance id detail may-be-blocked)

Arguments

instance -- a g:object instance whose signal handlers are sought
id -- an unsigned integer with the signal ID
detail -- a string with the detail of a signal name
may-be-blocked -- a boolean whether blocked handlers should count as match

Return Value

True if a handler is connected to the signal, false otherwise.

Details

Returns whether there are any handlers connected to instance for the given signal ID and detail.

If detail is nil then it will only match handlers that were connected without detail. If detail is non-nil then it will match handlers connected both without detail and with the given detail. This is consistent with how a signal emitted with detail would be delivered to those handlers.

This also checks for a non-default class closure being installed, as this is basically always what you want.

One example of when you might use this is when the arguments to the signal are difficult to compute. A class implementor may opt to not emit the signal if no one is attached anyway, thus saving the cost of building the arguments.
 

See also

2024-6-20