diff --git a/gobject/ChangeLog b/gobject/ChangeLog index a2182674d..63f4057c9 100644 --- a/gobject/ChangeLog +++ b/gobject/ChangeLog @@ -1,3 +1,9 @@ +Mon May 14 01:49:01 2001 Tim Janik + + * gsignal.[hc] (g_signal_handler_is_connected): new function + to check whether a handler is still connected to an instance + (by handler id). + Thu May 10 14:00:48 2001 Tim Janik * gparamspecs.[hc]: removed g_param_spec_stringc() in lack of diff --git a/gobject/gsignal.c b/gobject/gsignal.c index 6cf74d9c1..a8920d884 100644 --- a/gobject/gsignal.c +++ b/gobject/gsignal.c @@ -1416,6 +1416,24 @@ g_signal_handler_disconnect (gpointer instance, G_UNLOCK (g_signal_mutex); } +gboolean +g_signal_handler_is_connected (gpointer instance, + gulong handler_id) +{ + Handler *handler; + gboolean connected; + + g_return_val_if_fail (G_TYPE_CHECK_INSTANCE (instance), FALSE); + g_return_val_if_fail (handler_id > 0, FALSE); + + G_LOCK (g_signal_mutex); + handler = handler_lookup (instance, handler_id, NULL); + connected = handler != NULL; + G_UNLOCK (g_signal_mutex); + + return connected; +} + void g_signal_handlers_destroy (gpointer instance) { diff --git a/gobject/gsignal.h b/gobject/gsignal.h index 9c429b776..696038d2d 100644 --- a/gobject/gsignal.h +++ b/gobject/gsignal.h @@ -185,6 +185,8 @@ void g_signal_handler_unblock (gpointer instance, gulong handler_id); void g_signal_handler_disconnect (gpointer instance, gulong handler_id); +gboolean g_signal_handler_is_connected (gpointer instance, + gulong handler_id); gulong g_signal_handler_find (gpointer instance, GSignalMatchType mask, guint signal_id,