[pygobject] Cleanup GIO overrides to use Python function/method names



commit 7766daa59b0e2b85413cee368bf2ebd2afe198e1
Author: Paul Pogonyshev <pogonyshev gmx net>
Date:   Sun May 31 18:25:47 2009 +0300

    Cleanup GIO overrides to use Python function/method names
    
    Also move several gio.Mount overrides over from 'gio.override' to
    existing 'gmount.override'.  Part of bug #584289.

 gio/gfile.override           |   20 ++--
 gio/gfileenumerator.override |    6 +-
 gio/ginputstream.override    |    2 +-
 gio/gio.override             |  204 ------------------------------------------
 gio/gmount.override          |  204 ++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 218 insertions(+), 218 deletions(-)
---
diff --git a/gio/gfile.override b/gio/gfile.override
index e7844e3..6469d22 100644
--- a/gio/gfile.override
+++ b/gio/gfile.override
@@ -81,20 +81,20 @@ _wrap__file_init(PyGObject *self, PyObject *args, PyObject *kwargs)
     n_kwargs = kwargs != NULL ? PyDict_Size(kwargs) : 0;
 
     if (n_args == 1 && n_kwargs == 0) {
-	if (!PyArg_ParseTuple(args, "s:GFile", &arg))
+	if (!PyArg_ParseTuple(args, "s:gio.File.__init__", &arg))
 	    return NULL;
 	file = g_file_new_for_commandline_arg(arg);
     } else if (n_args == 0 && n_kwargs == 1) {
 	if (PyDict_GetItemString(kwargs, "path")) {
 	    char *kwlist[] = { "path", NULL };
 	    if (!PyArg_ParseTupleAndKeywords(args, kwargs,
-					     "s:gio.File", kwlist, &arg))
+					     "s:gio.File.__init__", kwlist, &arg))
 		return NULL;
 	    file = g_file_new_for_path(arg);
 	} else if (PyDict_GetItemString(kwargs, "uri")) {
 	    char *kwlist[] = { "uri", NULL };
 	    if (!PyArg_ParseTupleAndKeywords(args, kwargs,
-					     "s:gio.File", kwlist, &arg))
+					     "s:gio.File.__init__", kwlist, &arg))
 		return NULL;
 	    file = g_file_new_for_uri(arg);
 	} else {
@@ -313,7 +313,7 @@ _wrap_g_file_enumerate_children_async(PyGObject *self, PyObject *args, PyObject
     notify = pygio_notify_new();
 
     if (!PyArg_ParseTupleAndKeywords(args, kwargs,
-				     "sO|OiOO:GFile.enumerate_children_async",
+				     "sO|OiOO:gio.File.enumerate_children_async",
 				     kwlist,
 				     &attributes,
 				     &notify->callback,
@@ -742,7 +742,7 @@ _wrap_g_file_set_attribute(PyGObject *self, PyObject *args, PyObject *kwargs)
     PyGObject *pycancellable = NULL;
     GFileAttributeType type;
 
-    if (!PyArg_ParseTupleAndKeywords(args, kwargs,"sOO|OO:GFile.set_attribute",
+    if (!PyArg_ParseTupleAndKeywords(args, kwargs,"sOO|OO:gio.File.set_attribute",
                                      kwlist, &attribute, &py_type, &value_p,
                                      &py_flags, &pycancellable))
         return NULL;
@@ -784,7 +784,7 @@ _wrap_g_file_query_settable_attributes(PyGObject *self,
     PyObject *py_ret;
 
     if (!PyArg_ParseTupleAndKeywords(args, kwargs,
-                                     "|O:GFile.query_settable_attributes",
+                                     "|O:gio.File.query_settable_attributes",
                                      kwlist, &pycancellable))
         return NULL;
 
@@ -830,7 +830,7 @@ _wrap_g_file_query_writable_namespaces(PyGObject *self,
     PyObject *py_ret;
 
     if (!PyArg_ParseTupleAndKeywords(args, kwargs,
-                                     "|O:GFile.query_writable_namespaces",
+                                     "|O:gio.File.query_writable_namespaces",
                                      kwlist, &pycancellable))
         return NULL;
 
@@ -1413,7 +1413,7 @@ _wrap_g_file_query_filesystem_info_async(PyGObject *self, PyObject *args, PyObje
     notify = pygio_notify_new();
 
     if (!PyArg_ParseTupleAndKeywords(args, kwargs,
-				     "sO|iOO:GFile.query_filesystem_info_async",
+				     "sO|iOO:gio.File.query_filesystem_info_async",
 				     kwlist,
 				     &attributes,
 				     &notify->callback,
@@ -1464,7 +1464,7 @@ _wrap_g_file_set_attributes_async(PyGObject *self,
     notify = pygio_notify_new();
 
     if (!PyArg_ParseTupleAndKeywords(args, kwargs,
-				     "O!O|OiOO:GFile.set_attributes_async",
+				     "O!O|OiOO:gio.File.set_attributes_async",
 				     kwlist,
 				     &PyGFileInfo_Type,
 				     &info,
@@ -1555,7 +1555,7 @@ _wrap_g_file_set_display_name_async(PyGObject *self,
     notify = pygio_notify_new();
 
     if (!PyArg_ParseTupleAndKeywords(args, kwargs,
-				     "sO|iOO:GFile.set_display_name_async",
+				     "sO|iOO:gio.File.set_display_name_async",
 				     kwlist,
 				     &display_name,
 				     &notify->callback,
diff --git a/gio/gfileenumerator.override b/gio/gfileenumerator.override
index 4776d8e..db29550 100644
--- a/gio/gfileenumerator.override
+++ b/gio/gfileenumerator.override
@@ -70,7 +70,7 @@ _wrap_g_file_enumerator_next_files_async(PyGObject *self, PyObject *args, PyObje
     notify = pygio_notify_new();
 
     if (!PyArg_ParseTupleAndKeywords(args, kwargs,
-				     "iO|iOO:GFileEnumerator.enumerate_children_async",
+				     "iO|iOO:gio.FileEnumerator.enumerate_next_files_async",
 				     kwlist,
 				     &num_files,
 				     &notify->callback,
@@ -113,7 +113,7 @@ _wrap_g_file_enumerator_next_files_finish(PyGObject *self, PyObject *args, PyObj
     PyObject *ret;
     
     if (!PyArg_ParseTupleAndKeywords(args, kwargs,
-				     "O!:GFileEnumerator.next_files_finish",
+				     "O!:gio.FileEnumerator.next_files_finish",
 				     kwlist,
 				     &PyGAsyncResult_Type, &result))
         return NULL;
@@ -153,7 +153,7 @@ _wrap_g_file_enumerator_close_async(PyGObject *self,
     notify = pygio_notify_new();
 
     if (!PyArg_ParseTupleAndKeywords(args, kwargs,
-                                     "O|iOO:GFileEnumerator.close_async",
+                                     "O|iOO:gio.FileEnumerator.close_async",
                                      kwlist,
                                      &notify->callback,
                                      &io_priority,
diff --git a/gio/ginputstream.override b/gio/ginputstream.override
index 762a47a..260b2fc 100644
--- a/gio/ginputstream.override
+++ b/gio/ginputstream.override
@@ -230,7 +230,7 @@ _wrap_g_input_stream_read_finish(PyGObject *self,
     PyGIONotify *notify;
 
     if (!PyArg_ParseTupleAndKeywords(args, kwargs,
-                                     "O!:GInputStream.read_finish",
+                                     "O!:gio.InputStream.read_finish",
                                      kwlist, &PyGAsyncResult_Type, &result))
         return NULL;
 
diff --git a/gio/gio.override b/gio/gio.override
index 78d3688..aee6926 100644
--- a/gio/gio.override
+++ b/gio/gio.override
@@ -353,210 +353,6 @@ _wrap_g_content_type_guess(PyGObject *self, PyObject *args, PyObject *kwargs)
     return ret;
 }
 %%
-override g_mount_unmount kwargs
-static PyObject *
-_wrap_g_mount_unmount(PyGObject *self,
-		      PyObject *args,
-		      PyObject *kwargs)
-{
-    static char *kwlist[] = { "callback", "flags",
-			      "cancellable", "user_data", NULL };
-    PyGIONotify *notify;
-    PyObject *py_flags = NULL;
-    PyGObject *py_cancellable = NULL;
-    GMountUnmountFlags flags = G_MOUNT_UNMOUNT_NONE;
-    GCancellable *cancellable;
-
-    notify = pygio_notify_new();
-
-    if (!PyArg_ParseTupleAndKeywords(args, kwargs,
-                                     "O|OOO:GMount.unmount",
-				     kwlist,
-				     &notify->callback,
-				     &py_flags,
-				     &py_cancellable,
-				     &notify->data))
-        goto error;
-
-    if (!pygio_notify_callback_is_valid(notify))
-        goto error;
-
-    if (py_flags && pyg_flags_get_value(G_TYPE_MOUNT_UNMOUNT_FLAGS,
-					py_flags, (gpointer)&flags))
-        goto error;
-
-    if (!pygio_check_cancellable(py_cancellable, &cancellable))
-        goto error;
-
-    pygio_notify_reference_callback(notify);
-
-    pyg_begin_allow_threads;
-
-    g_mount_unmount(G_MOUNT(self->obj),
-		    flags,
-		    cancellable,
-		    (GAsyncReadyCallback)async_result_callback_marshal,
-		    notify);
-
-    pyg_end_allow_threads;
-
-    Py_INCREF(Py_None);
-    return Py_None;
-
- error:
-    pygio_notify_free(notify);
-    return NULL;
-}
-%%
-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 = pygio_notify_new();
-
-    if (!PyArg_ParseTupleAndKeywords(args, kwargs,
-                                     "O|OOO:gio.Mount.eject",
-				     kwlist,
-				     &notify->callback,
-				     &py_flags,
-				     &py_cancellable,
-				     &notify->data))
-        goto error;
-
-    if (!pygio_notify_callback_is_valid(notify))
-        goto error;
-
-    if (py_flags && pyg_flags_get_value(G_TYPE_MOUNT_UNMOUNT_FLAGS,
-					py_flags, (gpointer) &flags))
-        goto error;
-
-    if (!pygio_check_cancellable(py_cancellable, &cancellable))
-        goto error;
-
-    pygio_notify_reference_callback(notify);
-
-    pyg_begin_allow_threads;
-
-    g_mount_eject(G_MOUNT(self->obj),
-		  flags,
-		  cancellable,
-		  (GAsyncReadyCallback) async_result_callback_marshal,
-		  notify);
-
-    pyg_end_allow_threads;
-
-    Py_INCREF(Py_None);
-    return Py_None;
-
- error:
-    pygio_notify_free(notify);
-    return NULL;
-}
-%%
-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 = pygio_notify_new();
-
-    if (!PyArg_ParseTupleAndKeywords(args, kwargs,
-                                     "O|OOOO:gio.Mount.remount",
-				     kwlist,
-				     &notify->callback,
-				     &py_flags,
-				     &py_mount_operation,
-				     &py_cancellable,
-				     &notify->data))
-        goto error;
-
-    if (!pygio_notify_callback_is_valid(notify))
-        goto error;
-
-    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");
-            goto error;
-	}
-
-	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))
-        goto error;
-
-    if (!pygio_check_cancellable(py_cancellable, &cancellable))
-        goto error;
-
-    pygio_notify_reference_callback(notify);
-
-    pyg_begin_allow_threads;
-
-    g_mount_remount(G_MOUNT(self->obj),
-		    flags,
-		    mount_operation,
-		    cancellable,
-		    (GAsyncReadyCallback) async_result_callback_marshal,
-		    notify);
-
-    pyg_end_allow_threads;
-
-    Py_INCREF(Py_None);
-    return Py_None;
-
- error:
-    pygio_notify_free(notify);
-    return NULL;
-}
-%%
-override-slot GMount.tp_repr
-static PyObject *
-_wrap_g_mount_tp_repr(PyGObject *self)
-{
-    char *name = g_mount_get_name(G_MOUNT(self->obj));
-    char *uuid = g_mount_get_uuid(G_MOUNT(self->obj));
-    gchar *representation;
-    PyObject *result;
-
-    if (name) {
-	if (uuid) {
-	    representation = g_strdup_printf("<%s at %p: %s (%s)>",
-					     self->ob_type->tp_name, self, name, uuid);
-	}
-	else {
-	    representation = g_strdup_printf("<%s at %p: %s>",
-					     self->ob_type->tp_name, self, name);
-	}
-    }
-    else
-	representation = g_strdup_printf("<%s at %p: UNKNOWN NAME>", self->ob_type->tp_name, self);
-
-    g_free(name);
-    g_free(uuid);
-
-    result = PyString_FromString(representation);
-    g_free(representation);
-    return result;
-}
-%%
 override g_vfs_get_supported_uri_schemes noargs
 static PyObject *
 _wrap_g_vfs_get_supported_uri_schemes(PyGObject *self)
diff --git a/gio/gmount.override b/gio/gmount.override
index 43eca14..ba88a19 100644
--- a/gio/gmount.override
+++ b/gio/gmount.override
@@ -140,3 +140,207 @@ _wrap_g_mount_guess_content_type_sync(PyGObject *self,
     }
     return py_ret;
 }
+%%
+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 = pygio_notify_new();
+
+    if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+                                     "O|OOOO:gio.Mount.remount",
+				     kwlist,
+				     &notify->callback,
+				     &py_flags,
+				     &py_mount_operation,
+				     &py_cancellable,
+				     &notify->data))
+        goto error;
+
+    if (!pygio_notify_callback_is_valid(notify))
+        goto error;
+
+    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");
+            goto error;
+	}
+
+	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))
+        goto error;
+
+    if (!pygio_check_cancellable(py_cancellable, &cancellable))
+        goto error;
+
+    pygio_notify_reference_callback(notify);
+
+    pyg_begin_allow_threads;
+
+    g_mount_remount(G_MOUNT(self->obj),
+		    flags,
+		    mount_operation,
+		    cancellable,
+		    (GAsyncReadyCallback) async_result_callback_marshal,
+		    notify);
+
+    pyg_end_allow_threads;
+
+    Py_INCREF(Py_None);
+    return Py_None;
+
+ error:
+    pygio_notify_free(notify);
+    return NULL;
+}
+%%
+override g_mount_unmount kwargs
+static PyObject *
+_wrap_g_mount_unmount(PyGObject *self,
+		      PyObject *args,
+		      PyObject *kwargs)
+{
+    static char *kwlist[] = { "callback", "flags",
+			      "cancellable", "user_data", NULL };
+    PyGIONotify *notify;
+    PyObject *py_flags = NULL;
+    PyGObject *py_cancellable = NULL;
+    GMountUnmountFlags flags = G_MOUNT_UNMOUNT_NONE;
+    GCancellable *cancellable;
+
+    notify = pygio_notify_new();
+
+    if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+                                     "O|OOO:gio.Mount.unmount",
+				     kwlist,
+				     &notify->callback,
+				     &py_flags,
+				     &py_cancellable,
+				     &notify->data))
+        goto error;
+
+    if (!pygio_notify_callback_is_valid(notify))
+        goto error;
+
+    if (py_flags && pyg_flags_get_value(G_TYPE_MOUNT_UNMOUNT_FLAGS,
+					py_flags, (gpointer)&flags))
+        goto error;
+
+    if (!pygio_check_cancellable(py_cancellable, &cancellable))
+        goto error;
+
+    pygio_notify_reference_callback(notify);
+
+    pyg_begin_allow_threads;
+
+    g_mount_unmount(G_MOUNT(self->obj),
+		    flags,
+		    cancellable,
+		    (GAsyncReadyCallback)async_result_callback_marshal,
+		    notify);
+
+    pyg_end_allow_threads;
+
+    Py_INCREF(Py_None);
+    return Py_None;
+
+ error:
+    pygio_notify_free(notify);
+    return NULL;
+}
+%%
+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 = pygio_notify_new();
+
+    if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+                                     "O|OOO:gio.Mount.eject",
+				     kwlist,
+				     &notify->callback,
+				     &py_flags,
+				     &py_cancellable,
+				     &notify->data))
+        goto error;
+
+    if (!pygio_notify_callback_is_valid(notify))
+        goto error;
+
+    if (py_flags && pyg_flags_get_value(G_TYPE_MOUNT_UNMOUNT_FLAGS,
+					py_flags, (gpointer) &flags))
+        goto error;
+
+    if (!pygio_check_cancellable(py_cancellable, &cancellable))
+        goto error;
+
+    pygio_notify_reference_callback(notify);
+
+    pyg_begin_allow_threads;
+
+    g_mount_eject(G_MOUNT(self->obj),
+		  flags,
+		  cancellable,
+		  (GAsyncReadyCallback) async_result_callback_marshal,
+		  notify);
+
+    pyg_end_allow_threads;
+
+    Py_INCREF(Py_None);
+    return Py_None;
+
+ error:
+    pygio_notify_free(notify);
+    return NULL;
+}
+%%
+override-slot GMount.tp_repr
+static PyObject *
+_wrap_g_mount_tp_repr(PyGObject *self)
+{
+    char *name = g_mount_get_name(G_MOUNT(self->obj));
+    char *uuid = g_mount_get_uuid(G_MOUNT(self->obj));
+    gchar *representation;
+    PyObject *result;
+
+    if (name) {
+	if (uuid) {
+	    representation = g_strdup_printf("<%s at %p: %s (%s)>",
+					     self->ob_type->tp_name, self, name, uuid);
+	}
+	else {
+	    representation = g_strdup_printf("<%s at %p: %s>",
+					     self->ob_type->tp_name, self, name);
+	}
+    }
+    else
+	representation = g_strdup_printf("<%s at %p: UNKNOWN NAME>", self->ob_type->tp_name, self);
+
+    g_free(name);
+    g_free(uuid);
+
+    result = PyString_FromString(representation);
+    g_free(representation);
+    return result;
+}



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