Imported Upstream version 2.28.6
[platform/upstream/pygobject2.git] / gio / gfileinputstream.override
1 /* -*- Mode: C; c-basic-offset: 4 -*-
2  * pygobject - Python bindings for GObject
3  * Copyright (C) 2009  Gian Mario Tagliaretti
4  *
5  *   gfileinputstream.override: module overrides for GFileInputStream
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
20  * USA
21  */
22
23 %%
24 override g_file_input_stream_query_info_async kwargs
25 static PyObject *
26 _wrap_g_file_input_stream_query_info_async(PyGObject *self,
27                                            PyObject *args,
28                                            PyObject *kwargs)
29 {
30     static char *kwlist[] = { "attributes", "callback",
31                               "io_priority", "cancellable", "user_data", NULL };
32     GCancellable *cancellable;
33     PyGObject *pycancellable = NULL;
34     int io_priority = G_PRIORITY_DEFAULT;
35     char *attributes;
36     PyGIONotify *notify;
37
38     notify = pygio_notify_new();
39
40     if (!PyArg_ParseTupleAndKeywords(args, kwargs,
41                                 "sO|iOO:gio.FileInputStream.query_info_async",
42                                 kwlist,
43                                 &attributes,
44                                 &notify->callback,
45                                 &io_priority,
46                                 &pycancellable,
47                                 &notify->data))
48
49     if (!pygio_notify_callback_is_valid(notify))
50         goto error;
51
52     if (!pygio_check_cancellable(pycancellable, &cancellable))
53         goto error;
54
55     pygio_notify_reference_callback(notify);
56
57     g_file_input_stream_query_info_async(G_FILE_INPUT_STREAM(self->obj),
58                          attributes, io_priority, cancellable,
59                          (GAsyncReadyCallback)async_result_callback_marshal,
60                          notify);
61
62     Py_INCREF(Py_None);
63     return Py_None;
64
65  error:
66     pygio_notify_free(notify);
67     return NULL;
68 }