pygobject r1040 - in trunk: . gio



Author: gianmt
Date: Sun Mar 29 15:47:09 2009
New Revision: 1040
URL: http://svn.gnome.org/viewvc/pygobject?rev=1040&view=rev

Log:
2009-03-29  Gian Mario Tagliaretti  <gianmt gnome org>

	* gio/gvolume.override: (_wrap_g_volume_mount) should accept None
	for mount_operation.



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

Modified: trunk/gio/gvolume.override
==============================================================================
--- trunk/gio/gvolume.override	(original)
+++ trunk/gio/gvolume.override	Sun Mar 29 15:47:09 2009
@@ -30,7 +30,8 @@
 			      "cancellable", "user_data", NULL };
     PyGIONotify *notify;
     PyObject *py_flags = NULL;
-    PyGObject *mount_operation;
+    PyGObject *py_mount_operation = NULL;
+    GMountOperation *mount_operation = NULL;
     PyGObject *py_cancellable = NULL;
     GMountMountFlags flags = G_MOUNT_MOUNT_NONE;
     GCancellable *cancellable;
@@ -38,16 +39,28 @@
     notify = pygio_notify_new();
 
     if (!PyArg_ParseTupleAndKeywords(args, kwargs,
-                                     "O!O|OOO:Volume.mount",
+                                     "OO|OOO:Volume.mount",
 				     kwlist,
-				     &PyGMountOperation_Type,
-				     &mount_operation,
+				     &py_mount_operation,
 				     &notify->callback,
 				     &py_flags,
 				     &py_cancellable,
 				     &notify->data))
         goto error;
-
+    
+    if ((PyObject *)py_mount_operation == Py_None)
+        mount_operation = NULL;
+    
+    else if (py_mount_operation && pygobject_check(py_mount_operation,
+						   &PyGMountOperation_Type))
+        mount_operation = G_MOUNT_OPERATION(py_mount_operation->obj);
+    
+    else if (py_mount_operation) {
+        PyErr_SetString(PyExc_TypeError,
+			"mount_operation should be a GMountOperation or None");
+        return NULL;
+    }
+    
     if (!pygio_notify_callback_is_valid(notify))
         goto error;
 
@@ -62,7 +75,7 @@
 
     g_volume_mount(G_VOLUME(self->obj),
 		   flags,
-		   G_MOUNT_OPERATION(mount_operation->obj),
+		   mount_operation,
 		   cancellable,
 		   (GAsyncReadyCallback)async_result_callback_marshal,
 		   notify);



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