pygobject r1027 - in trunk: . gio tests
- From: gianmt svn gnome org
- To: svn-commits-list gnome org
- Subject: pygobject r1027 - in trunk: . gio tests
- Date: Sun, 22 Mar 2009 00:12:35 +0000 (UTC)
Author: gianmt
Date: Sun Mar 22 00:12:35 2009
New Revision: 1027
URL: http://svn.gnome.org/viewvc/pygobject?rev=1027&view=rev
Log:
2009-03-22 Gian Mario Tagliaretti <gianmt gnome org>
* gio/gfileenumerator.override (_wrap_g_file_enumerator_close_async)
wrap new method.
* tests/test_gio.py (TestGFileEnumerator.testCloseFilesAsync):
Test the above.
Modified:
trunk/ChangeLog
trunk/gio/gfileenumerator.override
trunk/tests/test_gio.py
Modified: trunk/gio/gfileenumerator.override
==============================================================================
--- trunk/gio/gfileenumerator.override (original)
+++ trunk/gio/gfileenumerator.override Sun Mar 22 00:12:35 2009
@@ -136,3 +136,49 @@
return ret;
}
+%%
+override g_file_enumerator_close_async kwargs
+static PyObject *
+_wrap_g_file_enumerator_close_async(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "callback", "io_priority", "cancellable",
+ "user_data", NULL };
+ int io_priority = G_PRIORITY_DEFAULT;
+ PyGObject *pycancellable = NULL;
+ GCancellable *cancellable;
+ PyGIONotify *notify;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O|iOO:GFileEnumerator.close_async",
+ kwlist,
+ ¬ify->callback,
+ &io_priority,
+ &pycancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (!pygio_check_cancellable(pycancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_file_enumerator_close_async(G_FILE_ENUMERATOR(self->obj),
+ io_priority,
+ cancellable,
+ (GAsyncReadyCallback)async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
Modified: trunk/tests/test_gio.py
==============================================================================
--- trunk/tests/test_gio.py (original)
+++ trunk/tests/test_gio.py Sun Mar 22 00:12:35 2009
@@ -500,6 +500,21 @@
loop = glib.MainLoop()
loop.run()
+ def testCloseFilesAsync(self):
+ def callback(enumerator, result):
+ try:
+ enumerator.close_finish(result)
+ finally:
+ loop.quit()
+
+ enumerator = self.file.enumerate_children(
+ "standard::*", gio.FILE_QUERY_INFO_NOFOLLOW_SYMLINKS)
+
+ enumerator.close_async(callback)
+
+ loop = glib.MainLoop()
+ loop.run()
+
class TestInputStream(unittest.TestCase):
def setUp(self):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]