summaryrefslogtreecommitdiff
path: root/gio/gapplaunchcontext.override
blob: a10f9597d6500c8191e77b9c1622891b7e830808 (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
/* -*- Mode: C; c-basic-offset: 4 -*-
 * pygobject - Python bindings for GObject
 * Copyright (C) 2008 Gian Mario Tagliaretti
 *
 *   gapplaunchcontext.override: module overrides for GAppLaunchContext
 *
 * 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
 */

%%
override g_app_launch_context_get_display kwargs
static PyObject *
_wrap_g_app_launch_context_get_display(PyGObject *self,
                                       PyObject *args,
                                       PyObject *kwargs)
{
    static char *kwlist[] = { "info", "files", NULL };

    GList *file_list = NULL;
    PyGObject *py_info;
    PyObject *pyfile_list;
    gchar *ret;

    if (!PyArg_ParseTupleAndKeywords(args, kwargs,
			    "O!O:gio.AppLaunchContext.get_display",
			    kwlist,
			    &PyGAppInfo_Type, &py_info, &pyfile_list))
        return NULL;

    if (!PySequence_Check (pyfile_list)) {
        PyErr_Format (PyExc_TypeError,
                      "argument must be a list or tuple of GFile objects");
        return NULL;
    }

    file_list = pygio_pylist_to_gfile_glist(pyfile_list);

    ret = g_app_launch_context_get_display(G_APP_LAUNCH_CONTEXT(self->obj),
                                           G_APP_INFO(py_info->obj), file_list);
    g_list_free(file_list);

    if (ret)
        return PyString_FromString(ret);

    Py_INCREF(Py_None);
    return Py_None;
}
%%
override g_app_launch_context_get_startup_notify_id kwargs
static PyObject *
_wrap_g_app_launch_context_get_startup_notify_id(PyGObject *self,
                                                 PyObject *args,
                                                 PyObject *kwargs)
{
    static char *kwlist[] = { "info", "files", NULL };

    GList       *file_list = NULL;
    PyGObject   *py_info;
    PyObject    *pyfile_list;
    gchar       *ret;

    if (!PyArg_ParseTupleAndKeywords(args, kwargs,
			    "O!O:gio.AppLaunchContext.get_startup_notify_id",
			    kwlist,
			    &PyGAppInfo_Type, &py_info, &pyfile_list))
        return NULL;

    if (!PySequence_Check (pyfile_list)) {
        PyErr_Format (PyExc_TypeError,
                      "argument must be a list or tuple of GFile objects");
        return NULL;
    }

    file_list = pygio_pylist_to_gfile_glist(pyfile_list);

    ret = g_app_launch_context_get_startup_notify_id(
                                        G_APP_LAUNCH_CONTEXT(self->obj),
                                        G_APP_INFO(py_info->obj), file_list);
    g_list_free(file_list);

    if (ret)
        return PyString_FromString(ret);

    Py_INCREF(Py_None);
    return Py_None;
}