[rygel] Fetch files from enumerator, asynchronously
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: svn-commits-list gnome org
- Subject: [rygel] Fetch files from enumerator, asynchronously
- Date: Mon, 11 May 2009 10:04:58 -0400 (EDT)
commit 54e41eee0b319a58600752fb89f885f6e16a3bcd
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Mon May 4 17:14:10 2009 +0300
Fetch files from enumerator, asynchronously
This is the second (and hopefully) last step towards async plugin loading.
---
src/rygel/rygel-plugin-loader.vala | 24 ++++++++++++++++++++++--
1 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/src/rygel/rygel-plugin-loader.vala b/src/rygel/rygel-plugin-loader.vala
index 4d1640f..4b280ad 100644
--- a/src/rygel/rygel-plugin-loader.vala
+++ b/src/rygel/rygel-plugin-loader.vala
@@ -72,9 +72,29 @@ public class Rygel.PluginLoader : Object {
return;
}
- FileInfo info;
+ enumerator.next_files_async (int.MAX,
+ Priority.DEFAULT,
+ null,
+ on_next_files_enumerated);
+ }
+
+ private void on_next_files_enumerated (GLib.Object source_object,
+ GLib.AsyncResult res) {
+ FileEnumerator enumerator = (FileEnumerator) source_object;
+ File dir = (File) enumerator.get_container ();
+
+ List<FileInfo> infos;
+ try {
+ infos = enumerator.next_files_finish (res);
+ } catch (Error error) {
+ critical ("Error listing contents of directory '%s': %s\n",
+ dir.get_path (),
+ error.message);
+
+ return;
+ }
- while ((info = enumerator.next_file (null)) != null) {
+ foreach (var info in infos) {
string file_name = info.get_name ();
string file_path = Path.build_filename (dir.get_path (), file_name);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]