[rygel] media-export: Adapt to delete_ to remove_ rename



commit 038a7c65dd72189b165d83c1a594430a2d7cbf4f
Author: Jens Georg <mail jensge org>
Date:   Mon Sep 21 13:05:17 2009 +0200

    media-export: Adapt to delete_ to remove_ rename

 .../media-export/rygel-media-export-harvester.vala |    2 +-
 .../rygel-media-export-root-container.vala         |   20 ++++++++++++--------
 2 files changed, 13 insertions(+), 9 deletions(-)
---
diff --git a/src/plugins/media-export/rygel-media-export-harvester.vala b/src/plugins/media-export/rygel-media-export-harvester.vala
index 8d98685..e69e2c8 100644
--- a/src/plugins/media-export/rygel-media-export-harvester.vala
+++ b/src/plugins/media-export/rygel-media-export-harvester.vala
@@ -95,7 +95,7 @@ public class Rygel.MediaExportHarvester : GLib.Object {
             }
 
             foreach (var child in children) {
-                this.media_db.delete_by_id (child);
+                this.media_db.remove_by_id (child);
             }
 
             do_update ();
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 30bb0e0..51888d8 100644
--- a/src/plugins/media-export/rygel-media-export-root-container.vala
+++ b/src/plugins/media-export/rygel-media-export-root-container.vala
@@ -86,10 +86,14 @@ public class Rygel.MediaExportRootContainer : Rygel.MediaDBContainer {
     }
 
     public void add_uri (string uri) {
-        this.uris.add (uri);
-        this.media_db.update_object (this);
-        var file = File.new_for_commandline_arg (uri);
-        this.harvest (file);
+        try {
+            this.uris.add (uri);
+            this.media_db.update_object (this);
+            var file = File.new_for_commandline_arg (uri);
+            this.harvest (file);
+        } catch (Error error) {
+            this.uris.remove (uri);
+        }
     }
 
     public void remove_uri (string uri) {
@@ -100,8 +104,8 @@ public class Rygel.MediaExportRootContainer : Rygel.MediaDBContainer {
         try {
             this.uris.remove (uri);
             this.media_db.update_object (this);
-            this.media_db.delete_by_id (id);
-        } catch (MediaDBError e) {
+            this.media_db.remove_by_id (id);
+        } catch (Error e) {
             warning ("Failed to remove uri: %s", e.message);
         }
     }
@@ -154,7 +158,7 @@ public class Rygel.MediaExportRootContainer : Rygel.MediaDBContainer {
             debug ("Id %s no longer in config, deleting...",
                    id);
             try {
-                this.media_db.delete_by_id (id);
+                this.media_db.remove_by_id (id);
             } catch (MediaDBError e) {
                 warning ("Failed to remove entry: %s", e.message);
             }
@@ -202,7 +206,7 @@ public class Rygel.MediaExportRootContainer : Rygel.MediaDBContainer {
                 // it may be that files removed are files that are not
                 // in the database, because they're not media files
                 if (obj != null) {
-                    this.media_db.delete_object (obj);
+                    this.media_db.remove_object (obj);
                     if (obj.parent != null) {
                         obj.parent.updated ();
                     }



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