[rygel/wip/create-container: 3/5] WIP
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel/wip/create-container: 3/5] WIP
- Date: Sat, 23 Feb 2013 14:07:07 +0000 (UTC)
commit a67694767740720cdbb2e30a1c734a8ac34961e3
Author: Jens Georg <jensg openismus com>
Date: Wed Feb 20 17:22:44 2013 +0100
WIP
src/librygel-server/rygel-writable-container.vala | 12 ++++++++++++
.../rygel-media-export-writable-db-container.vala | 16 +++++++++++-----
.../rygel-tracker-category-all-container.vala | 10 ++++++++++
3 files changed, 33 insertions(+), 5 deletions(-)
---
diff --git a/src/librygel-server/rygel-writable-container.vala
b/src/librygel-server/rygel-writable-container.vala
index 1c3b47c..86762f0 100644
--- a/src/librygel-server/rygel-writable-container.vala
+++ b/src/librygel-server/rygel-writable-container.vala
@@ -26,6 +26,10 @@
using Gee;
+public errordomain WriteableContainerError {
+ NOT_IMPLEMENTED
+}
+
/**
* This interface should be implemented by 'writable' containers - ones that allow
* adding (via upload), removal and editing of items directly under them.
@@ -86,6 +90,10 @@ public interface Rygel.WritableContainer : MediaContainer {
/**
* Add a new container directly under this container.
*
+ **/
+ public async abstract void add_container (MediaContainer container,
+ Cancellable? cancellable)
+ throws Error;
/**
* Remove an item directly under this container that has the ID @id.
*
@@ -101,4 +109,8 @@ public interface Rygel.WritableContainer : MediaContainer {
*/
public async abstract void remove_item (string id, Cancellable? cancellable)
throws Error;
+
+ public async abstract void remove_container (string id,
+ Cancellable? cancellable)
+ throws Error;
}
diff --git a/src/plugins/media-export/rygel-media-export-writable-db-container.vala
b/src/plugins/media-export/rygel-media-export-writable-db-container.vala
index fc72774..57ad34e 100644
--- a/src/plugins/media-export/rygel-media-export-writable-db-container.vala
+++ b/src/plugins/media-export/rygel-media-export-writable-db-container.vala
@@ -70,12 +70,12 @@ internal class Rygel.MediaExport.WritableDbContainer : TrackableDbContainer,
Cancellable? cancellable)
throws Error {
container.parent = this;
- var file = File.new_for_uri (item.uris)) {
- if (file.is_native () &&
- container.upnp_class == MediaContainer.STORAGE_FOLDER) {
- file.mkdir_with_parents (cancellable);
- }
+ var file = File.new_for_uri (container.uris[0]);
+ if (file.is_native () &&
+ container.upnp_class == MediaContainer.STORAGE_FOLDER) {
+ file.make_directory_with_parents (cancellable);
}
+
yield this.add_child_tracked (container);
}
@@ -85,4 +85,10 @@ internal class Rygel.MediaExport.WritableDbContainer : TrackableDbContainer,
yield this.remove_child_tracked (object);
}
+
+ public async void remove_container (string id, Cancellable? cancellable)
+ throws Error {
+ throw new WriteableContainerError.NOT_IMPLEMENTED ("Not supported");
+ }
+
}
diff --git a/src/plugins/tracker/rygel-tracker-category-all-container.vala
b/src/plugins/tracker/rygel-tracker-category-all-container.vala
index dd52e92..83c104d 100644
--- a/src/plugins/tracker/rygel-tracker-category-all-container.vala
+++ b/src/plugins/tracker/rygel-tracker-category-all-container.vala
@@ -90,6 +90,11 @@ public class Rygel.Tracker.CategoryAllContainer : SearchContainer,
item.parent = this;
}
+ public async void add_container (MediaContainer container,
+ Cancellable? cancellable) throws Error {
+ throw new WriteableContainerError.NOT_IMPLEMENTED ("Not supported");
+ }
+
public async void remove_item (string id, Cancellable? cancellable)
throws Error {
string parent_id;
@@ -99,6 +104,11 @@ public class Rygel.Tracker.CategoryAllContainer : SearchContainer,
yield this.remove_entry_from_store (urn);
}
+ public async void remove_container (string id, Cancellable? cancellable)
+ throws Error {
+ throw new WriteableContainerError.NOT_IMPLEMENTED ("Not supported");
+ }
+
public async MediaObjects? search (SearchExpression? expression,
uint offset,
uint max_count,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]