diff options
author | Thomas Martitz <kugel@rockbox.org> | 2016-05-17 22:11:17 +0200 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2016-05-17 22:11:17 +0200 |
commit | ace28857b70d8a8fe97cdf29f937614eb13de781 (patch) | |
tree | 11c759eaec999dd5a934797546b35a1fa5d42179 /gtk/scintilla-marshal.c | |
parent | 99d52264a609b61e8639f3c1087a78fedb0b9de8 (diff) | |
download | scintilla-mirror-ace28857b70d8a8fe97cdf29f937614eb13de781.tar.gz |
Enable g-ir-scanner to scan ScintillaObject signals
Currently, the ScintillaObject signals can't be used from python code via
gobject-introspection. This is because g-ir-scanner does not properly scan
the signals.
For signals, there is the additional requirement that parameters have are
registered GTypes. For the sci-notify signal, this can be accomplished by
boxing SCNotification.
In addition, g-ir-scanner also runs on Scintilla.h where it picks up
additional structs.
test/gi/ is updated accordingly. The test python script is enhanced
to showcase the signals (some fixes to the makefile are included as well).
Diffstat (limited to 'gtk/scintilla-marshal.c')
-rw-r--r-- | gtk/scintilla-marshal.c | 65 |
1 files changed, 51 insertions, 14 deletions
diff --git a/gtk/scintilla-marshal.c b/gtk/scintilla-marshal.c index 5470a5ba5..c91bd0bcd 100644 --- a/gtk/scintilla-marshal.c +++ b/gtk/scintilla-marshal.c @@ -49,20 +49,20 @@ #endif /* !G_ENABLE_DEBUG */ -/* NONE:INT,POINTER (scintilla-marshal.list:1) */ +/* NONE:INT,OBJECT (scintilla-marshal.list:1) */ void -scintilla_marshal_VOID__INT_POINTER (GClosure *closure, - GValue *return_value G_GNUC_UNUSED, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint G_GNUC_UNUSED, - gpointer marshal_data) +scintilla_marshal_VOID__INT_OBJECT (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint G_GNUC_UNUSED, + gpointer marshal_data) { - typedef void (*GMarshalFunc_VOID__INT_POINTER) (gpointer data1, - gint arg_1, - gpointer arg_2, - gpointer data2); - GMarshalFunc_VOID__INT_POINTER callback; + typedef void (*GMarshalFunc_VOID__INT_OBJECT) (gpointer data1, + gint arg_1, + gpointer arg_2, + gpointer data2); + GMarshalFunc_VOID__INT_OBJECT callback; GCClosure *cc = (GCClosure*) closure; gpointer data1, data2; @@ -78,11 +78,48 @@ scintilla_marshal_VOID__INT_POINTER (GClosure *closure, data1 = g_value_peek_pointer (param_values + 0); data2 = closure->data; } - callback = (GMarshalFunc_VOID__INT_POINTER) (marshal_data ? marshal_data : cc->callback); + callback = (GMarshalFunc_VOID__INT_OBJECT) (marshal_data ? marshal_data : cc->callback); callback (data1, g_marshal_value_peek_int (param_values + 1), - g_marshal_value_peek_pointer (param_values + 2), + g_marshal_value_peek_object (param_values + 2), + data2); +} + +/* NONE:INT,BOXED (scintilla-marshal.list:2) */ +void +scintilla_marshal_VOID__INT_BOXED (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint G_GNUC_UNUSED, + gpointer marshal_data) +{ + typedef void (*GMarshalFunc_VOID__INT_BOXED) (gpointer data1, + gint arg_1, + gpointer arg_2, + gpointer data2); + GMarshalFunc_VOID__INT_BOXED callback; + GCClosure *cc = (GCClosure*) closure; + gpointer data1, data2; + + g_return_if_fail (n_param_values == 3); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = g_value_peek_pointer (param_values + 0); + } + else + { + data1 = g_value_peek_pointer (param_values + 0); + data2 = closure->data; + } + callback = (GMarshalFunc_VOID__INT_BOXED) (marshal_data ? marshal_data : cc->callback); + + callback (data1, + g_marshal_value_peek_int (param_values + 1), + g_marshal_value_peek_boxed (param_values + 2), data2); } |