| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
#ifdef HAVE_CONFIG_H |
|---|
| 20 |
#include "config.h" |
|---|
| 21 |
#endif |
|---|
| 22 |
|
|---|
| 23 |
#define NO_IMPORT_PYGOBJECT |
|---|
| 24 |
#include "py_midgard.h" |
|---|
| 25 |
|
|---|
| 26 |
PyTypeObject G_GNUC_INTERNAL Pymidgard_view_Type; |
|---|
| 27 |
|
|---|
| 28 |
PyTypeObject G_GNUC_INTERNAL Pymidgard_view_Type = { |
|---|
| 29 |
PyObject_HEAD_INIT(NULL) |
|---|
| 30 |
0, |
|---|
| 31 |
"view", |
|---|
| 32 |
sizeof(PyGObject), |
|---|
| 33 |
0, |
|---|
| 34 |
|
|---|
| 35 |
(destructor)0, |
|---|
| 36 |
(printfunc)0, |
|---|
| 37 |
(getattrfunc)_py_midgard_get_object_attribute, |
|---|
| 38 |
(setattrfunc)0, |
|---|
| 39 |
(cmpfunc)0, |
|---|
| 40 |
(reprfunc)0, |
|---|
| 41 |
(PyNumberMethods*)0, |
|---|
| 42 |
(PySequenceMethods*)0, |
|---|
| 43 |
(PyMappingMethods*)0, |
|---|
| 44 |
(hashfunc)0, |
|---|
| 45 |
(ternaryfunc)0, |
|---|
| 46 |
(reprfunc)0, |
|---|
| 47 |
(getattrofunc)0, |
|---|
| 48 |
(setattrofunc)0, |
|---|
| 49 |
(PyBufferProcs*)0, |
|---|
| 50 |
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, |
|---|
| 51 |
NULL, |
|---|
| 52 |
(traverseproc)0, |
|---|
| 53 |
(inquiry)0, |
|---|
| 54 |
(richcmpfunc)0, |
|---|
| 55 |
offsetof(PyGObject, weakreflist), |
|---|
| 56 |
(getiterfunc)0, |
|---|
| 57 |
(iternextfunc)0, |
|---|
| 58 |
(struct PyMethodDef*)NULL, |
|---|
| 59 |
(struct PyMemberDef*)0, |
|---|
| 60 |
(struct PyGetSetDef*)0, |
|---|
| 61 |
NULL, |
|---|
| 62 |
NULL, |
|---|
| 63 |
(descrgetfunc)0, |
|---|
| 64 |
(descrsetfunc)0, |
|---|
| 65 |
offsetof(PyGObject, inst_dict), |
|---|
| 66 |
(initproc)0, |
|---|
| 67 |
(allocfunc)0, |
|---|
| 68 |
(newfunc)0, |
|---|
| 69 |
(freefunc)0, |
|---|
| 70 |
(inquiry)0 |
|---|
| 71 |
}; |
|---|
| 72 |
|
|---|
| 73 |
void py_midgard_base_view_register_class( |
|---|
| 74 |
PyObject *d, gpointer pygobject_type) |
|---|
| 75 |
{ |
|---|
| 76 |
pygobject_register_class(d, |
|---|
| 77 |
"view", |
|---|
| 78 |
MIDGARD_TYPE_VIEW, |
|---|
| 79 |
&Pymidgard_view_Type, |
|---|
| 80 |
Py_BuildValue("(O)", pygobject_type)); |
|---|
| 81 |
} |
|---|
| 82 |
|
|---|
| 83 |
PyTypeObject *__new_view_struct(const gchar *typename) |
|---|
| 84 |
{ |
|---|
| 85 |
|
|---|
| 86 |
PyTypeObject *ot = g_new0(PyTypeObject, 1); |
|---|
| 87 |
ot->ob_refcnt = 1; |
|---|
| 88 |
ot->ob_type = NULL; |
|---|
| 89 |
ot->tp_name = g_strdup(typename); |
|---|
| 90 |
ot->ob_size = 0; |
|---|
| 91 |
ot->tp_basicsize = sizeof(PyGObject); |
|---|
| 92 |
ot->tp_itemsize = 0; |
|---|
| 93 |
ot->tp_dealloc = 0; |
|---|
| 94 |
ot->tp_print = 0; |
|---|
| 95 |
ot->tp_getattr = 0; |
|---|
| 96 |
ot->tp_setattr = 0; |
|---|
| 97 |
ot->tp_compare = 0; |
|---|
| 98 |
ot->tp_repr = 0; |
|---|
| 99 |
ot->tp_as_number = 0; |
|---|
| 100 |
ot->tp_as_sequence = 0; |
|---|
| 101 |
ot->tp_as_mapping = 0; |
|---|
| 102 |
ot->tp_hash = 0; |
|---|
| 103 |
ot->tp_call = 0; |
|---|
| 104 |
ot->tp_str = 0; |
|---|
| 105 |
|
|---|
| 106 |
ot->tp_getattro = _py_midgard_get_object_attribute; |
|---|
| 107 |
ot->tp_setattro = _py_midgard_set_object_attribute; |
|---|
| 108 |
ot->tp_as_buffer = 0; |
|---|
| 109 |
ot->tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE; |
|---|
| 110 |
ot->tp_doc = "User defined view class"; |
|---|
| 111 |
ot->tp_traverse = 0; |
|---|
| 112 |
ot->tp_clear = 0; |
|---|
| 113 |
ot->tp_richcompare = 0; |
|---|
| 114 |
ot->tp_weaklistoffset = offsetof(PyGObject, weakreflist); |
|---|
| 115 |
ot->tp_iter = 0; |
|---|
| 116 |
ot->tp_iternext = 0; |
|---|
| 117 |
ot->tp_methods = 0; |
|---|
| 118 |
|
|---|
| 119 |
ot->tp_members = 0; |
|---|
| 120 |
ot->tp_getset = 0; |
|---|
| 121 |
ot->tp_base = NULL; |
|---|
| 122 |
ot->tp_dict = NULL; |
|---|
| 123 |
ot->tp_descr_get = 0; |
|---|
| 124 |
ot->tp_descr_set = 0; |
|---|
| 125 |
ot->tp_dictoffset = offsetof(PyGObject, inst_dict); |
|---|
| 126 |
ot->tp_init = 0; |
|---|
| 127 |
ot->tp_alloc = 0; |
|---|
| 128 |
ot->tp_new = 0; |
|---|
| 129 |
ot->tp_free = 0; |
|---|
| 130 |
ot->tp_is_gc = 0; |
|---|
| 131 |
|
|---|
| 132 |
ot->tp_bases = 0; |
|---|
| 133 |
ot->tp_mro = 0; |
|---|
| 134 |
ot->tp_cache = 0; |
|---|
| 135 |
ot->tp_subclasses = 0; |
|---|
| 136 |
ot->tp_weaklist = 0; |
|---|
| 137 |
ot->tp_del = 0; |
|---|
| 138 |
|
|---|
| 139 |
return ot; |
|---|
| 140 |
} |
|---|
| 141 |
|
|---|
| 142 |
void py_midgard_view_register_class( |
|---|
| 143 |
PyObject *d, gpointer pygobject_type) |
|---|
| 144 |
{ |
|---|
| 145 |
py_midgard_base_view_register_class(d, pygobject_type); |
|---|
| 146 |
|
|---|
| 147 |
guint n_types, i; |
|---|
| 148 |
const gchar *typename; |
|---|
| 149 |
GType *all_types = g_type_children(MIDGARD_TYPE_VIEW, &n_types); |
|---|
| 150 |
|
|---|
| 151 |
for (i = 0; i < n_types; i++) { |
|---|
| 152 |
|
|---|
| 153 |
typename = g_type_name(all_types[i]); |
|---|
| 154 |
|
|---|
| 155 |
PyTypeObject *ot = __new_view_struct(typename); |
|---|
| 156 |
pygobject_register_class(d, |
|---|
| 157 |
typename, all_types[i], ot, |
|---|
| 158 |
|
|---|
| 159 |
Py_BuildValue("(O)", pygobject_type)); |
|---|
| 160 |
} |
|---|
| 161 |
|
|---|
| 162 |
g_free(all_types); |
|---|
| 163 |
} |
|---|