gsignal: Signal connection ids are always > 0 if successful
authorColin Walters <walters@verbum.org>
Tue, 3 Dec 2013 22:15:14 +0000 (17:15 -0500)
committerColin Walters <walters@verbum.org>
Wed, 4 Dec 2013 00:23:49 +0000 (19:23 -0500)
Note this explicitly so that people can rely on doing:

if (mystruct->sigid > 0)
  g_signal_disconnect (mystruct->object, mystruct->sigid);

https://bugzilla.gnome.org/show_bug.cgi?id=719809

gobject/gsignal.c
gobject/gsignal.h

index 831ded3..8c67bdd 100644 (file)
@@ -2256,7 +2256,7 @@ g_signal_get_invocation_hint (gpointer instance)
  *
  * Connects a closure to a signal for a particular object.
  *
- * Returns: the handler id
+ * Returns: the handler id (always greater than 0 for successful connections)
  */
 gulong
 g_signal_connect_closure_by_id (gpointer  instance,
@@ -2315,7 +2315,7 @@ g_signal_connect_closure_by_id (gpointer  instance,
  *
  * Connects a closure to a signal for a particular object.
  *
- * Returns: the handler id
+ * Returns: the handler id (always greater than 0 for successful connections)
  */
 gulong
 g_signal_connect_closure (gpointer     instance,
@@ -2408,7 +2408,7 @@ node_check_deprecated (const SignalNode *node)
  * used. Specify @connect_flags if you need <literal>..._after()</literal> or
  * <literal>..._swapped()</literal> variants of this function.
  *
- * Returns: the handler id
+ * Returns: the handler id (always greater than 0 for successful connections)
  */
 gulong
 g_signal_connect_data (gpointer       instance,
index 46721ca..d2457df 100644 (file)
@@ -469,7 +469,7 @@ void   g_signal_chain_from_overridden_handler (gpointer           instance,
  * 
  * The handler will be called before the default handler of the signal.
  * 
- * Returns: the handler id
+ * Returns: the handler id (always greater than 0 for successful connections)
  */
 #define g_signal_connect(instance, detailed_signal, c_handler, data) \
     g_signal_connect_data ((instance), (detailed_signal), (c_handler), (data), NULL, (GConnectFlags) 0)
@@ -484,7 +484,7 @@ void   g_signal_chain_from_overridden_handler (gpointer           instance,
  * 
  * The handler will be called after the default handler of the signal.
  * 
- * Returns: the handler id
+ * Returns: the handler id (always greater than 0 for successful connections)
  */
 #define g_signal_connect_after(instance, detailed_signal, c_handler, data) \
     g_signal_connect_data ((instance), (detailed_signal), (c_handler), (data), NULL, G_CONNECT_AFTER)
@@ -500,7 +500,7 @@ void   g_signal_chain_from_overridden_handler (gpointer           instance,
  * The instance on which the signal is emitted and @data will be swapped when 
  * calling the handler.
  * 
- * Returns: the handler id
+ * Returns: the handler id (always greater than 0 for successful connections)
  */
 #define g_signal_connect_swapped(instance, detailed_signal, c_handler, data) \
     g_signal_connect_data ((instance), (detailed_signal), (c_handler), (data), NULL, G_CONNECT_SWAPPED)