summaryrefslogtreecommitdiff
path: root/bindings/python/eom.override
blob: d95cf360fc2db4f2b89ffb8f1b88bb7fe99a89ad (plain)
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
%%
headers
#define NO_IMPORT
#include "pygobject.h"
#include <pygtk/pygtk.h>

#include "eom-enum-types.h"
#include "eom-application.h"
#include "eom-window.h"
#include "eom-dialog.h"
#include "eom-properties-dialog.h"
#include "eom-statusbar.h"
#include "eom-sidebar.h"
#include "eom-thumb-nav.h"
#include "eom-image.h"
#include "eom-scroll-view.h"
#include "eom-thumb-view.h"
#include "eom-list-store.h"
#include "eom-job-queue.h"
#include "eom-jobs.h"
#include "eom-plugin.h"

void pyeom_register_classes (PyObject *d);
void pyeom_add_constants (PyObject *module, const gchar *strip_prefix);

static PyObject *
_helper_wrap_gobject_glist (const GList *list)
{
    PyObject *py_list;
    const 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;
}
%%
modulename eom
%%
import gtk.Widget as PyGtkWidget_Type
import gobject.GObject as PyGObject_Type
import gtk.Window as PyGtkWindow_Type
import gtk.Action as PyGtkAction_Type
import gtk.Statusbar as PyGtkStatusbar_Type
import gtk.Menu as PyGtkMenu_Type
import gtk.gdk.Pixbuf as PyGdkPixbuf_Type
import gtk.FileChooserDialog as PyGtkFileChooserDialog_Type
import gtk.ListStore as PyGtkListStore_Type
import gtk.HBox as PyGtkHBox_Type
import gtk.VBox as PyGtkVBox_Type
import gtk.Table as PyGtkTable_Type
import gtk.IconView as PyGtkIconView_Type
import gio.File as PyGFile_Type
%%
ignore-glob
  *_get_type
%%
override eom_application_get_windows
static PyObject *
_wrap_eom_application_get_windows(PyGObject *self)
{
    const GList *list;
    PyObject *py_list;

    list = eom_application_get_windows (EOM_APPLICATION (self->obj));

    py_list = _helper_wrap_gobject_glist (list);

    return py_list;
}
%%
override eom_application_open_uri_list kwargs
static PyObject *
_wrap_eom_application_open_uri_list (PyGObject *self,
			             PyObject  *args,
			             PyObject  *kwargs)
{
	static char *kwlist[] = { "uri_list", NULL };
	PyObject *list, *item;
	GSList *glist = NULL;
	int len, i;

	if (!PyArg_ParseTupleAndKeywords (args, kwargs,
					  "O:EomApplication.open_uri_list", kwlist,
					  &list))
		return NULL;

	if (!PySequence_Check (list)) {
		PyErr_SetString (PyExc_TypeError,
				 "first argument must be a sequence");
		return NULL;
	}

	len = PySequence_Length (list);

	for (i = 0; i < len; i++)
	{
		item = PySequence_GetItem (list, i);
		Py_DECREF(item);

		if (!PyString_Check (item)) {
			PyErr_SetString (PyExc_TypeError,
					 "sequence item not a string");
			g_slist_free (glist);
			return NULL;
		}

		glist = g_slist_append (glist, g_strdup (PyString_AsString (item)));
	}

	eom_application_open_uri_list (EOM_APPLICATION (self->obj), glist, GDK_CURRENT_TIME, 0, NULL);

	g_slist_free (glist);
	Py_INCREF (Py_None);
	return Py_None;
}