#ifdef HAVE_CONFIG_H
#include "../config.h"
#endif

/* include this first, before NO_IMPORT_PYGOBJECT is defined */
#include <pygobject.h>
#include <pygtk/pygtk.h>


void pydiaview_register_classes (PyObject *d);

extern PyMethodDef pydiaview_functions[];

DL_EXPORT(void)
initview (void)
{
	PyObject *m, *d;

	/* Standard initialization: */
	init_pygobject ();
	init_pygtk ();

	if (!PyImport_ImportModule("diacanvas._canvas")) {
		Py_FatalError("could not import diacanvas._canvas");
		return;
	}

	m = Py_InitModule ("diacanvas.view", pydiaview_functions);
	d = PyModule_GetDict (m);

	pydiaview_register_classes (d);

	if (PyErr_Occurred ()) {
		Py_FatalError ("can't initialise module diacanvas.view");
	}
}

