external: Don't recurse into external hierarchy
authorJens Georg <mail@jensge.org>
Fri, 13 Jul 2012 21:43:41 +0000 (23:43 +0200)
committerJens Georg <mail@jensge.org>
Tue, 17 Jul 2012 06:47:07 +0000 (08:47 +0200)
https://bugzilla.gnome.org/show_bug.cgi?id=644491

src/plugins/external/rygel-external-container.vala

index bc279ff..6bb7d5d 100644 (file)
@@ -84,6 +84,10 @@ public class Rygel.External.Container : Rygel.MediaContainer,
             filter += object_prop;
         }
 
+        foreach (var container_prop in MediaContainerProxy.PROPERTIES) {
+            filter += container_prop;
+        }
+
         foreach (var item_prop in MediaItemProxy.PROPERTIES) {
             filter += item_prop;
         }
@@ -156,6 +160,33 @@ public class Rygel.External.Container : Rygel.MediaContainer,
                         break;
                     }
                 }
+
+                // still not found; could be it's a child of a container we
+                // couldn't browse at create-time since it had an unknown
+                // number of children
+                Properties props_iface = yield Bus.get_proxy
+                                            (BusType.SESSION,
+                                             this.service_name,
+                                             id,
+                                             DBusProxyFlags.DO_NOT_LOAD_PROPERTIES);
+
+                var props = yield props_iface.get_all (MediaContainerProxy.IFACE);
+                var child_count = (uint) props.lookup ("ChildCount");
+                var searchable = (bool) props.lookup ("Searchable");
+                props = yield props_iface.get_all (MediaObjectProxy.IFACE);
+                var path = (string) props.lookup ("Path");
+                var title = (string) props.lookup ("DisplayName");
+                if (title == null) {
+                    title = path;
+                }
+
+                media_object = new Container (path,
+                                              title,
+                                              child_count,
+                                              searchable,
+                                              this.service_name,
+                                              path,
+                                              this);
             }
         } else {
             var parent_container = new DummyContainer
@@ -293,8 +324,10 @@ public class Rygel.External.Container : Rygel.MediaContainer,
         }
 
         try {
-            // Update our information about the container
-            yield this.refresh_child_containers ();
+            if (this.child_count < int.MAX) {
+                // Update our information about the container
+                yield this.refresh_child_containers ();
+            }
         } catch (GLib.Error err) {
             warning ("Failed to update information about container '%s': %s",
                      this.actual_container.get_object_path (),