new function to check whether a handler is still connected to an instance
authorTim Janik <timj@gtk.org>
Mon, 14 May 2001 13:55:51 +0000 (13:55 +0000)
committerTim Janik <timj@src.gnome.org>
Mon, 14 May 2001 13:55:51 +0000 (13:55 +0000)
Mon May 14 01:49:01 2001  Tim Janik  <timj@gtk.org>

        * gsignal.[hc] (g_signal_handler_is_connected): new function
        to check whether a handler is still connected to an instance
        (by handler id).

gobject/ChangeLog
gobject/gsignal.c
gobject/gsignal.h

index a218267..63f4057 100644 (file)
@@ -1,3 +1,9 @@
+Mon May 14 01:49:01 2001  Tim Janik  <timj@gtk.org>
+
+       * 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  <timj@gtk.org>
 
        * gparamspecs.[hc]: removed g_param_spec_stringc() in lack of
index 6cf74d9..a8920d8 100644 (file)
@@ -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)
 {
index 9c429b7..696038d 100644 (file)
@@ -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,