[rygel] server: Make more member variables be properties
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] server: Make more member variables be properties
- Date: Mon, 19 Nov 2012 12:40:04 +0000 (UTC)
commit 13856d705aeace6eee720f39d05a9024e069c87b
Author: Murray Cumming <murrayc murrayc com>
Date: Mon Nov 19 11:55:54 2012 +0100
server: Make more member variables be properties
And update the standalone-server example appropriately.
See bug #686211 .
examples/standalone-server.c | 4 +++-
src/librygel-server/rygel-http-item-uri.vala | 12 ++++++------
src/librygel-server/rygel-media-item.vala | 6 +++---
src/librygel-server/rygel-media-object.vala | 22 +++++++++++++---------
4 files changed, 25 insertions(+), 19 deletions(-)
---
diff --git a/examples/standalone-server.c b/examples/standalone-server.c
index 16846bb..dd9a6a3 100644
--- a/examples/standalone-server.c
+++ b/examples/standalone-server.c
@@ -120,11 +120,13 @@ int main (int argc, char *argv[])
if (item != NULL) {
RygelMediaObject *object;
+ GeeArrayList* uris;
- RYGEL_MEDIA_ITEM (item)->mime_type = g_strdup (content_type);
+ rygel_media_item_set_mime_type (RYGEL_MEDIA_ITEM (item), content_type);
object = RYGEL_MEDIA_OBJECT (item);
gee_collection_add (GEE_COLLECTION (object->uris), uri);
+
rygel_simple_container_add_child_item (root_container, item);
}
diff --git a/src/librygel-server/rygel-http-item-uri.vala b/src/librygel-server/rygel-http-item-uri.vala
index d20aa83..01d6044 100644
--- a/src/librygel-server/rygel-http-item-uri.vala
+++ b/src/librygel-server/rygel-http-item-uri.vala
@@ -26,12 +26,12 @@
using Gee;
internal class Rygel.HTTPItemURI : Object {
- public string item_id;
- public int thumbnail_index;
- public int subtitle_index;
- public string? transcode_target;
- public unowned HTTPServer http_server;
- private string real_extension;
+ public string item_id { get; set; }
+ public int thumbnail_index { get; set; default = -1; }
+ public int subtitle_index { get; set; default = -1; }
+ public string? transcode_target { get; set; default = null; }
+ public unowned HTTPServer http_server { get; set; }
+ private string real_extension { get; set; }
public string extension {
owned get {
if (this.real_extension != "") {
diff --git a/src/librygel-server/rygel-media-item.vala b/src/librygel-server/rygel-media-item.vala
index c031294..bbcd617 100644
--- a/src/librygel-server/rygel-media-item.vala
+++ b/src/librygel-server/rygel-media-item.vala
@@ -35,11 +35,11 @@ private errordomain Rygel.MediaItemError {
* These objects correspond to items in the UPnP ContentDirectory's DIDL-Lite XML.
*/
public abstract class Rygel.MediaItem : MediaObject {
- public string date;
+ public string date { get; set; }
// Resource info
- public string mime_type;
- public string dlna_profile;
+ public string mime_type { get; set; }
+ public string dlna_profile { get; set; }
// Size in bytes
private int64 _size = -1;
diff --git a/src/librygel-server/rygel-media-object.vala b/src/librygel-server/rygel-media-object.vala
index 70249bc..0802a4a 100644
--- a/src/librygel-server/rygel-media-object.vala
+++ b/src/librygel-server/rygel-media-object.vala
@@ -38,22 +38,26 @@ public abstract class Rygel.MediaObject : GLib.Object {
private static Regex user_name_regex;
private static Regex host_name_regex;
- public string id;
- public string ref_id;
- public string upnp_class;
- public uint64 modified;
- public uint object_update_id;
+ public string id { get; set; }
+ public string ref_id { get; set; }
+ public string upnp_class { get; set; }
+ public uint64 modified { get; set; }
+ public uint object_update_id { get; set; }
+
+ //TODO: { get; private set; } or, even better,
+ // add virtual set_uri in Object and make add_uri() in Item into set_uri()
+ // and make the uri property single-value.
public Gee.ArrayList<string> uris;
// You can keep both a unowned and owned ref to parent of this MediaObject.
// In most cases, one will only need to keep an unowned ref to avoid cyclic
- // references since usually parent container will keep refs to child items.
- // However in some cases, one only wants the parent to exist as long as the
- // child exists and it is in those cases, you will want to use 'parent_ref'.
+ // references since usually the parent container will keep refs to child items.
+ // However, in some cases, one only wants the parent to exist as long as the
+ // child exists and it is in those cases that you will want to use 'parent_ref'.
//
// You must set 'parent' if you set 'parent_ref' but the opposite is not
// mandatory.
- public unowned MediaContainer parent;
+ public unowned MediaContainer parent; // TODO: Turn this into a property?
private MediaContainer _parent_ref;
public MediaContainer parent_ref {
get {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]