Initialize glib threads since it's needed by WebKitGtk soup http-backend build.
[pywebkitgtk.git] / gjs / gjs.override
blob453fc43d05cdd4aefb4f012091e4c737cef1c05e
1 /* -*- Mode: C; c-basic-offset: 4 -*- */
2 /*
3  Copyright (C) 2008 Luke Kenneth Carlson Leigh
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
10  This program 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
13  GNU General Public License for more details.
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to the Free Software
17  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
21 headers
22 #include <Python.h>
23 #define NO_IMPORT_PYGOBJECT
24 #include <pygtk/pygtk.h>
25 #include <pygobject.h>
26 #include <glib.h>
28 #include "gjs/gjs.h"
30 body
32 modulename webkit.gjs
34 ignore-blob
35    *_get_type
36    _*
38 import gobject.GObject as PyGObject_Type
40 override gjs_value_execute
41 static PyObject *
42 _wrap_gjs_value_execute(PyGObject *self, PyObject *args, PyObject *kwargs)
44     static char *kwlist[] = { "script", NULL };
45     const char *script;
46     gchar *exception = NULL;
47     GjsValue *ret;
49     if (!PyArg_ParseTupleAndKeywords(args, kwargs,"s:GjsValue.execute", kwlist, &script))
50         return NULL;
52     ret = gjs_value_execute(GJS_VALUE(self->obj), script, &exception);
54     if (exception)
55     {
56         PyErr_SetString(
57             PyExc_RuntimeError, /* TODO: better exception */
58             exception);
59         g_free(exception);
60         return NULL;
61     }
63     if (ret == NULL)
64         return NULL;
66     /* pygobject_new handles NULL checking */
67     return pygobject_new((GObject *)ret);