summaryrefslogtreecommitdiff
path: root/gi/pygi.h
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2017-07-12 08:35:52 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2017-07-12 08:35:52 +0900
commitc79482ebfe55da780fd2d733696f5107dc4d5cb8 (patch)
tree8411f3b719fb7caa88160b97cf5f00802a717cec /gi/pygi.h
parentee96b8b4ed303ec374e37237f86555754cf2ae60 (diff)
downloadpygobject2-c79482ebfe55da780fd2d733696f5107dc4d5cb8.tar.gz
pygobject2-c79482ebfe55da780fd2d733696f5107dc4d5cb8.tar.bz2
pygobject2-c79482ebfe55da780fd2d733696f5107dc4d5cb8.zip
Imported Upstream version 2.27.91
Change-Id: I3788dba2f5257cabaed71dd66932f46025d61a4e Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'gi/pygi.h')
-rw-r--r--gi/pygi.h38
1 files changed, 36 insertions, 2 deletions
diff --git a/gi/pygi.h b/gi/pygi.h
index 2765b40..1c3bf5e 100644
--- a/gi/pygi.h
+++ b/gi/pygi.h
@@ -71,6 +71,11 @@ struct PyGI_API {
gint (*set_property_value) (PyGObject *instance,
const gchar *attr_name,
PyObject *value);
+ GClosure * (*signal_closure_new) (PyGObject *instance,
+ const gchar *sig_name,
+ PyObject *callback,
+ PyObject *extra_args,
+ PyObject *swap_data);
void (*register_foreign_struct) (const char* namespace_,
const char* name,
PyGIArgOverrideToGIArgumentFunc to_func,
@@ -83,14 +88,20 @@ static struct PyGI_API *PyGI_API = NULL;
static int
_pygi_import (void)
{
+ PyObject *modules_dict;
+
if (PyGI_API != NULL) {
return 1;
}
+
+ modules_dict = PyImport_GetModuleDict(); /* borrowed reference -- don't unref */
+ if (PyMapping_HasKeyString(modules_dict, "gi")) {
#if PY_VERSION_HEX >= 0x03000000
- PyGI_API = (struct PyGI_API*) PyCapsule_Import("gi._API", FALSE);
+ PyGI_API = (struct PyGI_API*) PyCapsule_Import("gi._API", FALSE);
#else
- PyGI_API = (struct PyGI_API*) PyCObject_Import("gi", "_API");
+ PyGI_API = (struct PyGI_API*) PyCObject_Import("gi", "_API");
#endif
+ }
if (PyGI_API == NULL) {
return -1;
}
@@ -128,6 +139,19 @@ pygi_set_property_value (PyGObject *instance,
return PyGI_API->set_property_value(instance, attr_name, value);
}
+static inline GClosure *
+pygi_signal_closure_new (PyGObject *instance,
+ const gchar *sig_name,
+ PyObject *callback,
+ PyObject *extra_args,
+ PyObject *swap_data)
+{
+ if (_pygi_import() < 0) {
+ return NULL;
+ }
+ return PyGI_API->signal_closure_new(instance, sig_name, callback, extra_args, swap_data);
+}
+
static inline PyObject *
pygi_register_foreign_struct (const char* namespace_,
const char* name,
@@ -169,6 +193,16 @@ pygi_set_property_value (PyGObject *instance,
return -1;
}
+static inline GClosure *
+pygi_signal_closure_new (PyGObject *instance,
+ const gchar *sig_name,
+ PyObject *callback,
+ PyObject *extra_args,
+ PyObject *swap_data)
+{
+ return NULL;
+}
+
#endif /* ENABLE_INTROSPECTION */
#endif /* __PYGI_H__ */