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
|
/* -*- Mode: C; c-basic-offset: 4 -*- */
%%
headers
#include <Python.h>
#include "pygobject.h"
#include <atk/atk.h>
#include <atk/atknoopobjectfactory.h>
#include <atk/atknoopobject.h>
%%
modulename atk
%%
import gobject.GObject as PyGObject_Type
%%
ignore-glob
*_get_type
%%
override atk_relation_new kwargs
static int
_wrap_atk_relation_new (PyGObject *self, PyObject *args, PyObject *kwargs)
{
static char *kwlist[] = { "targets", "relationship", NULL };
AtkObject **targets;
int relationship, count, i;
PyObject *py_targets;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"Oi#:relation_new", kwlist,
&py_targets, &relationship))
return -1;
if (!PySequence_Check(py_targets)) {
PyErr_SetString(PyExc_TypeError, "targets argument must be a sequence");
return -1;
}
count = PySequence_Length(py_targets);
targets = g_new(AtkObject *, count);
for (i = 0; i < count; i++) {
PyObject *item = PySequence_GetItem(py_targets, i);
Py_DECREF(item); /* PySequence_GetItem INCREF's */
if (!pygobject_check(item, &PyAtkObject_Type)) {
PyErr_SetString(PyExc_TypeError, "targets argument must be a sequence of AtkObjects.");
g_free(targets);
return -1;
}
targets[i] = (AtkObject *) pygobject_get(item);
}
self->obj = (GObject *) atk_relation_new(targets, count, relationship);
g_free(targets);
pygobject_register_wrapper((PyObject *) self);
return 0;
}
|