[pygobject] Wrap gio.SocketClient.connect_to_host_async()



commit 116ea1bfe32946e67aa54eb8dc7b977e57f254c2
Author: Gian Mario Tagliaretti <gianmt gnome org>
Date:   Thu Dec 31 10:10:43 2009 +0100

    Wrap gio.SocketClient.connect_to_host_async()

 gio/gsocket.override |   48 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 48 insertions(+), 0 deletions(-)
---
diff --git a/gio/gsocket.override b/gio/gsocket.override
index c44af34..bfe7df2 100644
--- a/gio/gsocket.override
+++ b/gio/gsocket.override
@@ -153,6 +153,54 @@ _wrap_g_socket_client_connect_async(PyGObject *self,
     pygio_notify_free(notify);
     return NULL;
 }
+%%
+override g_socket_client_connect_to_host_async kwargs
+static PyObject *
+_wrap_g_socket_client_connect_to_host_async(PyGObject *self,
+                                            PyObject *args,
+                                            PyObject *kwargs)
+{
+    static char *kwlist[] = { "callback", "host_and_port", "default_port",
+                              "cancellable", "user_data", NULL };
+    PyGIONotify *notify;
+    PyGObject *py_cancellable = NULL;
+    GCancellable *cancellable;
+    gchar *host_and_port;
+    guint16 default_port;
+
+    notify = pygio_notify_new();
+
+    if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+                                "OsH|OO:gio.SocketClient.connect_to_host_async",
+                                kwlist,
+                                &notify->callback,
+                                &host_and_port,
+                                &default_port,
+                                &py_cancellable,
+                                &notify->data))
+        goto error;
+      
+    if (!pygio_notify_callback_is_valid(notify))
+        goto error;
+
+    if (!pygio_check_cancellable(py_cancellable, &cancellable))
+        goto error;
+
+    pygio_notify_reference_callback(notify);
+
+    g_socket_client_connect_to_host_async(G_SOCKET_CLIENT(self->obj),
+                          host_and_port, default_port,
+                          cancellable,
+                          (GAsyncReadyCallback) async_result_callback_marshal,
+                          notify);
+
+    Py_INCREF(Py_None);
+    return Py_None;
+
+ error:
+    pygio_notify_free(notify);
+    return NULL;
+}
 
 /* Could not write method GSocket.receive_from: No ArgType for GSocketAddress** */
 /* Could not write method GSocket.receive_message: No ArgType for GSocketAddress** */



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