[rygel] gst-renderer: Make use of 'this' and 'using' keywords
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [rygel] gst-renderer: Make use of 'this' and 'using' keywords
- Date: Fri, 23 Oct 2009 17:15:03 +0000 (UTC)
commit d59277bd37743f620455c365145ed348ad689c08
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Wed Oct 14 00:44:33 2009 +0300
gst-renderer: Make use of 'this' and 'using' keywords
.../gst-renderer/rygel-gst-av-transport.vala | 32 ++++++------
src/plugins/gst-renderer/rygel-gst-changelog.vala | 49 ++++++++++----------
.../gst-renderer/rygel-gst-rendering-control.vala | 10 ++--
.../gst-renderer/rygel-gst-video-window.vala | 2 +-
4 files changed, 47 insertions(+), 46 deletions(-)
---
diff --git a/src/plugins/gst-renderer/rygel-gst-av-transport.vala b/src/plugins/gst-renderer/rygel-gst-av-transport.vala
index ba0e3bd..e31dd3e 100644
--- a/src/plugins/gst-renderer/rygel-gst-av-transport.vala
+++ b/src/plugins/gst-renderer/rygel-gst-av-transport.vala
@@ -36,26 +36,26 @@ public class Rygel.GstAVTransport : Service {
private uint _n_tracks = 0;
public uint n_tracks {
get {
- return _n_tracks;
+ return this._n_tracks;
}
set {
- _n_tracks = value;
+ this._n_tracks = value;
- this.changelog.log ("NumberOfTracks", _n_tracks.to_string ());
+ this.changelog.log ("NumberOfTracks", this._n_tracks.to_string ());
}
}
private uint _track = 0;
public uint track {
get {
- return _track;
+ return this._track;
}
set {
- _track = value;
+ this._track = value;
- this.changelog.log ("CurrentTrack", _track.to_string ());
+ this.changelog.log ("CurrentTrack", this._track.to_string ());
}
}
@@ -70,7 +70,7 @@ public class Rygel.GstAVTransport : Service {
}
set {
- _metadata = value;
+ this._metadata = value;
this.changelog.log ("CurrentTrackMetadata", this.metadata);
}
@@ -96,39 +96,39 @@ public class Rygel.GstAVTransport : Service {
private string _status = "OK";
public string status {
get {
- return _status;
+ return this._status;
}
set {
- _status = value;
+ this._status = value;
- this.changelog.log ("TransportStatus", _status);
+ this.changelog.log ("TransportStatus", this._status);
}
}
private string _speed = "1";
public string speed {
get {
- return _speed;
+ return this._speed;
}
set {
- _speed = value;
+ this._speed = value;
- this.changelog.log ("TransportPlaySpeed", _speed);
+ this.changelog.log ("TransportPlaySpeed", this._speed);
}
}
private string _mode = "NORMAL";
public string mode {
get {
- return _mode;
+ return this._mode;
}
set {
- _mode = value;
+ this._mode = value;
- this.changelog.log ("CurrentPlayMode", _mode);
+ this.changelog.log ("CurrentPlayMode", this._mode);
}
}
diff --git a/src/plugins/gst-renderer/rygel-gst-changelog.vala b/src/plugins/gst-renderer/rygel-gst-changelog.vala
index 1f67fe0..71631a8 100644
--- a/src/plugins/gst-renderer/rygel-gst-changelog.vala
+++ b/src/plugins/gst-renderer/rygel-gst-changelog.vala
@@ -23,6 +23,7 @@
*/
using GUPnP;
+using Gee;
// Helper class for building LastChange messages
public class Rygel.GstChangeLog : Object {
@@ -32,47 +33,47 @@ public class Rygel.GstChangeLog : Object {
private StringBuilder str;
- private Gee.HashMap<string, string> hash;
+ private HashMap<string, string> hash;
private uint timeout_id = 0;
public GstChangeLog (Service? service, string service_ns) {
- service = service;
+ this.service = service;
this.service_ns = service_ns;
- str = new StringBuilder ();
- hash = new Gee.HashMap<string, string> ();
+ this.str = new StringBuilder ();
+ this.hash = new HashMap<string, string> ();
}
~GstChangeLog () {
- if (timeout_id != 0) {
- Source.remove (timeout_id);
+ if (this.timeout_id != 0) {
+ Source.remove (this.timeout_id);
}
}
private bool timeout () {
// Emit notification
- service.notify ("LastChange", typeof (string), finish ());
+ this.service.notify ("LastChange", typeof (string), finish ());
debug ("LastChange sent");
// Reset
- hash.clear ();
- str.erase (0, -1);
- timeout_id = 0;
+ this.hash.clear ();
+ this.str.erase (0, -1);
+ this.timeout_id = 0;
return false;
}
private void ensure_timeout () {
// Make sure we have a notification timeout
- if (service != null && timeout_id == 0) {
+ if (this.service != null && this.timeout_id == 0) {
debug ("Setting up timeout for LastChange");
- timeout_id = Timeout.add (200, timeout);
+ this.timeout_id = Timeout.add (200, timeout);
}
}
public void log (string variable, string value) {
debug (@"'%s = %s' logged", variable, value);
- hash.set (variable, "<%s val=\"%s\"/>".printf (variable, value));
+ this.hash.set (variable, "<%s val=\"%s\"/>".printf (variable, value));
ensure_timeout ();
}
@@ -80,23 +81,23 @@ public class Rygel.GstChangeLog : Object {
public void log_with_channel (string variable,
string value,
string channel) {
- hash.set (variable,
- "<%s val=\"%s\" channel=\"%s\"/>".printf (variable,
- value,
- channel));
+ this.hash.set (variable,
+ "<%s val=\"%s\" channel=\"%s\"/>".printf (variable,
+ value,
+ channel));
ensure_timeout ();
}
public string finish () {
- str.append ("<Event xmlns=\"" +
- this.service_ns +
- "\"><InstanceID val=\"0\">");
- foreach (string line in hash.values) {
- str.append (line);
+ this.str.append ("<Event xmlns=\"" +
+ this.service_ns +
+ "\"><InstanceID val=\"0\">");
+ foreach (string line in this.hash.values) {
+ this.str.append (line);
}
- str.append ("</InstanceID></Event>");
+ this.str.append ("</InstanceID></Event>");
- return str.str;
+ return this.str.str;
}
}
diff --git a/src/plugins/gst-renderer/rygel-gst-rendering-control.vala b/src/plugins/gst-renderer/rygel-gst-rendering-control.vala
index b3e5e27..23da583 100644
--- a/src/plugins/gst-renderer/rygel-gst-rendering-control.vala
+++ b/src/plugins/gst-renderer/rygel-gst-rendering-control.vala
@@ -36,11 +36,11 @@ public class Rygel.GstRenderingControl : Service {
private bool _mute = false;
public bool mute {
get {
- return _mute;
+ return this._mute;
}
set {
- _mute = value;
+ this._mute = value;
if (this._mute) {
this.video_window.volume = 0;
@@ -57,11 +57,11 @@ public class Rygel.GstRenderingControl : Service {
private uint _volume = 0;
public uint volume {
get {
- return _volume;
+ return this._volume;
}
set {
- _volume = value;
+ this._volume = value;
if (!this.mute) {
this.video_window.volume = Volume.from_percentage (this.volume);
@@ -100,7 +100,7 @@ public class Rygel.GstRenderingControl : Service {
// Send current state
var log = new GstChangeLog (null, LAST_CHANGE_NS);
- log.log_with_channel ("Mute", mute ? "1" : "0", "Master");
+ log.log_with_channel ("Mute", this.mute ? "1" : "0", "Master");
log.log_with_channel ("Volume", this.volume.to_string (), "Master");
value.init (typeof (string));
diff --git a/src/plugins/gst-renderer/rygel-gst-video-window.vala b/src/plugins/gst-renderer/rygel-gst-video-window.vala
index 54c09f2..9c0ba76 100644
--- a/src/plugins/gst-renderer/rygel-gst-video-window.vala
+++ b/src/plugins/gst-renderer/rygel-gst-video-window.vala
@@ -39,7 +39,7 @@ public class Rygel.GstVideoWindow : GLib.Object {
debug ("Changing playback state to %s..", value);
this._playback_state = value;
- switch (_playback_state) {
+ switch (this._playback_state) {
case "STOPPED":
this.playbin.set_state (State.NULL);
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]