PyWebKitGtk 1.1.7
[pywebkitgtk.git] / webkit / webkitmodule.c
blob73f18e1f05cef9c6337947f07929cd704181cdac
1 /*
2 * Copyright (C) 2006-2007, Red Hat, Inc.
3 * Copyright (C) 2009 Jan Michael Alonzo <jmalonzo@gmail.com>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
20 #include <Python.h>
21 #ifdef HAVE_CONFIG_H
22 #include "config.h"
23 #endif
25 #include <glib.h>
26 /* include this first, before NO_IMPORT_PYGOBJECT is defined */
27 #include <pygobject.h>
28 #include <pygtk/pygtk.h>
30 extern PyMethodDef pywebkit_functions[];
32 void pywebkit_register_classes (PyObject *d);
34 DL_EXPORT(void)
35 initwebkit(void)
37 PyObject *m, *d;
39 if (!pygobject_init(-1, -1, -1)) {
40 PyErr_Print();
41 Py_FatalError ("can't initialise module gobject");
44 init_pygtk();
46 if (!g_thread_supported())
47 g_thread_init (NULL);
49 /* webkit module */
50 m = Py_InitModule ("webkit", pywebkit_functions);
51 d = PyModule_GetDict (m);
52 pywebkit_register_classes (d);
54 if (PyErr_Occurred ()) {
55 PyErr_Print();
56 Py_FatalError ("can't initialise module webkit.gjs");