[rygel] server: Turn some member variables into properties.



commit b970bc79fc33fc60492a8893603951b5c970a927
Author: Murray Cumming <murrayc openismus com>
Date:   Wed Oct 24 10:17:20 2012 +0200

    server: Turn some member variables into properties.
    
    This should partly fix bug #686211

 src/librygel-server/rygel-audio-item.vala          |   10 +++++-----
 src/librygel-server/rygel-music-item.vala          |   10 +++++-----
 src/librygel-server/rygel-photo-item.vala          |    2 +-
 src/librygel-server/rygel-video-item.vala          |    2 +-
 .../media-export/rygel-media-export-item.vala      |   16 +++++++++++++---
 5 files changed, 25 insertions(+), 15 deletions(-)
---
diff --git a/src/librygel-server/rygel-audio-item.vala b/src/librygel-server/rygel-audio-item.vala
index 04f8709..33fec7e 100644
--- a/src/librygel-server/rygel-audio-item.vala
+++ b/src/librygel-server/rygel-audio-item.vala
@@ -30,12 +30,12 @@ using GUPnP;
 public class Rygel.AudioItem : MediaItem {
     public new const string UPNP_CLASS = "object.item.audioItem";
 
-    public long duration = -1;  // Duration in seconds
-    public int bitrate = -1;    // Bytes/second
+    public long duration { get; set; default = -1; }  // Duration in seconds
+    public int bitrate { get; set; default = -1; }    // Bytes/second
 
-    public int sample_freq = -1;
-    public int bits_per_sample = -1;
-    public int channels = -1;
+    public int sample_freq { get; set; default = -1; }
+    public int bits_per_sample { get; set; default = -1; }
+    public int channels { get; set; default = -1; }
 
     public AudioItem (string         id,
                       MediaContainer parent,
diff --git a/src/librygel-server/rygel-music-item.vala b/src/librygel-server/rygel-music-item.vala
index 48e4bf8..07f3562 100644
--- a/src/librygel-server/rygel-music-item.vala
+++ b/src/librygel-server/rygel-music-item.vala
@@ -32,12 +32,12 @@ using GUPnP;
 public class Rygel.MusicItem : AudioItem {
     public new const string UPNP_CLASS = "object.item.audioItem.musicTrack";
 
-    public string artist;
-    public string album;
-    public string genre;
-    public int track_number = -1;
+    public string artist { get; set; }
+    public string album { get; set; }
+    public string genre { get; set; }
+    public int track_number { get; set; default = -1; }
 
-    public Thumbnail album_art;
+    public Thumbnail album_art { get; set; }
 
     public MusicItem (string         id,
                       MediaContainer parent,
diff --git a/src/librygel-server/rygel-photo-item.vala b/src/librygel-server/rygel-photo-item.vala
index e2465b0..eab0d98 100644
--- a/src/librygel-server/rygel-photo-item.vala
+++ b/src/librygel-server/rygel-photo-item.vala
@@ -33,7 +33,7 @@ using Gee;
 public class Rygel.PhotoItem : ImageItem {
     public new const string UPNP_CLASS = "object.item.imageItem.photo";
 
-    public string creator;
+    public string creator { get; set; }
 
     public PhotoItem (string         id,
                       MediaContainer parent,
diff --git a/src/librygel-server/rygel-video-item.vala b/src/librygel-server/rygel-video-item.vala
index 7818973..ffcc7b8 100644
--- a/src/librygel-server/rygel-video-item.vala
+++ b/src/librygel-server/rygel-video-item.vala
@@ -33,7 +33,7 @@ using Gee;
 public class Rygel.VideoItem : AudioItem, VisualItem {
     public new const string UPNP_CLASS = "object.item.videoItem";
 
-    public string author;
+    public string author { get; set; }
 
     //TODO: This property documentation is not used.
     //See valadoc bug: https://bugzilla.gnome.org/show_bug.cgi?id=684367
diff --git a/src/plugins/media-export/rygel-media-export-item.vala b/src/plugins/media-export/rygel-media-export-item.vala
index 292c8a8..c8b46e3 100644
--- a/src/plugins/media-export/rygel-media-export-item.vala
+++ b/src/plugins/media-export/rygel-media-export-item.vala
@@ -196,9 +196,19 @@ namespace Rygel.MediaExport.ItemFactory {
                     }
                 }
             }
-            dlna_info.info.get_tags ().get_string (TAG_ARTIST, out item.artist);
-            dlna_info.info.get_tags ().get_string (TAG_ALBUM, out item.album);
-            dlna_info.info.get_tags ().get_string (TAG_GENRE, out item.genre);
+
+            string artist;
+            dlna_info.info.get_tags ().get_string (TAG_ARTIST, out artist);
+            item.artist = artist;
+
+            string album;
+            dlna_info.info.get_tags ().get_string (TAG_ALBUM, out album);
+            item.album = album;
+
+            string genre;
+            dlna_info.info.get_tags ().get_string (TAG_GENRE, out genre);
+            item.genre = genre;
+
             uint tmp;
             dlna_info.info.get_tags ().get_uint (TAG_ALBUM_VOLUME_NUMBER,
                                                  out tmp);



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