gcompris r3766 - trunk/src/boards



Author: bcoudoin
Date: Tue Mar 10 20:31:15 2009
New Revision: 3766
URL: http://svn.gnome.org/viewvc/gcompris?rev=3766&view=rev

Log:
missing file


Added:
   trunk/src/boards/py-gcompris-boardconfig.c
   trunk/src/boards/py-gcompris-boardconfig.h

Added: trunk/src/boards/py-gcompris-boardconfig.c
==============================================================================
--- (empty file)
+++ trunk/src/boards/py-gcompris-boardconfig.c	Tue Mar 10 20:31:15 2009
@@ -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*/
+};

Added: trunk/src/boards/py-gcompris-boardconfig.h
==============================================================================
--- (empty file)
+++ trunk/src/boards/py-gcompris-boardconfig.h	Tue Mar 10 20:31:15 2009
@@ -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



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]