1 2 #define CONVERT_OBJECT_LIST(py_list, g_list) \ 3 { \ 4 GList *node; \ 5 py_list = PyList_New (0); \ 6 for (node = g_list; node; node = g_list_next(node)) \ 7 { \ 8 PyObject *py_obj = pygobject_new ((GObject *)node->data); \ 9 PyList_Append (py_list, py_obj); \ 10 Py_DECREF(py_obj); \ 11 } \ 12 } 13 14 #define CONVERT_POINTER_LIST(py_list, g_list) \ 15 { \ 16 GList *node; \ 17 py_list = PyList_New (0); \ 18 for (node = g_list; node; node = g_list_next(node)) \ 19 { \ 20 PyObject *py_obj = PyCObject_FromVoidPtr (node->data, NULL); \ 21 PyList_Append (py_list, py_obj); \ 22 Py_DECREF(py_obj); \ 23 } \ 24 } 25 26 #define CONVERT_STRING_LIST(py_list, g_list) \ 27 { \ 28 GList *node; \ 29 py_list = PyList_New (0); \ 30 for (node = g_list; node; node = g_list_next(node)) \ 31 { \ 32 PyObject *py_obj = PyString_FromString ((const gchar *)node->data); \ 33 PyList_Append (py_list, py_obj); \ 34 Py_DECREF(py_obj); \ 35 } \ 36 } 37 38