From: Zeeshan Ali (Khattak) Date: Mon, 4 May 2009 14:14:10 +0000 (+0300) Subject: Fetch files from enumerator, asynchronously X-Git-Tag: RYGEL_0_3~101 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=54e41eee0b319a58600752fb89f885f6e16a3bcd;p=profile%2Fivi%2Frygel.git Fetch files from enumerator, asynchronously This is the second (and hopefully) last step towards async plugin loading. --- 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 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);