[rygel] core: call remove_item for all MediaItems



commit 128819dfb1acaa466e5d659dab4cbfa2024f2e5c
Author: Topi Santakivi <topi santakivi digia com>
Date:   Wed Jun 15 11:17:25 2011 +0300

    core: call remove_item for all MediaItems
    
    Currently rygel-item-destroyer.remove_object explicitly removes
    place_holder items from Tracker store. For actual media items that
    have an associated file, it only removes the file and relies on
    Tracker to handle the store update.
    
    However, if the directory of that file is not monitored by Tracker,
    the item never gets removed. This commit changes the behavior in
    a way that Tracker store items are always explicitly removed, and
    for non-placeholder items also the related file is removed. Also makes
    Rygel satisfy DLNA guideline 7.3.139.1.

 src/rygel/rygel-item-destroyer.vala |   15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)
---
diff --git a/src/rygel/rygel-item-destroyer.vala b/src/rygel/rygel-item-destroyer.vala
index 8fcf911..e6dc6c4 100644
--- a/src/rygel/rygel-item-destroyer.vala
+++ b/src/rygel/rygel-item-destroyer.vala
@@ -76,17 +76,16 @@ internal class Rygel.ItemDestroyer: GLib.Object, Rygel.StateMachine {
     private async void remove_object () throws Error {
         var media_object = yield this.fetch_object ();
 
-        if (media_object is MediaItem &&
-            (media_object as MediaItem).place_holder) {
+        if (media_object is MediaItem ) {
             var parent = media_object.parent as WritableContainer;
-
             yield parent.remove_item (this.object_id, this.cancellable);
-        } else {
-            var writables = yield media_object.get_writables (this.cancellable);
 
-            foreach (var file in writables) {
-                if (file.query_exists (this.cancellable)) {
-                    file.delete (this.cancellable);
+            if (!(media_object as MediaItem).place_holder) {
+                var writables = yield media_object.get_writables (this.cancellable);
+                foreach (var file in writables) {
+                    if (file.query_exists (this.cancellable)) {
+                        file.delete (this.cancellable);
+                    }
                 }
             }
         }



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