[rygel] core: Add MediaContainer.get_writable()
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] core: Add MediaContainer.get_writable()
- Date: Wed, 17 Feb 2010 13:40:19 +0000 (UTC)
commit 3ea9eeec520434766b154622e49cb565cd1b37fb
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Tue Jan 26 17:36:00 2010 +0200
core: Add MediaContainer.get_writable()
A new method that fetches a GLib.File object for any writable URI
available for the container.
src/rygel/rygel-media-container.vala | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/src/rygel/rygel-media-container.vala b/src/rygel/rygel-media-container.vala
index edbde2d..8ce6519 100644
--- a/src/rygel/rygel-media-container.vala
+++ b/src/rygel/rygel-media-container.vala
@@ -246,5 +246,27 @@ public abstract class Rygel.MediaContainer : MediaObject {
this.parent.container_updated (updated_container);
}
}
+
+ /**
+ * Fetches a File object for any writable URI available for this container.
+ *
+ * @param cancellable A GLib.Cancellable
+ */
+ private async File? get_writable (Cancellable? cancellable) throws Error {
+ foreach (var uri in this.uris) {
+ var file = File.new_for_uri (uri);
+
+ var info = yield file.query_info_async (
+ FILE_ATTRIBUTE_ACCESS_CAN_WRITE,
+ FileQueryInfoFlags.NONE,
+ Priority.DEFAULT,
+ cancellable);
+ if (info.get_attribute_boolean (FILE_ATTRIBUTE_ACCESS_CAN_WRITE)) {
+ return file;
+ }
+ }
+
+ return null;
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]