diff options
author | Johan Dahlin <johan@gnome.org> | 2008-07-18 22:38:29 +0000 |
---|---|---|
committer | Johan Dahlin <johan@src.gnome.org> | 2008-07-18 22:38:29 +0000 |
commit | 7213af80481a6bc12588a5e74944b5c47ec30df4 (patch) | |
tree | faec25fa19bfb68b1b2e811af1bdb204bc6686f8 /examples | |
parent | 4bea3e15b5aa3aaf42986c9e8fd50d4850f50a59 (diff) | |
download | pygobject-7213af80481a6bc12588a5e74944b5c47ec30df4.tar.gz pygobject-7213af80481a6bc12588a5e74944b5c47ec30df4.tar.xz pygobject-7213af80481a6bc12588a5e74944b5c47ec30df4.zip |
Wrap gio.FileEnumerator.next_files_async/next_files_done. Update the
2008-07-19 Johan Dahlin <johan@gnome.org>
* examples/gio/directory-async.py:
* gio/gfileenumerator.override:
* gio/gio.defs:
* tests/test_gio.py:
Wrap gio.FileEnumerator.next_files_async/next_files_done.
Update the example to use them instead of the synchronous versions,
add documentation and tests.
svn path=/trunk/; revision=832
Diffstat (limited to 'examples')
-rw-r--r-- | examples/gio/directory-async.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/examples/gio/directory-async.py b/examples/gio/directory-async.py index eaec2a8..439e62e 100644 --- a/examples/gio/directory-async.py +++ b/examples/gio/directory-async.py @@ -1,13 +1,19 @@ import gobject import gio -def callback(gfile, result): - for file_info in gfile.enumerate_children_finish(result): +def next_files_done(enumerator, result): + print 'done!' + for file_info in enumerator.next_files_finish(result): print file_info.get_name() loop.quit() +def enumerate_children_done(gfile, result): + enumerator = gfile.enumerate_children_finish(result) + enumerator.next_files_async(10, next_files_done) + gfile = gio.File("/") -gfile.enumerate_children_async("standard::name", callback) +gfile.enumerate_children_async( + "standard::name", enumerate_children_done) loop = gobject.MainLoop() loop.run() |