macros: add nm_clear_g_signal_handler() helper

This commit is contained in:
Thomas Haller 2015-10-01 16:41:09 +02:00
parent 6f9a7a8daa
commit c98c7a486c

View file

@ -198,6 +198,19 @@ nm_clear_g_source (guint *id)
return FALSE;
}
static inline gboolean
nm_clear_g_signal_handler (gpointer self, guint *id)
{
g_return_val_if_fail (G_IS_OBJECT (self), FALSE);
if (id && *id) {
g_signal_handler_disconnect (self, *id);
*id = 0;
return TRUE;
}
return FALSE;
}
/*****************************************************************************/
/* Determine whether @x is a power of two (@x being an integer type).