1 /* -*- Mode: C; c-basic-offset: 4 -*-
2 * pygobject - Python bindings for GObject
3 * Copyright (C) 2009 Gian Mario Tagliaretti
5 * gmount.override: module overrides for GMount
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.
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.
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
23 override g_mount_guess_content_type kwargs
25 _wrap_g_mount_guess_content_type(PyGObject *self,
29 static char *kwlist[] = { "callback", "force_rescan",
30 "cancellable", "user_data", NULL };
32 PyGObject *py_cancellable = NULL;
33 GCancellable *cancellable;
34 gboolean force_rescan;
36 notify = pygio_notify_new();
38 if (!PyArg_ParseTupleAndKeywords(args, kwargs,
39 "Oi|OO:Mount.guess_content_type",
47 if (!pygio_notify_callback_is_valid(notify))
50 if (!pygio_check_cancellable(py_cancellable, &cancellable))
53 pygio_notify_reference_callback(notify);
55 g_mount_guess_content_type(G_MOUNT(self->obj),
58 (GAsyncReadyCallback)async_result_callback_marshal,
65 pygio_notify_free(notify);
69 override g_mount_guess_content_type_finish kwargs
71 _wrap_g_mount_guess_content_type_finish(PyGObject *self,
75 static char *kwlist[] = { "result", NULL };
81 if (!PyArg_ParseTupleAndKeywords(args, kwargs,
82 "O!:Mount.guess_content_type_finish",
88 ret = g_mount_guess_content_type_finish(G_MOUNT(self->obj),
89 G_ASYNC_RESULT(result->obj), &error);
91 if (pyg_error_check(&error))
94 if (ret && ret[0] != NULL) {
95 py_ret = strv_to_pylist(ret);
104 override g_mount_guess_content_type_sync kwargs
106 _wrap_g_mount_guess_content_type_sync(PyGObject *self,
110 static char *kwlist[] = { "force_rescan", "cancellable", NULL };
111 gboolean force_rescan;
112 PyGObject *py_cancellable = NULL;
113 GCancellable *cancellable;
114 GError *error = NULL;
118 if (!PyArg_ParseTupleAndKeywords(args, kwargs,
119 "i|O:Mount.guess_content_type_sync",
125 if (!pygio_check_cancellable(py_cancellable, &cancellable))
128 ret = g_mount_guess_content_type_sync(G_MOUNT(self->obj), force_rescan,
129 cancellable, &error);
131 if (pyg_error_check(&error))
134 if (ret && ret[0] != NULL) {
135 py_ret = strv_to_pylist(ret);
144 override g_mount_remount kwargs
146 _wrap_g_mount_remount(PyGObject *self, PyObject *args, PyObject *kwargs)
148 static char *kwlist[] = { "callback", "flags", "mount_operation",
149 "cancellable", "user_data", NULL };
151 PyObject *py_flags = NULL;
152 GMountUnmountFlags flags = G_MOUNT_UNMOUNT_NONE;
153 PyObject *py_mount_operation = Py_None;
154 GMountOperation *mount_operation = NULL;
155 PyGObject *py_cancellable = NULL;
156 GCancellable *cancellable;
158 notify = pygio_notify_new();
160 if (!PyArg_ParseTupleAndKeywords(args, kwargs,
161 "O|OOOO:gio.Mount.remount",
170 if (!pygio_notify_callback_is_valid(notify))
173 if (py_mount_operation != Py_None) {
174 if (!pygobject_check(py_mount_operation, &PyGMountOperation_Type)) {
175 PyErr_SetString(PyExc_TypeError,
176 "mount_operation must be a gio.MountOperation or None");
180 mount_operation = G_MOUNT_OPERATION(pygobject_get(py_mount_operation));
183 if (py_flags && pyg_flags_get_value(G_TYPE_MOUNT_UNMOUNT_FLAGS,
184 py_flags, (gpointer) &flags))
187 if (!pygio_check_cancellable(py_cancellable, &cancellable))
190 pygio_notify_reference_callback(notify);
192 pyg_begin_allow_threads;
194 g_mount_remount(G_MOUNT(self->obj),
198 (GAsyncReadyCallback) async_result_callback_marshal,
201 pyg_end_allow_threads;
207 pygio_notify_free(notify);
211 override g_mount_unmount kwargs
213 _wrap_g_mount_unmount(PyGObject *self,
217 static char *kwlist[] = { "callback", "flags",
218 "cancellable", "user_data", NULL };
220 PyObject *py_flags = NULL;
221 PyGObject *py_cancellable = NULL;
222 GMountUnmountFlags flags = G_MOUNT_UNMOUNT_NONE;
223 GCancellable *cancellable;
225 notify = pygio_notify_new();
227 if (!PyArg_ParseTupleAndKeywords(args, kwargs,
228 "O|OOO:gio.Mount.unmount",
236 if (!pygio_notify_callback_is_valid(notify))
239 if (py_flags && pyg_flags_get_value(G_TYPE_MOUNT_UNMOUNT_FLAGS,
240 py_flags, (gpointer)&flags))
243 if (!pygio_check_cancellable(py_cancellable, &cancellable))
246 pygio_notify_reference_callback(notify);
248 pyg_begin_allow_threads;
250 g_mount_unmount(G_MOUNT(self->obj),
253 (GAsyncReadyCallback)async_result_callback_marshal,
256 pyg_end_allow_threads;
262 pygio_notify_free(notify);
266 override g_mount_eject kwargs
268 _wrap_g_mount_eject(PyGObject *self, PyObject *args, PyObject *kwargs)
270 static char *kwlist[] = { "callback", "flags", "cancellable", "user_data", NULL };
272 PyObject *py_flags = NULL;
273 GMountUnmountFlags flags = G_MOUNT_UNMOUNT_NONE;
274 PyGObject *py_cancellable = NULL;
275 GCancellable *cancellable;
277 notify = pygio_notify_new();
279 if (!PyArg_ParseTupleAndKeywords(args, kwargs,
280 "O|OOO:gio.Mount.eject",
288 if (!pygio_notify_callback_is_valid(notify))
291 if (py_flags && pyg_flags_get_value(G_TYPE_MOUNT_UNMOUNT_FLAGS,
292 py_flags, (gpointer) &flags))
295 if (!pygio_check_cancellable(py_cancellable, &cancellable))
298 pygio_notify_reference_callback(notify);
300 pyg_begin_allow_threads;
302 g_mount_eject(G_MOUNT(self->obj),
305 (GAsyncReadyCallback) async_result_callback_marshal,
308 pyg_end_allow_threads;
314 pygio_notify_free(notify);
318 override-slot GMount.tp_repr
320 _wrap_g_mount_tp_repr(PyGObject *self)
322 char *name = g_mount_get_name(G_MOUNT(self->obj));
323 char *uuid = g_mount_get_uuid(G_MOUNT(self->obj));
324 gchar *representation;
329 representation = g_strdup_printf("<%s at %p: %s (%s)>",
330 self->ob_type->tp_name, self, name, uuid);
333 representation = g_strdup_printf("<%s at %p: %s>",
334 self->ob_type->tp_name, self, name);
338 representation = g_strdup_printf("<%s at %p: UNKNOWN NAME>", self->ob_type->tp_name, self);
343 result = PyString_FromString(representation);
344 g_free(representation);
348 override g_mount_unmount_with_operation kwargs
350 _wrap_g_mount_unmount_with_operation(PyGObject *self,
354 static char *kwlist[] = { "callback", "flags", "mount_operation",
355 "cancellable", "user_data", NULL };
357 PyObject *py_flags = NULL;
358 PyGObject *mount_operation;
359 PyGObject *py_cancellable = NULL;
360 GMountUnmountFlags flags = G_MOUNT_UNMOUNT_NONE;
361 GCancellable *cancellable;
363 notify = pygio_notify_new();
365 if (!PyArg_ParseTupleAndKeywords(args, kwargs,
366 "O|OOOO:gio.Mount.unmount_with_operation",
375 if (!pygio_notify_callback_is_valid(notify))
378 if (py_flags && pyg_flags_get_value(G_TYPE_MOUNT_UNMOUNT_FLAGS,
379 py_flags, (gpointer)&flags))
382 if (!pygio_check_cancellable(py_cancellable, &cancellable))
385 pygio_notify_reference_callback(notify);
387 g_mount_unmount_with_operation(G_MOUNT(self->obj),
389 G_MOUNT_OPERATION(mount_operation->obj),
391 (GAsyncReadyCallback)async_result_callback_marshal,
398 pygio_notify_free(notify);
402 override g_mount_eject_with_operation kwargs
404 _wrap_g_mount_eject_with_operation(PyGObject *self,
408 static char *kwlist[] = { "callback", "flags", "mount_operation",
409 "cancellable", "user_data", NULL };
411 PyObject *py_flags = NULL;
412 PyGObject *mount_operation;
413 PyGObject *py_cancellable = NULL;
414 GMountUnmountFlags flags = G_MOUNT_UNMOUNT_NONE;
415 GCancellable *cancellable;
417 notify = pygio_notify_new();
419 if (!PyArg_ParseTupleAndKeywords(args, kwargs,
420 "O|OOOO:gio.Mount.eject_with_operation",
429 if (!pygio_notify_callback_is_valid(notify))
432 if (py_flags && pyg_flags_get_value(G_TYPE_MOUNT_UNMOUNT_FLAGS,
433 py_flags, (gpointer)&flags))
436 if (!pygio_check_cancellable(py_cancellable, &cancellable))
439 pygio_notify_reference_callback(notify);
441 g_mount_eject_with_operation(G_MOUNT(self->obj),
443 G_MOUNT_OPERATION(mount_operation->obj),
445 (GAsyncReadyCallback)async_result_callback_marshal,
452 pygio_notify_free(notify);