/* -*- Mode: C; c-basic-offset: 4 -*- * pygobject - Python bindings for GObject * Copyright (C) 2009 Gian Mario Tagliaretti * * gsocket.override: module overrides for GSocket and related types * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA */ %% override g_socket_condition_check kwargs static PyObject * _wrap_g_socket_condition_check(PyGObject *self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { "condition", NULL }; gint condition, ret; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:gio.Socket.condition_check", kwlist, &condition)) return NULL; ret = g_socket_condition_check(G_SOCKET(self->obj), condition); return pyg_flags_from_gtype(G_TYPE_IO_CONDITION, ret); } %% override g_socket_condition_wait kwargs static PyObject * _wrap_g_socket_condition_wait(PyGObject *self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { "condition", "cancellable", NULL }; gboolean ret; gint condition; PyGObject *py_cancellable = NULL; GCancellable *cancellable; GError *error; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i|O:gio.Socket.condition_wait", kwlist, &condition, &cancellable)) return NULL; if (!pygio_check_cancellable(py_cancellable, &cancellable)) return NULL; ret = g_socket_condition_wait(G_SOCKET(self->obj), condition, cancellable, &error); return PyBool_FromLong(ret); } %% override g_socket_address_enumerator_next_async kwargs static PyObject * _wrap_g_socket_address_enumerator_next_async(PyGObject *self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { "callback", "cancellable", "user_data", NULL }; PyGIONotify *notify; PyGObject *py_cancellable = NULL; GCancellable *cancellable; notify = pygio_notify_new(); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|OO:gio.SocketAddressEnumerator.next_async", kwlist, ¬ify->callback, &py_cancellable, ¬ify->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_address_enumerator_next_async(G_SOCKET_ADDRESS_ENUMERATOR(self->obj), cancellable, (GAsyncReadyCallback) async_result_callback_marshal, notify); Py_INCREF(Py_None); return Py_None; error: pygio_notify_free(notify); return NULL; } %% override g_socket_client_connect_async kwargs static PyObject * _wrap_g_socket_client_connect_async(PyGObject *self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { "callback", "connectable", "cancellable", "user_data", NULL }; PyGIONotify *notify; PyGObject *py_cancellable = NULL; GCancellable *cancellable; PyGObject *py_connectable; notify = pygio_notify_new(); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO|OO:gio.SocketClient.connect_async", kwlist, ¬ify->callback, &py_connectable, &py_cancellable, ¬ify->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_async(G_SOCKET_CLIENT(self->obj), G_SOCKET_CONNECTABLE(py_connectable->obj), cancellable, (GAsyncReadyCallback) async_result_callback_marshal, notify); Py_INCREF(Py_None); return Py_None; error: 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, ¬ify->callback, &host_and_port, &default_port, &py_cancellable, ¬ify->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** */ /* Could not write method GSocket.send_message: No ArgType for GOutputVector* */ /* Could not write method GSocket.create_source: No ArgType for GIOCondition */