1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
|
/* -*- Mode: C; c-basic-offset: 4 -*-
* Copyright © 2005 Adam Hooper <adamh@cvs.gnome.org>
* Copyright © 2005 Christian Persch <chpe@cvs.gnome.org>
* Copyright © 2005 Crispin Flowerday <gnome@flowerday.cx>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
* USA
*/
%%
headers
#include <Python.h>
#define NO_IMPORT
#include <pygobject.h>
#include <pygtk/pygtk.h>
#include "ephy-bookmarks.h"
#include "ephy-bookmarks-type-builtins.h"
#include "ephy-command-manager.h"
#include "ephy-cookie-manager.h"
#include "ephy-dialog.h"
#include "ephy-embed-event.h"
#include "ephy-embed-factory.h"
#include "ephy-embed.h"
#include "ephy-embed-container.h"
#include "ephy-embed-persist.h"
#include "ephy-embed-prefs.h"
#include "ephy-embed-shell.h"
#include "ephy-embed-single.h"
#include "ephy-embed-type-builtins.h"
#include "ephy-extension.h"
#include "ephy-extensions-manager.h"
#include "ephy-find-toolbar.h"
#include "ephy-history.h"
#include "ephy-lib-type-builtins.h"
#include "ephy-node-db.h"
#include "ephy-node.h"
#include "ephy-notebook.h"
#include "ephy-password-manager.h"
#include "ephy-permission-manager.h"
#include "ephy-session.h"
#include "ephy-shell.h"
#include "ephy-state.h"
#include "ephy-statusbar.h"
#include "ephy-type-builtins.h"
#include "ephy-window.h"
#include "ephy-link.h"
#include "ephy-link-action.h"
#include "egg-toolbars-model.h"
#include "egg-editable-toolbar.h"
#include "ephy-toolbars-model.h"
#include "ephy-toolbar.h"
#include "ephy-search-entry.h"
#include "ephy-spinner.h"
#include "ephy-location-action.h"
#include "ephy-favicon-cache.h"
#include "eggtypebuiltins.h"
void pyepiphany_register_classes (PyObject *d);
void pyepiphany_add_constants (PyObject *module, const gchar *strip_prefix);
static PyObject *
_helper_wrap_string_glist (GList *list)
{
GList *tmp;
PyObject *py_list;
if ((py_list = PyList_New(0)) == NULL) {
g_list_foreach(list, (GFunc)g_free, NULL);
g_list_free(list);
return NULL;
}
for (tmp = list; tmp != NULL; tmp = tmp->next) {
PyObject *str_obj = PyString_FromString ((char*)tmp->data);
if (str_obj == NULL) {
g_list_foreach(list, (GFunc)g_free, NULL);
g_list_free(list);
Py_DECREF(py_list);
return NULL;
}
PyList_Append(py_list, str_obj);
Py_DECREF(str_obj);
}
g_list_foreach(list, (GFunc)g_free, NULL);
g_list_free(list);
return py_list;
}
static PyObject *
_helper_wrap_gobject_glist (GList *list)
{
PyObject *py_list;
GList *tmp;
if ((py_list = PyList_New(0)) == NULL) {
return NULL;
}
for (tmp = list; tmp != NULL; tmp = tmp->next) {
PyObject *py_obj = pygobject_new(G_OBJECT(tmp->data));
if (py_obj == NULL) {
Py_DECREF(py_list);
return NULL;
}
PyList_Append(py_list, py_obj);
Py_DECREF(py_obj);
}
return py_list;
}
static void
free_boxed_type (gpointer data, gpointer type)
{
g_boxed_free (GPOINTER_TO_INT(type), data);
}
static PyObject *
_helper_wrap_boxed_glist (GType type, GList *list)
{
GList *tmp;
PyObject *py_list;
if ((py_list = PyList_New(0)) == NULL) {
g_list_foreach(list, free_boxed_type, GINT_TO_POINTER(type));
g_list_free(list);
return NULL;
}
for (tmp = list; tmp != NULL; tmp = tmp->next) {
PyObject *obj = pyg_boxed_new (type, tmp->data, FALSE, TRUE);
PyList_Append(py_list, obj);
Py_DECREF(obj);
}
g_list_free(list);
return py_list;
}
static PyObject *
_helper_wrap_boxed_gptrarray (GType type, GPtrArray *list, gboolean own_ref, gboolean dealloc)
{
PyObject *py_list;
int i;
if ((py_list = PyList_New(0)) == NULL) {
return NULL;
}
for( i = 0; i < list->len; i++ ) {
PyObject *obj = pyg_boxed_new (type, g_ptr_array_index(list,i), FALSE, own_ref);
PyList_Append(py_list, obj);
Py_DECREF(obj);
}
if (dealloc) g_ptr_array_free (list, TRUE);
return py_list;
}
%%
modulename epiphany
%%
import gtk.Widget as PyGtkWidget_Type
import gtk.Bin as PyGtkBin_Type
import gtk.VBox as PyGtkVBox_Type
import gtk.Statusbar as PyGtkStatusbar_Type
import gtk.Notebook as PyGtkNotebook_Type
import gtk.Toolbar as PyGtkToolbar_Type
import gtk.Entry as PyGtkEntry_Type
import gtk.EventBox as PyGtkEventBox_Type
import gtk.Window as PyGtkWindow_Type
import gtk.Action as PyGtkAction_Type
import gtk.UIManager as PyGtkUIManager_Type
import gtk.Menu as PyGtkMenu_Type
import gtk.ActionGroup as PyGtkActionGroup_Type
import gtk.gdk.Pixbuf as PyGdkPixbuf_Type
import gobject.GObject as PyGObject_Type
%%
ignore-glob
*_get_type
%%
ignore
ephy_embed_event_get_dom_event
ephy_shell_error_quark
ephy_shell_startup
ephy_shell_get_dbus_service
ephy_find_toolbar_new
ephy_find_toolbar_close
ephy_find_toolbar_set_embed
%%
override-slot EphyShell.tp_init
static int
_wrap_ephy_shell_tp_init(PyGObject *self, PyObject *args, PyObject *kwargs)
{
static char *kwlist[] = { NULL };
if (!PyArg_ParseTupleAndKeywords(args, kwargs, ":epiphany.Shell.__init__", kwlist)) {
return -1;
}
self->obj = (GObject *) g_object_ref (ephy_shell_get_default());
pygobject_register_wrapper((PyObject *)self);
return 0;
}
%%
override-slot EphyEmbedShell.tp_init
static int
_wrap_ephy_embed_shell_tp_init(PyGObject *self, PyObject *args, PyObject *kwargs)
{
static char *kwlist[] = { NULL };
if (!PyArg_ParseTupleAndKeywords(args, kwargs, ":epiphany.EmbedShell.__init__", kwlist)) {
return -1;
}
self->obj = (GObject *) g_object_ref (ephy_embed_shell_get_default());
pygobject_register_wrapper((PyObject *)self);
return 0;
}
%%
override ephy_embed_event_get_coords noargs
static PyObject *
_wrap_ephy_embed_event_get_coords(PyGObject *self)
{
guint x, y;
ephy_embed_event_get_coords (EPHY_EMBED_EVENT(self->obj), &x, &y);
return Py_BuildValue("(ll)", x, y);
}
%%
override ephy_embed_get_security_level noargs
static PyObject *
_wrap_ephy_embed_get_security_level(PyGObject *self)
{
EphyEmbedSecurityLevel level;
char *description;
PyObject* ret;
ephy_embed_get_security_level (EPHY_EMBED(self->obj), &level, &description);
ret = Py_BuildValue("(Os)",
pyg_enum_from_gtype (EPHY_TYPE_EMBED_SECURITY_LEVEL, level),
description);
g_free (description);
return ret;
}
%%
override ephy_window_get_tabs noargs
static PyObject *
_wrap_ephy_window_get_tabs(PyGObject *self)
{
GList *list;
PyObject *py_list;
list = ephy_window_get_tabs(EPHY_WINDOW (self->obj));
py_list = _helper_wrap_gobject_glist (list);
g_list_free(list);
return py_list;
}
%%
override ephy_embed_shistory_get_nth kwargs
static PyObject*
_wrap_ephy_embed_shistory_get_nth (PyGObject *self,
PyObject *args, PyObject *kwargs)
{
static char *kwlist[] = {"nth", "is_relative", NULL};
int nth, is_relative;
char *url, *title;
PyObject *py_url, *py_title;
PyObject *py_list;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"ii:EphyEmbed.shistory_get_nth", kwlist,
&nth, &is_relative)) {
return NULL;
}
ephy_embed_shistory_get_nth (EPHY_EMBED (self->obj), nth, is_relative,
&url, &title);
if (!url || !title) {
return Py_None;
}
if ((py_list = PyList_New(0)) == NULL) {
g_free (url);
g_free (title);
return NULL;
}
py_url = PyString_FromString (url);
g_free (url);
if (!py_url) {
g_free (title);
Py_DECREF(py_list);
return NULL;
}
PyList_Append(py_list, py_url);
Py_DECREF(py_url);
py_title = PyString_FromString (title);
g_free (title);
if (!py_title) {
Py_DECREF(py_list);
return NULL;
}
PyList_Append(py_list, py_title);
Py_DECREF(py_title);
return py_list;
}
%%
override ephy_embed_get_go_up_list noargs
static PyObject*
_wrap_ephy_embed_get_go_up_list (PyGObject *self)
{
GSList *list, *tmp;
PyObject *py_list;
list = ephy_embed_get_go_up_list (EPHY_EMBED (self->obj));
if ((py_list = PyList_New(0)) == NULL) {
g_slist_foreach(list, (GFunc)g_free, NULL);
g_slist_free(list);
return NULL;
}
for (tmp = list; tmp != NULL; tmp = tmp->next) {
PyObject *str_obj = PyString_FromString ((char*)tmp->data);
if (str_obj == NULL) {
g_slist_foreach(list, (GFunc)g_free, NULL);
g_slist_free(list);
Py_DECREF(py_list);
return NULL;
}
PyList_Append(py_list, str_obj);
Py_DECREF(str_obj);
}
g_slist_foreach(list, (GFunc)g_free, NULL);
g_slist_free(list);
return py_list;
}
%%
override ephy_embed_single_get_printer_list noargs
static PyObject*
_wrap_ephy_embed_single_get_printer_list (PyGObject *self)
{
GList *list;
list = ephy_embed_single_get_printer_list (EPHY_EMBED_SINGLE (self->obj));
return _helper_wrap_string_glist (list);
}
%%
override ephy_embed_single_get_font_list kwargs
static PyObject*
_wrap_ephy_embed_single_get_font_list (PyGObject *self,
PyObject *args, PyObject *kwargs)
{
static char *kwlist[] = {"font_group", NULL};
char *font_group;
GList *list;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"s:EphyEmbedSingle.get_font_list", kwlist, &font_group))
return NULL;
list = ephy_embed_single_get_font_list (EPHY_EMBED_SINGLE (self->obj), font_group);
return _helper_wrap_string_glist (list);
}
%%
override ephy_embed_event_get_property kwargs
static PyObject*
_wrap_ephy_embed_event_get_property (PyGObject *self,
PyObject *args, PyObject *kwargs)
{
static char *kwlist[] = {"property", NULL};
char *prop;
const GValue *value;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"s:EphyEmbedEvent.get_property", kwlist, &prop))
return NULL;
value = ephy_embed_event_get_property (EPHY_EMBED_EVENT (self->obj), prop);
return pyg_value_as_pyobject(value, TRUE);
}
%%
override ephy_password_manager_list_passwords noargs
static PyObject*
_wrap_ephy_password_manager_list_passwords (PyGObject *self)
{
GList *list;
list = ephy_password_manager_list_passwords (EPHY_PASSWORD_MANAGER (self->obj));
return _helper_wrap_boxed_glist (EPHY_TYPE_PASSWORD_INFO, list);
}
%%
override ephy_cookie_manager_list_cookies noargs
static PyObject *
_wrap_ephy_cookie_manager_list_cookies(PyGObject *self)
{
GList *list;
list = ephy_cookie_manager_list_cookies(EPHY_COOKIE_MANAGER (self->obj));
return _helper_wrap_boxed_glist (EPHY_TYPE_COOKIE, list);
}
%%
override ephy_permission_manager_list_permissions kwargs
static PyObject *
_wrap_ephy_permission_manager_list_permissions (PyGObject *self,
PyObject *args, PyObject *kwargs)
{
static char *kwlist[] = {"type", NULL};
char *type;
GList *list;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"s:EphyPermissionManager.list_permissions", kwlist, &type))
return NULL;
list = ephy_permission_manager_list_permissions(EPHY_PERMISSION_MANAGER (self->obj), type);
return _helper_wrap_boxed_glist (EPHY_TYPE_PERMISSION_INFO, list);
}
%%
override-attr EphyPermissionInfo.type
static PyObject*
_wrap_ephy_permission_info__get_type (PyObject* self, void* closure)
{
const char* type;
type = g_quark_to_string (pyg_boxed_get(self, EphyPermissionInfo)->qtype);
return PyString_FromString (type);
}
%%
override ephy_node_get_children noargs
static PyObject *
_wrap_ephy_node_get_children (PyGObject *self)
{
GPtrArray *list = ephy_node_get_children ((EphyNode *) (self->obj));
return _helper_wrap_boxed_gptrarray (EPHY_TYPE_NODE, list, FALSE, FALSE);
}
%%
override ephy_session_get_windows noargs
static PyObject *
_wrap_ephy_session_get_windows (PyGObject *self)
{
GList *list;
PyObject *py_list;
list = ephy_session_get_windows (EPHY_SESSION (self->obj));
py_list = _helper_wrap_gobject_glist (list);
g_list_free(list);
return py_list;
}
%%
override ephy_notebook_get_focused_pages noargs
static PyObject *
_wrap_ephy_notebook_get_focused_pages (PyGObject *self)
{
GList *list;
PyObject *py_list;
list = ephy_notebook_get_focused_pages (EPHY_NOTEBOOK (self->obj));
py_list = _helper_wrap_gobject_glist (list);
return py_list;
}
|