media-export: Root container should handle items
authorZeeshan Ali (Khattak) <zeeshanak@gnome.org>
Thu, 4 Jun 2009 17:12:36 +0000 (20:12 +0300)
committerZeeshan Ali (Khattak) <zeeshanak@gnome.org>
Thu, 4 Jun 2009 17:12:36 +0000 (20:12 +0300)
src/plugins/media-export/rygel-media-export-root-container.vala

index 705f6be..6f21f6e 100644 (file)
@@ -116,7 +116,26 @@ public class Rygel.MediaExportRootContainer : MediaContainer {
         foreach (var uri in uris) {
             var f = File.new_for_commandline_arg (uri);
             if (f.query_exists (null)) {
-                this.children.add (new MediaExportContainer (this, f));
+                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);
+                }
             }
         }