/* -*- Mode: C; c-basic-offset: 4 -*- */ %% headers #include #include #define NO_IMPORT_PYGOBJECT #include "pygobject.h" #include #include static PyObject * _helper_wrap_pointer_gslist (GType type, GSList *list) { GSList *tmp; PyObject *py_list; if ((py_list = PyList_New(0)) == NULL) { return NULL; } for (tmp = list; tmp != NULL; tmp = tmp->next) { PyObject *obj = pyg_pointer_new (type, tmp->data); PyList_Append(py_list, obj); Py_DECREF(obj); } return py_list; } static PyObject * _helper_wrap_string_gslist (GSList *list) { GSList *tmp; PyObject *py_list; if ((py_list = PyList_New(0)) == NULL) { return NULL; } for (tmp = list; tmp != NULL; tmp = tmp->next) { PyObject *str_obj = PyString_FromString ((char*)tmp->data); if (str_obj == NULL) { Py_DECREF(py_list); return NULL; } PyList_Append(py_list, str_obj); Py_DECREF(str_obj); } return py_list; } %% modulename json_glib %% import gobject.GObject as PyGObject_Type