pygobject r948 - in trunk: . gio



Author: paulp
Date: Tue Aug 12 21:11:07 2008
New Revision: 948
URL: http://svn.gnome.org/viewvc/pygobject?rev=948&view=rev

Log:
2008-08-13  Paul Pogonyshev  <pogonyshev gmx net>

	Bug 547495 â wrap four important asynchronous methods in gio.Drive
	and gio.Mount

	* gio/gio.defs (gio.Drive.eject, gio.Drive.poll_for_media)
	(gio.Mount.remount): Document.

	* gio/gio.override (_wrap_g_drive_eject)
	(_wrap_g_drive_poll_for_media, _wrap_g_mount_eject)
	(_wrap_g_mount_remount): New functions.


Modified:
   trunk/ChangeLog
   trunk/gio/gio.defs
   trunk/gio/gio.override

Modified: trunk/gio/gio.defs
==============================================================================
--- trunk/gio/gio.defs	(original)
+++ trunk/gio/gio.defs	Tue Aug 12 21:11:07 2008
@@ -932,6 +932,11 @@
 
 (define-method eject
   (of-object "GDrive")
+  (docstring
+   "D.eject(callback, [flags, [cancellable, [user_data]]]) -> start ejecting\n"
+   "Asynchronously ejects a drive. When the operation is finished, callback\n"
+   "will be called. You can then call gio.Drive.eject_finish to obtain the\n"
+   "result of the operation.")
   (c-name "g_drive_eject")
   (return-type "none")
   (parameters
@@ -954,6 +959,12 @@
 
 (define-method poll_for_media
   (of-object "GDrive")
+  (docstring
+   "D.poll_for_media(callback, [cancellable, [user_data]]) -> start polling\n"
+   "Asynchronously polls drive to see if media has been inserted or removed.\n"
+   "When the operation is finished, callback will be called. You can then\n"
+   "call gio.Drive.poll_for_media_finish to obtain the result of the\n"
+   "operation.")
   (c-name "g_drive_poll_for_media")
   (return-type "none")
   (parameters
@@ -3808,6 +3819,11 @@
 
 (define-method remount
   (of-object "GMount")
+  (docstring
+   "M.remount(callback, [flags, [mount_operation, [cancellable, [user_data]]]])\n"
+   "Remounts a mount. This is an asynchronous operation, and is finished by\n"
+   "calling gio.Mount.remount_finish with the mount and gio.AsyncResults data\n"
+   "returned in the callback.")
   (c-name "g_mount_remount")
   (return-type "none")
   (parameters

Modified: trunk/gio/gio.override
==============================================================================
--- trunk/gio/gio.override	(original)
+++ trunk/gio/gio.override	Tue Aug 12 21:11:07 2008
@@ -140,6 +140,104 @@
   return ret;
 }
 %%
+override g_drive_eject kwargs
+static PyObject *
+_wrap_g_drive_eject(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+    static char *kwlist[] = { "callback", "flags", "cancellable", "user_data", NULL };
+    PyGIONotify *notify;
+    PyObject *py_flags = NULL;
+    GMountUnmountFlags flags = G_MOUNT_UNMOUNT_NONE;
+    PyGObject *py_cancellable = NULL;
+    GCancellable *cancellable;
+
+    notify = g_slice_new0(PyGIONotify);
+
+    if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+                                     "O|OOO:gio.Drive.eject",
+				     kwlist,
+				     &notify->callback,
+				     &py_flags,
+				     &py_cancellable,
+				     &notify->data)) {
+	g_slice_free(PyGIONotify, notify);
+	return NULL;
+    }
+
+    if (!PyCallable_Check(notify->callback)) {
+	PyErr_SetString(PyExc_TypeError, "callback argument not callable");
+	g_slice_free(PyGIONotify, notify);
+	return NULL;
+    }
+
+    if (py_flags && pyg_flags_get_value(G_TYPE_MOUNT_UNMOUNT_FLAGS,
+					py_flags, (gpointer) &flags)) {
+	g_slice_free(PyGIONotify, notify);
+        return NULL;
+    }
+
+    if (!pygio_check_cancellable(py_cancellable, &cancellable)) {
+	g_slice_free(PyGIONotify, notify);
+        return NULL;
+    }
+
+    Py_INCREF(notify->callback);
+    Py_XINCREF(notify->data);
+
+    g_drive_eject(G_DRIVE(self->obj),
+		  flags,
+		  cancellable,
+		  (GAsyncReadyCallback) async_result_callback_marshal,
+		  notify);
+
+    Py_INCREF(Py_None);
+    return Py_None;
+}
+%%
+override g_drive_poll_for_media kwargs
+static PyObject *
+_wrap_g_drive_poll_for_media(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+    static char *kwlist[] = { "callback", "cancellable", "user_data", NULL };
+    PyGIONotify *notify;
+    PyGObject *py_cancellable = NULL;
+    GCancellable *cancellable;
+
+    notify = g_slice_new0(PyGIONotify);
+
+    if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+                                     "O|OO:gio.Drive.eject",
+				     kwlist,
+				     &notify->callback,
+				     &py_cancellable,
+				     &notify->data)) {
+	g_slice_free(PyGIONotify, notify);
+	return NULL;
+    }
+
+    if (!PyCallable_Check(notify->callback)) {
+	PyErr_SetString(PyExc_TypeError, "callback argument not callable");
+	g_slice_free(PyGIONotify, notify);
+	return NULL;
+    }
+
+    if (!pygio_check_cancellable(py_cancellable, &cancellable)) {
+	g_slice_free(PyGIONotify, notify);
+        return NULL;
+    }
+
+    Py_INCREF(notify->callback);
+    Py_XINCREF(notify->data);
+
+    g_drive_poll_for_media(G_DRIVE(self->obj),
+			   cancellable,
+			   (GAsyncReadyCallback) async_result_callback_marshal,
+			   notify);
+
+    Py_INCREF(Py_None);
+    return Py_None;
+}
+%%
 override g_app_info_get_all noargs
 static PyObject *
 _wrap_g_app_info_get_all (PyGObject *self)
@@ -271,6 +369,130 @@
     return Py_None;
 }
 %%
+override g_mount_eject kwargs
+static PyObject *
+_wrap_g_mount_eject(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+    static char *kwlist[] = { "callback", "flags", "cancellable", "user_data", NULL };
+    PyGIONotify *notify;
+    PyObject *py_flags = NULL;
+    GMountUnmountFlags flags = G_MOUNT_UNMOUNT_NONE;
+    PyGObject *py_cancellable = NULL;
+    GCancellable *cancellable;
+
+    notify = g_slice_new0(PyGIONotify);
+
+    if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+                                     "O|OOO:gio.Mount.eject",
+				     kwlist,
+				     &notify->callback,
+				     &py_flags,
+				     &py_cancellable,
+				     &notify->data)) {
+	g_slice_free(PyGIONotify, notify);
+	return NULL;
+    }
+
+    if (!PyCallable_Check(notify->callback)) {
+	PyErr_SetString(PyExc_TypeError, "callback argument not callable");
+	g_slice_free(PyGIONotify, notify);
+	return NULL;
+    }
+
+    if (py_flags && pyg_flags_get_value(G_TYPE_MOUNT_UNMOUNT_FLAGS,
+					py_flags, (gpointer) &flags)) {
+	g_slice_free(PyGIONotify, notify);
+        return NULL;
+    }
+
+    if (!pygio_check_cancellable(py_cancellable, &cancellable)) {
+	g_slice_free(PyGIONotify, notify);
+        return NULL;
+    }
+
+    Py_INCREF(notify->callback);
+    Py_XINCREF(notify->data);
+
+    g_mount_eject(G_MOUNT(self->obj),
+		  flags,
+		  cancellable,
+		  (GAsyncReadyCallback) async_result_callback_marshal,
+		  notify);
+
+    Py_INCREF(Py_None);
+    return Py_None;
+}
+%%
+override g_mount_remount kwargs
+static PyObject *
+_wrap_g_mount_remount(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+    static char *kwlist[] = { "callback", "flags", "mount_operation",
+			      "cancellable", "user_data", NULL };
+    PyGIONotify *notify;
+    PyObject *py_flags = NULL;
+    GMountUnmountFlags flags = G_MOUNT_UNMOUNT_NONE;
+    PyObject *py_mount_operation = Py_None;
+    GMountOperation *mount_operation = NULL;
+    PyGObject *py_cancellable = NULL;
+    GCancellable *cancellable;
+
+    notify = g_slice_new0(PyGIONotify);
+
+    if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+                                     "O|OOOO:gio.Mount.remount",
+				     kwlist,
+				     &notify->callback,
+				     &py_flags,
+				     &py_mount_operation,
+				     &py_cancellable,
+				     &notify->data)) {
+	g_slice_free(PyGIONotify, notify);
+	return NULL;
+    }
+
+    if (!PyCallable_Check(notify->callback)) {
+	PyErr_SetString(PyExc_TypeError, "callback argument not callable");
+	g_slice_free(PyGIONotify, notify);
+	return NULL;
+    }
+
+    if (py_mount_operation != Py_None) {
+	if (!pygobject_check(py_mount_operation, &PyGMountOperation_Type)) {
+	    PyErr_SetString(PyExc_TypeError,
+			    "mount_operation must be a gio.MountOperation or None");
+	    g_slice_free(PyGIONotify, notify);
+	    return NULL;
+	}
+
+	mount_operation = G_MOUNT_OPERATION(pygobject_get(py_mount_operation));
+    }
+
+    if (py_flags && pyg_flags_get_value(G_TYPE_MOUNT_UNMOUNT_FLAGS,
+					py_flags, (gpointer) &flags)) {
+	g_slice_free(PyGIONotify, notify);
+        return NULL;
+    }
+
+    if (!pygio_check_cancellable(py_cancellable, &cancellable)) {
+	g_slice_free(PyGIONotify, notify);
+        return NULL;
+    }
+
+    Py_INCREF(notify->callback);
+    Py_XINCREF(notify->data);
+
+    g_mount_remount(G_MOUNT(self->obj),
+		    flags,
+		    mount_operation,
+		    cancellable,
+		    (GAsyncReadyCallback) async_result_callback_marshal,
+		    notify);
+
+    Py_INCREF(Py_None);
+    return Py_None;
+}
+%%
 override g_vfs_get_supported_uri_schemes noargs
 static PyObject *
 _wrap_g_vfs_get_supported_uri_schemes(PyGObject *self)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]