PyWebKitGtk 1.0.2 release
[pywebkitgtk.git] / webkit.override
blob3447dc9cb81e39cafa1c0fc68fb38a460bbe1be2
1 /* -*- Mode: C; c-basic-offset: 4 -*- */
2 /*
3  Copyright (C) 2006, Red Hat, Inc.
4  Copyright (C) 2007, One Laptop Per Child
5  Copyright (C) 2007-2008, Jan Michael Alonzo <jmalonzo@unpluggable.com>
7  This program is free software; you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation; either version 2 of the License, or
10  (at your option) any later version.
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  GNU General Public License for more details.
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
23 headers
24 #include <Python.h>
25 #define NO_IMPORT
26 #include <pygtk/pygtk.h>
27 #include <pygobject.h>
28 #include <webkit/webkit.h>
29 #include <JavaScriptCore/JSContextRef.h>
31 #include "javascriptcore/javascriptcore_types.h"
33 body
34 static PyObject *
35 _helper_wrap_gobject_glist (GList *list)
37     PyObject *py_list;
38     GList *tmp;
40     if ((py_list = PyList_New(0)) == NULL) {
41         return NULL;
42     }
43     for (tmp = list; tmp != NULL; tmp = tmp->next) {
44         PyObject *py_obj = pygobject_new(G_OBJECT(tmp->data));
46         if (py_obj == NULL) {
47             Py_DECREF(py_list);
48             return NULL;
49         }
50         
51         PyList_Append(py_list, py_obj);
52         Py_DECREF(py_obj);
53     }
55     return py_list;
58 modulename webkit
60 import gtk.Container as PyGtkContainer_Type
61 import gobject.GObject as PyGObject_Type
63 ignore-glob
64   *_get_type
65   _*
67 ignore
68   webkit_web_settings_get_type
69   webkit_web_back_forward_list_get_type
70   webkit_web_frame_get_type
71   webkit_web_history_item_get_type
72   webkit_web_view_get_type
73   webkit_network_request_get_type
75 override webkit_web_frame_get_global_context noargs
76 static PyObject *
77 _wrap_webkit_web_frame_get_global_context (PyGObject *self)
79     JSGlobalContextRef ref;
81     ref = webkit_web_frame_get_global_context (WEBKIT_WEB_FRAME (self->obj));
83     return wrap_JSGlobalContextRef (ref);
86 override webkit_web_back_forward_list_get_back_list_with_limit
87 static PyObject *
88 _wrap_webkit_web_back_forward_list_get_back_list_with_limit (PyGObject *self, PyObject *args, PyObject *kwargs)
90     static char *kwlist[] = { "limit", NULL };
92     GList *list;
93     int limit;
94     
95     if (! PyArg_ParseTupleAndKeywords (args, kwargs, "i:WebBackForwardList.get_back_list_with_limit", kwlist, &limit))
96         return NULL;
97     
98     list = webkit_web_back_forward_list_get_back_list_with_limit(WEBKIT_WEB_BACK_FORWARD_LIST(self->obj),
99                                                                  limit);
100     return _helper_wrap_gobject_glist (list);
103 override webkit_web_back_forward_list_get_forward_list_with_limit
104 static PyObject *
105 _wrap_webkit_web_back_forward_list_get_forward_list_with_limit (PyGObject *self, PyObject *args, PyObject *kwargs)
107     static char *kwlist[] = { "limit", NULL };
109     GList *list;
110     int limit;
111     
112     if (! PyArg_ParseTupleAndKeywords (args, kwargs, "i:WebBackForwardList.get_forward_list_with_limit", kwlist, &limit))
113         return NULL;                                                                                                                         
114     
115     list = webkit_web_back_forward_list_get_forward_list_with_limit(WEBKIT_WEB_BACK_FORWARD_LIST(self->obj),
116                                                                     limit);
117     return _helper_wrap_gobject_glist (list);