/usr/share/pygobject/2.0/defs/gappinfo.override is in python-gobject-2-dev 2.28.6-13.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | /* -*- Mode: C; c-basic-offset: 4 -*-
* pygobject - Python bindings for GObject
* Copyright (C) 2008 Johan Dahlin
* Copyright (C) 2008 Gian Mario Tagliaretti
*
* gappinfo.override: module overrides for GInputStream
*
* 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
*/
%%
define _install_app_info_meta
static PyObject *
_wrap__install_app_info_meta(PyObject *self, PyObject *args)
{
PyObject *metaclass;
if (!PyArg_ParseTuple(args, "O", &metaclass))
return NULL;
Py_INCREF(metaclass);
PyGAppInfo_Type.ob_type = (PyTypeObject*)metaclass;
Py_INCREF(Py_None);
return Py_None;
}
%%
define _app_info_init kwargs
static PyObject *
_wrap__app_info_init(PyGObject *self, PyObject *args, PyObject *kwargs)
{
static char *kwlist[] = { "commandline", "application_name",
"flags", NULL };
char *commandline, *application_name = NULL;
PyObject *py_flags = NULL;
GAppInfo *ret;
GError *error = NULL;
GAppInfoCreateFlags flags = G_APP_INFO_CREATE_NONE;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"s|zO:gio.AppInfo",
kwlist,
&commandline, &application_name,
&py_flags))
return NULL;
if (py_flags && pyg_flags_get_value(G_TYPE_APP_INFO_CREATE_FLAGS,
py_flags, (gpointer)&flags))
return NULL;
ret = g_app_info_create_from_commandline(commandline,
application_name, flags, &error);
if (pyg_error_check(&error))
return NULL;
/* pygobject_new handles NULL checking */
return pygobject_new((GObject *)ret);
}
%%
override g_app_info_launch_uris kwargs
static PyObject *
_wrap_g_app_info_launch_uris(PyGObject *self, PyObject *args, PyObject *kwargs)
{
static char *kwlist[] = { "files", "launch_context", NULL };
GList *file_list = NULL;
PyGObject *pycontext = NULL;
GAppLaunchContext *ctx;
PyObject *pyfile_list = Py_None;
int ret;
GError *error = NULL;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"|OO:gio.AppInfo.launch_uris",
kwlist,
&pyfile_list, &pycontext))
return NULL;
if (!pygio_check_launch_context(pycontext, &ctx))
return NULL;
if (pyfile_list == Py_None)
file_list = NULL;
else if (PySequence_Check (pyfile_list))
file_list = pygio_pylist_to_uri_glist(pyfile_list);
else {
PyErr_SetString(PyExc_TypeError,
"file_list should be a list of strings or None");
return NULL;
}
ret = g_app_info_launch_uris(G_APP_INFO(self->obj),
file_list, ctx, &error);
/* in python 3 the C strings are not internal to the Unicode string object
* so we now strdup when adding element to the list and must free them here
*/
g_list_foreach (file_list,
(GFunc) g_free, NULL);
g_list_free(file_list);
if (pyg_error_check(&error))
return NULL;
return PyBool_FromLong(ret);
}
%%
override g_app_info_launch kwargs
static PyObject *
_wrap_g_app_info_launch(PyGObject *self, PyObject *args, PyObject *kwargs)
{
static char *kwlist[] = { "files", "launch_context", NULL };
GList *file_list = NULL;
PyGObject *pycontext = NULL;
GAppLaunchContext *ctx;
PyObject *pyfile_list = Py_None;
int ret;
GError *error = NULL;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"|OO:gio.AppInfo.launch",
kwlist,
&pyfile_list, &pycontext))
return NULL;
if (!pygio_check_launch_context(pycontext, &ctx))
return NULL;
if (pyfile_list == Py_None)
file_list = NULL;
else if (PySequence_Check (pyfile_list))
file_list = pygio_pylist_to_gfile_glist(pyfile_list);
else {
PyErr_SetString(PyExc_TypeError,
"file_list should be a list of strings or None");
return NULL;
}
ret = g_app_info_launch(G_APP_INFO(self->obj),
file_list, ctx, &error);
g_list_free(file_list);
if (pyg_error_check(&error))
return NULL;
return PyBool_FromLong(ret);
}
%%
override-slot GAppInfo.tp_richcompare
static PyObject *
_wrap_g_app_info_tp_richcompare(PyGObject *self, PyGObject *other, int op)
{
PyObject *result;
if (PyObject_TypeCheck(self, &PyGAppInfo_Type)
&& PyObject_TypeCheck(other, &PyGAppInfo_Type)) {
GAppInfo *info1 = G_APP_INFO(self->obj);
GAppInfo *info2 = G_APP_INFO(other->obj);
switch (op) {
case Py_EQ:
result = (g_app_info_equal(info1, info2)
? Py_True : Py_False);
break;
case Py_NE:
result = (!g_app_info_equal(info1, info2)
? Py_True : Py_False);
break;
default:
result = Py_NotImplemented;
}
}
else
result = Py_NotImplemented;
Py_INCREF(result);
return result;
}
%%
override-slot GAppInfo.tp_repr
static PyObject *
_wrap_g_app_info_tp_repr(PyGObject *self)
{
const char *name = g_app_info_get_name(G_APP_INFO(self->obj));
gchar *representation;
PyObject *result;
representation = g_strdup_printf("<%s at %p: %s>",
self->ob_type->tp_name, self,
name ? name : "UNKNOWN NAME");
result = PyString_FromString(representation);
g_free(representation);
return result;
}
|