summaryrefslogtreecommitdiffstats
path: root/gobject/gobjectmodule.c
diff options
context:
space:
mode:
authorJohan Dahlin <jdahlin@async.com.br>2007-04-29 21:45:33 +0000
committerJohan Dahlin <johan@src.gnome.org>2007-04-29 21:45:33 +0000
commit986ca14bd42f0cae3551f5b6aa97ef5e66e9a02c (patch)
tree7df3465c83bfc758e3b0e0fb4f535f44231e863f /gobject/gobjectmodule.c
parentf7a7b38d5dd5de98d9bccd3e0b6d400601cd4c26 (diff)
downloadpygobject-986ca14bd42f0cae3551f5b6aa97ef5e66e9a02c.tar.gz
pygobject-986ca14bd42f0cae3551f5b6aa97ef5e66e9a02c.tar.xz
pygobject-986ca14bd42f0cae3551f5b6aa97ef5e66e9a02c.zip
Add a generic CClosure marshaller based on ffi. This makes it possible to
2007-04-29 Johan Dahlin <jdahlin@async.com.br> * README: * configure.ac: * gobject/Makefile.am: * gobject/ffi-marshaller.c: (g_value_to_ffi_type), (g_value_from_ffi_type), (g_cclosure_marshal_generic_ffi): * gobject/ffi-marshaller.h: * gobject/gobjectmodule.c: (create_signal), (init_gobject): * pygobject-2.0.pc.in: * tests/test_signal.py: * tests/testhelpermodule.c: (test1_callback), (test1_callback_swapped), (test2_callback), (test3_callback), (test4_callback), (test_float_callback), (test_double_callback), (test_string_callback), (test_object_callback), (connectcallbacks), (_wrap_connectcallbacks), (inittesthelper): Add a generic CClosure marshaller based on ffi. This makes it possible to connect to signals on PyGObjects from C. libffi is now an optional dependency Fixes #353816 (Edward Hervey) svn path=/trunk/; revision=651
Diffstat (limited to 'gobject/gobjectmodule.c')
-rw-r--r--gobject/gobjectmodule.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/gobject/gobjectmodule.c b/gobject/gobjectmodule.c
index 32256a6..8316a20 100644
--- a/gobject/gobjectmodule.c
+++ b/gobject/gobjectmodule.c
@@ -28,6 +28,13 @@
#include "pythread.h"
#include <gobject/gvaluecollector.h>
+#ifdef HAVE_FFI_H
+#include "ffi-marshaller.h"
+static GSignalCMarshaller marshal_generic = g_cclosure_marshal_generic_ffi;
+#else
+static GSignalCMarshaller marshal_generic = 0;
+#endif
+
static PyObject *gerror_exc = NULL;
static gboolean use_gil_state_api = FALSE;
static PyObject *_pyg_signal_accumulator_true_handled_func;
@@ -594,7 +601,7 @@ create_signal (GType instance_type, const gchar *signal_name, PyObject *tuple)
signal_id = g_signal_newv(signal_name, instance_type, signal_flags,
pyg_signal_class_closure_get(),
accumulator, accum_data,
- (GSignalCMarshaller)0,
+ marshal_generic,
return_type, n_params, param_types);
g_free(param_types);
@@ -3452,7 +3459,7 @@ struct _PyGObject_Functions pygobject_api_functions = {
DL_EXPORT(void)
init_gobject(void)
{
- PyObject *m, *d, *o, *tuple;
+ PyObject *m, *d, *o, *tuple, *features;
PyObject *descr;
PyObject *warning;
@@ -3556,7 +3563,16 @@ init_gobject(void)
PyDict_SetItemString(d, "_PyGObject_API",
o=PyCObject_FromVoidPtr(&pygobject_api_functions,NULL));
Py_DECREF(o);
-
+
+
+ /* features */
+ features = PyDict_New();
+#ifdef HAVE_FFI_H
+ PyDict_SetItemString(features, "generic-c-marshaller", Py_True);
+#endif
+ PyDict_SetItemString(d, "features", features);
+ Py_DECREF(features);
+
/* some constants */
PyModule_AddIntConstant(m, "SIGNAL_RUN_FIRST", G_SIGNAL_RUN_FIRST);
PyModule_AddIntConstant(m, "SIGNAL_RUN_LAST", G_SIGNAL_RUN_LAST);