talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit b68cfc804576fc1097370435e2cc05580c8c77fc
parent 845d06230be8876ec0664d362125e1e1b6575507
Author: Holger Berndt <hb@claws-mail.org>
Date:   Sun, 26 Jan 2014 13:14:21 +0100

Python plugin: Also check for _PyGtk_API being a PyCapsule

Seems like Arch Linux patched pygtk to wrap into a PyCapsule instead
of a PyCObject.

Thanks to Drew Ferguson for reporting.

Diffstat:
Msrc/plugins/python/python-hooks.c | 8+++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/plugins/python/python-hooks.c b/src/plugins/python/python-hooks.c @@ -196,9 +196,15 @@ parasite_python_init(char **error) */ if (cobject != NULL) { - if (PyCObject_Check(cobject)) + if (PyCObject_Check(cobject)) { _PyGtk_API = (struct _PyGtk_FunctionStruct*) PyCObject_AsVoidPtr(cobject); + } +#if PY_VERSION_HEX >= 0x02070000 + else if (PyCapsule_IsValid(cobject, "gtk._gtk._PyGtk_API")) { + _PyGtk_API = (struct _PyGtk_FunctionStruct*)PyCapsule_GetPointer(cobject, "gtk._gtk._PyGtk_API"); + } +#endif else { *error = g_strdup("Parasite: Could not find _PyGtk_API object"); return 0;