[rygel] media-export: Asynchronously populate root container
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: svn-commits-list gnome org
- Subject: [rygel] media-export: Asynchronously populate root container
- Date: Fri, 5 Jun 2009 12:02:54 -0400 (EDT)
commit e94a137b2f55c4c6c4d52bd50df63de1910d265b
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Thu Jun 4 20:06:28 2009 +0300
media-export: Asynchronously populate root container
---
.../rygel-media-export-root-container.vala | 53 ++++++++++++--------
1 files changed, 32 insertions(+), 21 deletions(-)
diff --git a/src/plugins/media-export/rygel-media-export-root-container.vala b/src/plugins/media-export/rygel-media-export-root-container.vala
index 4b1b43b..f48501b 100644
--- a/src/plugins/media-export/rygel-media-export-root-container.vala
+++ b/src/plugins/media-export/rygel-media-export-root-container.vala
@@ -113,29 +113,40 @@ public class Rygel.MediaExportRootContainer : MediaContainer {
foreach (var uri in uris) {
var f = File.new_for_commandline_arg (uri);
if (f.query_exists (null)) {
- MediaObject media_obj = null;
- var info = f.query_info (
- FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE + "," +
- FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME + "," +
- FILE_ATTRIBUTE_STANDARD_TYPE + "," +
- FILE_ATTRIBUTE_STANDARD_NAME,
- FileQueryInfoFlags.NONE,
- null);
-
- if (info.get_file_type () == FileType.DIRECTORY) {
- media_obj = new MediaExportContainer (this, f);
- } else {
- media_obj = new MediaExportItem (this,
- f,
- info);
- }
-
- if (media_obj != null) {
- this.children.add (media_obj);
- }
+ f.query_info_async (
+ FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE + "," +
+ FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME + "," +
+ FILE_ATTRIBUTE_STANDARD_TYPE + "," +
+ FILE_ATTRIBUTE_STANDARD_NAME,
+ FileQueryInfoFlags.NONE,
+ Priority.DEFAULT,
+ null,
+ this.on_info_ready);
}
}
+ }
+
+ private void on_info_ready (Object obj, AsyncResult res) {
+ var file = (File) obj;
- this.child_count = this.children.size;
+ try {
+ var info = file.query_info_finish (res);
+ MediaObject media_obj = null;
+
+ if (info.get_file_type () == FileType.DIRECTORY) {
+ media_obj = new MediaExportContainer (this, file);
+ } else {
+ media_obj = new MediaExportItem (this, file, info);
+ }
+
+ this.children.add (media_obj);
+ this.child_count = this.children.size;
+
+ this.updated ();
+ } catch (Error err) {
+ warning ("Failed to query information on '%s': %s\n",
+ file.get_uri (),
+ err.message);
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]