diff options
author | Bruno Coudoin <bcoudoin@src.gnome.org> | 2009-03-10 20:31:15 (GMT) |
---|---|---|
committer | Bruno Coudoin <bcoudoin@src.gnome.org> | 2009-03-10 20:31:15 (GMT) |
commit | b631173c972d2367bfdbf1bc9b002e90639bb6c1 (patch) | |
tree | ccb14129843ae4811b8dc5361347a66c3ffbe568 /src/boards | |
parent | 503d68148cfbf3255c4890b8565ad4d34859c202 (diff) |
missing file
svn path=/trunk/; revision=3766
Diffstat (limited to 'src/boards')
-rw-r--r-- | src/boards/py-gcompris-boardconfig.c | 78 | ||||
-rw-r--r-- | src/boards/py-gcompris-boardconfig.h | 14 |
2 files changed, 92 insertions, 0 deletions
diff --git a/src/boards/py-gcompris-boardconfig.c b/src/boards/py-gcompris-boardconfig.c new file mode 100644 index 0000000..03c926a --- /dev/null +++ b/src/boards/py-gcompris-boardconfig.c @@ -0,0 +1,78 @@ +#include "py-gcompris-boardconfig.h" +#define NO_IMPORT_PYGOBJECT 1 +#include <pygobject.h> +#include "py-gcompris-profile.h" +#include "py-gcompris-board.h" + +staticforward PyTypeObject pyGcomprisBoardConfigType; + +/* Special function created for the python plugin to be able to create + * a pyGcomprisBoardObject form the existing GcomprisBoard structure + */ +PyObject* +gcompris_new_pyGcomprisBoardConfigObject(GcomprisBoardConf* boardconfig) +{ + pyGcomprisBoardConfigObject* theboardconf = NULL; + + theboardconf = PyObject_New(pyGcomprisBoardConfigObject, &pyGcomprisBoardConfigType); + if (theboardconf!=NULL) + theboardconf->cdata = boardconfig ; + + return (PyObject*)theboardconf; +} + + +/* Free the python gcompris board config */ +static void +pyGcomprisBoardConfigType_dealloc(pyGcomprisBoardConfigObject *self) +{ + self->cdata = NULL; + PyObject_DEL(self); +} + + +/* Methods defined in the pyGcomprisBoardConfig class */ +static PyMethodDef pyGcomprisBoardConfigType_methods[] = { + {NULL, NULL} /* sentinel */ +}; + + +/* Return the value of the members contained in the GcomprisBoardConfig structure */ +static PyObject * +pyGcomprisBoardConfigType_getattr(pyGcomprisBoardConfigObject *self, char *name) +{ + return Py_FindMethod(pyGcomprisBoardConfigType_methods, (PyObject *)self, name); + +} + +/* Set the value of a GcomprisBoardConfig structure member */ +static int +pyGcomprisBoardConfigType_setattr(pyGcomprisBoardConfigObject *self, char *name, PyObject *v) +{ + /* members are supposed to be read only */ + + return -1; +} + +static PyTypeObject pyGcomprisBoardConfigType = { +#if defined(WIN32) + PyObject_HEAD_INIT(NULL) +#else /* ! WIN32 */ + PyObject_HEAD_INIT(&PyType_Type) +#endif + 0, /*ob_size*/ + "pyGcomprisBoardConfig", /*tp_name*/ + sizeof(pyGcomprisBoardConfigObject), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + /* methods */ + (destructor)pyGcomprisBoardConfigType_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + (getattrfunc)pyGcomprisBoardConfigType_getattr, /*tp_getattr*/ + (setattrfunc)pyGcomprisBoardConfigType_setattr, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ +}; diff --git a/src/boards/py-gcompris-boardconfig.h b/src/boards/py-gcompris-boardconfig.h new file mode 100644 index 0000000..3d7cbbb --- /dev/null +++ b/src/boards/py-gcompris-boardconfig.h @@ -0,0 +1,14 @@ +#ifndef _PY_GCOMPRIS_BOARDCONFIG_H_ +#define _PY_GCOMPRIS_BOARDCONFIG_H_ + +#include <Python.h> +#include "gcompris/gcompris.h" + +PyObject* gcompris_new_pyGcomprisBoardConfigObject(GcomprisBoardConf * boardconfig); + +typedef struct{ + PyObject_HEAD + GcomprisBoardConf* cdata; +} pyGcomprisBoardConfigObject; + +#endif |