File: desktopagnostic.override

package info (click to toggle)
libdesktop-agnostic 0.3.90-2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 3,004 kB
  • ctags: 4,635
  • sloc: ansic: 30,148; python: 1,069; makefile: 24; xml: 12
file content (167 lines) | stat: -rw-r--r-- 4,928 bytes parent folder | download
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
%%
headers
/*
 * Copyright (c) 2009 Mark Lee <libdesktop-agnostic@lazymalevolence.com>
 *
 * 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.
*/

#ifdef HAVE_BUILD_CONFIG_H
#include "build-config.h"
#endif
#include <pygobject.h>
#include <libdesktop-agnostic/desktop-agnostic.h>
%%
modulename desktopagnostic
%%
import gobject.GObject as PyGObject_Type
%%
ignore-glob
  *_get_type
  desktop_agnostic_color_cairo_value_to_gdk
  desktop_agnostic_color_gdk_value_to_cairo
  desktop_agnostic_color_new_from_values
  desktop_agnostic_color_new_from_string
  desktop_agnostic_module_loader_get_default
%%
define DesktopAgnosticColor.gdk_value_to_cairo onearg staticmethod
static PyObject *
_wrap_desktop_agnostic_color_gdk_value_to_cairo (PyObject *self, PyObject *arg)
{
  int value;
  double ret;

  if (!PyInt_Check (arg))
  {
    PyErr_SetString (PyExc_TypeError,
                     "The parameter must be a unsigned short value.");
    return NULL;
  }

  value = (int)PyInt_AsLong (arg);

  if (value < 0 || value > G_MAXUSHORT)
  {
    PyErr_SetString (PyExc_TypeError,
                     "The parameter must be a unsigned short value.");
    return NULL;
  }

  ret = desktop_agnostic_color_gdk_value_to_cairo (value);

  return PyFloat_FromDouble (ret);
}
%%
define DesktopAgnosticColor.cairo_value_to_gdk onearg staticmethod
static PyObject *
_wrap_desktop_agnostic_color_cairo_value_to_gdk (PyObject *self, PyObject *arg)
{
  int ret;
  double value;

  if (!PyFloat_Check (arg))
  {
    PyErr_SetString (PyExc_TypeError,
                     "The parameter must be a float value between 0.0 and 1.0.");
    return NULL;
  }

  value = PyFloat_AsDouble (arg);

  if (value < 0.0 || value > 1.0)
  {
    PyErr_SetString (PyExc_TypeError,
                     "The parameter must be a float value between 0.0 and 1.0.");
    return NULL;
  }

  ret = desktop_agnostic_color_cairo_value_to_gdk ((float)value);

  return PyInt_FromLong (ret);
}
%%
define DesktopAgnosticColor.from_values kwargs staticmethod
static PyObject *
_wrap_desktop_agnostic_color_from_values (PyObject *self, PyObject *args,
                                          PyObject *kwargs)
{
    static char *kwlist[] = { "red", "green", "blue", "alpha", NULL };
    int red, green, blue, alpha;
    DesktopAgnosticColor *ret;

    if (!PyArg_ParseTupleAndKeywords (args, kwargs,
                                      "iiii:color_new_from_values", kwlist,
                                      &red, &green, &blue, &alpha))
        return NULL;

    ret = desktop_agnostic_color_new_from_values (red, green, blue, alpha);

    /* pygobject_new handles NULL checking */
    return pygobject_new ((GObject *)ret);
}
%%
define DesktopAgnosticColor.from_string kwargs staticmethod
static PyObject *
_wrap_desktop_agnostic_color_from_string (PyObject *self, PyObject *args,
                                          PyObject *kwargs)
{
  static char *kwlist[] = { "spec", NULL };
  char *spec;
  GError *error = NULL;
  DesktopAgnosticColor *ret;

  if (!PyArg_ParseTupleAndKeywords (args, kwargs, "s:color_new_from_string",
                                    kwlist, &spec))
  {
    return NULL;
  }

  ret = desktop_agnostic_color_new_from_string (spec, &error);

  if (pyg_error_check (&error))
  {
    return NULL;
  }

  /* pygobject_new handles NULL checking */
  return pygobject_new ((GObject *)ret);
}
%%
override-slot DesktopAgnosticColor.tp_str
#define _wrap_desktop_agnostic_color_tp_str _wrap_desktop_agnostic_color_to_string
%%
define DesktopAgnosticModuleLoader.get_default noargs staticmethod
static PyObject *
_wrap_desktop_agnostic_module_loader_get_default (PyObject *self)
{
  DesktopAgnosticModuleLoader *ret;

  ret = desktop_agnostic_module_loader_get_default ();

  /* pygobject_new handles NULL checking */
  return pygobject_new ((GObject *)ret);
}
%%
override desktop_agnostic_color_get_cairo_color noargs
static PyObject *
_wrap_desktop_agnostic_color_get_cairo_color (PyGObject *self)
{
    gdouble red, green, blue, alpha;
    desktop_agnostic_color_get_cairo_color (DESKTOP_AGNOSTIC_COLOR (self->obj),
                                            &red, &green, &blue, &alpha);

    return Py_BuildValue("(ffff)", red, green, blue, alpha);
}