[rygel] media-export: persist the uris added via DBus
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [rygel] media-export: persist the uris added via DBus
- Date: Mon, 21 Sep 2009 11:55:08 +0000 (UTC)
commit 083f3700d8f237a36f483461149783e05f3e477d
Author: Jens Georg <mail jensge org>
Date: Thu Sep 17 12:35:45 2009 +0200
media-export: persist the uris added via DBus
The uris are added to the root container which is persisted in the MediaDB
.../rygel-media-export-root-container.vala | 24 ++++++++++++++++---
1 files changed, 20 insertions(+), 4 deletions(-)
---
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 6663abc..30bb0e0 100644
--- a/src/plugins/media-export/rygel-media-export-root-container.vala
+++ b/src/plugins/media-export/rygel-media-export-root-container.vala
@@ -58,6 +58,15 @@ public class Rygel.MediaExportRootContainer : Rygel.MediaDBContainer {
uris.add (uri);
}
+ // add the uris gotten from DBus interface
+ try {
+ var obj = this.media_db.get_object ("0");
+ if (obj != null && obj.uris != null) {
+ uris.add_all (obj.uris);
+ }
+ } catch (MediaDBError error) {
+ }
+
return uris;
}
@@ -77,6 +86,8 @@ 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);
}
@@ -87,6 +98,8 @@ public class Rygel.MediaExportRootContainer : Rygel.MediaDBContainer {
file.get_uri ());
try {
+ this.uris.remove (uri);
+ this.media_db.update_object (this);
this.media_db.delete_by_id (id);
} catch (MediaDBError e) {
warning ("Failed to remove uri: %s", e.message);
@@ -110,10 +123,13 @@ public class Rygel.MediaExportRootContainer : Rygel.MediaDBContainer {
this.service = new MediaExportDBusService (this);
- try {
- media_db.save_object (this);
- } catch (Error error) {
- // do nothing
+ int64 timestamp;
+ if (!this.media_db.exists ("0", out timestamp)) {
+ try {
+ media_db.save_object (this);
+ } catch (Error error) {
+ // do nothing
+ }
}
ArrayList<string> ids;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]