[rygel] media-export: Don't hide empty folders



commit cd42341b3df352d87012a86d8ab6ca1f9b626da6
Author: Jens Georg <jensg openismus com>
Date:   Mon Apr 8 12:12:28 2013 +0200

    media-export: Don't hide empty folders
    
    Unbreak synchronisation and fix MediaExport's part of 660885

 .../media-export/rygel-media-export-harvester.vala |   38 ++-----------------
 .../rygel-media-export-harvesting-task.vala        |    8 ----
 2 files changed, 4 insertions(+), 42 deletions(-)
---
diff --git a/src/plugins/media-export/rygel-media-export-harvester.vala 
b/src/plugins/media-export/rygel-media-export-harvester.vala
index 5f3f67a..ef689c9 100644
--- a/src/plugins/media-export/rygel-media-export-harvester.vala
+++ b/src/plugins/media-export/rygel-media-export-harvester.vala
@@ -158,31 +158,11 @@ internal class Rygel.MediaExport.Harvester : GLib.Object {
                                         this.cancellable);
             if (info.get_file_type () == FileType.DIRECTORY ||
                 Harvester.is_eligible (info)) {
-                string id;
+                var id = MediaCache.get_id (file.get_parent ());
                 try {
-                    MediaContainer parent_container = null;
-                    var current = file;
-                    do {
-                        var parent = current.get_parent ();
-                        id = MediaCache.get_id (parent);
-                        parent_container = cache.get_object (id)
+                    var parent_container = cache.get_object (id)
                                         as MediaContainer;
-
-                        if (parent_container == null) {
-                            current = parent;
-                            if (current in this.locations) {
-                                debug ("Reached the top - parent is filesystem container");
-                                // We have reached the top
-                                parent_container = cache.get_object
-                                            (RootContainer.FILESYSTEM_FOLDER_ID)
-                                            as MediaContainer;
-
-                                break;
-                            }
-                        }
-                    } while (parent_container == null);
-
-                    this.schedule (current, parent_container);
+                    this.schedule (file, parent_container);
                 } catch (DatabaseError error) {
                     warning (_("Error fetching object '%s' from database: %s"),
                             id,
@@ -214,22 +194,12 @@ internal class Rygel.MediaExport.Harvester : GLib.Object {
             var object = cache.get_object (id);
             var parent = null as MediaContainer;
 
-            while (object != null) {
+            if (object != null) {
                 parent = object.parent;
                 if (parent is TrackableContainer) {
                     var container = parent as TrackableContainer;
                     container.remove_child_tracked.begin (object);
                 }
-                if (parent == null) {
-                    break;
-                }
-
-                parent.child_count--;
-                if (parent.child_count != 0) {
-                    break;
-                }
-
-                object = parent;
             }
         } catch (Error error) {
             warning (_("Error removing object from database: %s"),
diff --git a/src/plugins/media-export/rygel-media-export-harvesting-task.vala 
b/src/plugins/media-export/rygel-media-export-harvesting-task.vala
index b9d4fba..ba38a24 100644
--- a/src/plugins/media-export/rygel-media-export-harvesting-task.vala
+++ b/src/plugins/media-export/rygel-media-export-harvesting-task.vala
@@ -337,14 +337,6 @@ public class Rygel.MediaExport.HarvestingTask : Rygel.StateMachine,
     private void do_update () {
         if (this.files.is_empty &&
             !this.containers.is_empty ()) {
-            var container = this.containers.peek_head ();
-            var cache = MediaCache.get_default ();
-            try {
-                if (cache.get_child_count (container.id) == 0) {
-                    var parent = container.parent as TrackableContainer;
-                    parent.remove_child_tracked.begin (container);
-                }
-            } catch (Error error) { }
             this.containers.pop_head ();
         }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]