File: pgmviewportfactory.override

package info (click to toggle)
pigment-python 0.3.12-2
  • links: PTS
  • area: main
  • in suites: squeeze, wheezy
  • size: 2,820 kB
  • ctags: 2,955
  • sloc: python: 11,664; sh: 10,131; makefile: 251; ansic: 97
file content (185 lines) | stat: -rw-r--r-- 4,637 bytes parent folder | download | duplicates (3)
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
/* -*- Mode: C; c-basic-offset: 2; indent-tabs-mode: nil -*-
 *
 * Pigment Python binding
 *
 * Copyright © 2006, 2007, 2008 Fluendo Embedded S.L.
 *
 * 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 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., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 *
 * Author(s): Loïc Molinari <loic@fluendo.com>
 *            Philippe Normand <philippe@fluendo.com>
 */

%%
new-constructor PGM_TYPE_VIEWPORT_FACTORY

%%
override pgm_viewport_factory_new kwargs
static int
_wrap_pgm_viewport_factory_new (PyGObject *self,
                                PyObject *args,
                                PyObject *kwargs)
{
  static char *kwlist[] = { "name", NULL };
  gchar *name = NULL;

  if (!PyArg_ParseTupleAndKeywords(args, kwargs,
                                   "|s:PgmViewportFactory.__init__",
                                   kwlist, &name))
    return -1;

  if (name)
    {
      pyg_begin_allow_threads;
      self->obj = (GObject *) pgm_viewport_factory_new (name);
      pyg_end_allow_threads;
    }
  else
    pygobject_construct (self, NULL);

  if (!self->obj)
    {
      PyErr_SetString (PyExc_RuntimeError,
                      "could not create PgmViewportFactory object");
      return -1;
    }

  pygobject_register_wrapper ((PyObject *) self);

  return 0;
}

/* Methods override */

%%
override pgm_viewport_factory_get_description noargs
static PyObject *
_wrap_pgm_viewport_factory_get_description (PyGObject *self)
{
  gchar *description = NULL;
  PyObject *py_string = NULL;

  pyg_begin_allow_threads;
  pgm_viewport_factory_get_description (PGM_VIEWPORT_FACTORY (self->obj),
                                        &description);
  pyg_end_allow_threads;

  py_string = PyString_FromStringAndSize (description, strlen (description));
  g_free (description);

  if (!py_string)
    {
      Py_INCREF (Py_None);
      return (Py_None);
    }

  return py_string;
}

%%
override pgm_viewport_factory_get_license noargs
static PyObject *
_wrap_pgm_viewport_factory_get_license (PyGObject *self)
{
  gchar *license = NULL;
  PyObject *py_string = NULL;

  pyg_begin_allow_threads;
  pgm_viewport_factory_get_license (PGM_VIEWPORT_FACTORY (self->obj),
                                    &license);
  pyg_end_allow_threads;

  py_string = PyString_FromStringAndSize (license, strlen (license));
  g_free (license);

  if (!py_string)
    {
      Py_INCREF (Py_None);
      return (Py_None);
    }

  return py_string;
}

%%
override pgm_viewport_factory_get_origin noargs
static PyObject *
_wrap_pgm_viewport_factory_get_origin (PyGObject *self)
{
  gchar *origin = NULL;
  PyObject *py_string = NULL;

  pyg_begin_allow_threads;
  pgm_viewport_factory_get_origin (PGM_VIEWPORT_FACTORY (self->obj),
                                   &origin);
  pyg_end_allow_threads;

  py_string = PyString_FromStringAndSize (origin, strlen (origin));
  g_free (origin);

  if (!py_string)
    {
      Py_INCREF (Py_None);
      return (Py_None);
    }

  return py_string;
}

%%
override pgm_viewport_factory_get_author noargs
static PyObject *
_wrap_pgm_viewport_factory_get_author (PyGObject *self)
{
  gchar *author = NULL;
  PyObject *py_string = NULL;

  pyg_begin_allow_threads;
  pgm_viewport_factory_get_author (PGM_VIEWPORT_FACTORY (self->obj),
                                   &author);
  pyg_end_allow_threads;

  py_string = PyString_FromStringAndSize (author, strlen (author));
  g_free (author);

  if (!py_string)
    {
      Py_INCREF (Py_None);
      return (Py_None);
    }

  return py_string;
}

%%
override pgm_viewport_factory_create noargs
static PyObject *
_wrap_pgm_viewport_factory_create (PyGObject *self)
{
  PgmViewport *viewport;
  PyObject *py_ret = NULL;
  PgmError ret;

  pyg_begin_allow_threads;
  ret = pgm_viewport_factory_create (PGM_VIEWPORT_FACTORY (self->obj),
                                     &viewport);
  pyg_end_allow_threads;

  py_ret = pygobject_new ((GObject *) viewport);
  g_object_unref ((GObject *) viewport);

  return py_ret;
}