Function

GObjectsignal_has_handler_pending

Declaration [src]

gboolean
g_signal_has_handler_pending (
  GObject* instance,
  guint signal_id,
  GQuark detail,
  gboolean may_be_blocked
)

Description [src]

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

If detail is 0 then it will only match handlers that were connected without detail. If detail is non-zero 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.

Since 2.46 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.

Parameters

instance

Type: GObject

The object whose signal handlers are sought.

The data is owned by the caller of the function.
signal_id

Type: guint

The signal id.

detail

Type: GQuark

The detail.

may_be_blocked

Type: gboolean

Whether blocked handlers should count as match.

Return value

Type: gboolean

TRUE if a handler is connected to the signal, FALSE otherwise.