summaryrefslogtreecommitdiffstats
path: root/swig
diff options
context:
space:
mode:
authorGravatar Bryan Forbes2010-03-09 10:29:11 -0600
committerGravatar Bryan Forbes2010-03-09 10:29:11 -0600
commitc01f740e26a5c0ac2aa13200cacd50890f125c06 (patch)
tree20ccda33748984ffa739b90028a302d505e33da9 /swig
parent6ceabe1e0a3c107c4b98d38f59f044b8eb7731a0 (diff)
downloadlibimobiledevice-c01f740e26a5c0ac2aa13200cacd50890f125c06.tar.gz
libimobiledevice-c01f740e26a5c0ac2aa13200cacd50890f125c06.tar.bz2
Updated the SWIG bindings for the userdata parameter to np_set_notify_callback.
Diffstat (limited to 'swig')
-rw-r--r--swig/imobiledevice.i18
1 files changed, 6 insertions, 12 deletions
diff --git a/swig/imobiledevice.i b/swig/imobiledevice.i
index 3c9fd3c..2de69e7 100644
--- a/swig/imobiledevice.i
+++ b/swig/imobiledevice.i
@@ -122,20 +122,15 @@ static PList::Node* new_node_from_plist(plist_t node)
122} 122}
123 123
124#ifdef SWIGPYTHON 124#ifdef SWIGPYTHON
125PyObject* python_callback = NULL; 125static void NotificationProxyPythonCallback(const char *notification, void* user_data) {
126 126 PyObject *func, *arglist;
127static void NotificationProxyPythonCallback(const char *notification) {
128 PyObject *arglist;
129 PyGILState_STATE gstate;
130 127
128 func = (PyObject *) user_data;
131 arglist = Py_BuildValue("(s)",notification); 129 arglist = Py_BuildValue("(s)",notification);
132 130
133 gstate = PyGILState_Ensure(); 131 PyEval_CallObject(func, arglist);
134
135 PyEval_CallObject(python_callback, arglist);
136 132
137 Py_XDECREF(arglist); 133 Py_DECREF(arglist);
138 PyGILState_Release(gstate);
139} 134}
140#endif 135#endif
141 %} 136 %}
@@ -338,8 +333,7 @@ typedef struct {
338%extend NotificationProxy { 333%extend NotificationProxy {
339 int16_t set_callback(PyObject *pyfunc) { 334 int16_t set_callback(PyObject *pyfunc) {
340 int16_t res; 335 int16_t res;
341 python_callback = pyfunc; 336 res = np_set_notify_callback($self->client, NotificationProxyPythonCallback, (void *) pyfunc);
342 res = np_set_notify_callback($self->client, NotificationProxyPythonCallback);
343 Py_INCREF(pyfunc); 337 Py_INCREF(pyfunc);
344 return res; 338 return res;
345 } 339 }