summaryrefslogtreecommitdiff
path: root/src/glibext
diff options
context:
space:
mode:
Diffstat (limited to 'src/glibext')
-rw-r--r--src/glibext/signal.c13
-rw-r--r--src/glibext/signal.h12
2 files changed, 22 insertions, 3 deletions
diff --git a/src/glibext/signal.c b/src/glibext/signal.c
index 654e696..e0a59c0 100644
--- a/src/glibext/signal.c
+++ b/src/glibext/signal.c
@@ -154,6 +154,8 @@ static void carry_signal_to_main_thread(gsignal_wrapper_info *info, ...)
* signal = identification du signal à réceptionner. *
* handler = fonction C servant de réceptacle. *
* data = éventuelle donnée de l'utilisateur à ajouter. *
+* marshal = précise la fonction de transfert des arguments. *
+* flags = fournit quelques indications supplémentaires. *
* *
* Description : Reproduit le comportement de la fonction g_signal_connect(). *
* *
@@ -163,7 +165,7 @@ static void carry_signal_to_main_thread(gsignal_wrapper_info *info, ...)
* *
******************************************************************************/
-gulong g_signal_connect_to_main(gpointer instance, const gchar *signal, GCallback handler, gpointer data, GClosureMarshal marshal)
+gulong _g_signal_connect_to_main(gpointer instance, const gchar *signal, GCallback handler, gpointer data, GClosureMarshal marshal, GConnectFlags flags)
{
guint signal_id; /* Identifiant du signal visé */
GSignalQuery query; /* Information sur le signal */
@@ -181,7 +183,14 @@ gulong g_signal_connect_to_main(gpointer instance, const gchar *signal, GCallbac
info->instance = instance;
- info->closure = g_cclosure_new(handler, data, NULL);
+ if (flags & G_CONNECT_SWAPPED)
+ info->closure = g_cclosure_new_swap(handler, data, NULL);
+ else
+ info->closure = g_cclosure_new(handler, data, NULL);
+
+ g_closure_ref(info->closure);
+ g_closure_sink(info->closure);
+
g_closure_set_marshal(info->closure, marshal);
info->return_type = query.return_type;
diff --git a/src/glibext/signal.h b/src/glibext/signal.h
index 0c8e8a0..ba12a7b 100644
--- a/src/glibext/signal.h
+++ b/src/glibext/signal.h
@@ -27,11 +27,21 @@
#include <glib-object.h>
#include <gobject/gclosure.h>
+#include <glib/gdataset.h>
+#include <glib/glist.h>
+#include <gobject/gsignal.h>
/* Reproduit le comportement de la fonction g_signal_connect(). */
-gulong g_signal_connect_to_main(gpointer, const gchar *, GCallback, gpointer, GClosureMarshal);
+gulong _g_signal_connect_to_main(gpointer, const gchar *, GCallback, gpointer, GClosureMarshal, GConnectFlags);
+
+
+#define g_signal_connect_to_main(instance, signal, handler, data, marshal) \
+ _g_signal_connect_to_main(instance, signal, handler, data, marshal, 0)
+
+#define g_signal_connect_to_main_swapped(instance, signal, handler, data, marshal) \
+ _g_signal_connect_to_main(instance, signal, handler, data, marshal, G_CONNECT_SWAPPED)