diff options
author | Lars Uebernickel <lars.uebernickel@canonical.com> | 2013-06-17 18:01:43 -0400 |
---|---|---|
committer | Lars Uebernickel <lars.uebernickel@canonical.com> | 2013-06-17 18:01:43 -0400 |
commit | a44eabf4b4972160ead5285a993650a42af0c1bc (patch) | |
tree | 72bcbc486f2093d5941a769e121291a660a23da8 /src/media-player.vala | |
parent | a0fae2ec3183d1d9a651b38d0e2980c029cd7d28 (diff) | |
download | ayatana-indicator-sound-a44eabf4b4972160ead5285a993650a42af0c1bc.tar.gz ayatana-indicator-sound-a44eabf4b4972160ead5285a993650a42af0c1bc.tar.bz2 ayatana-indicator-sound-a44eabf4b4972160ead5285a993650a42af0c1bc.zip |
Change playback action state to "string"
To accomodate for a third state "Launching" (in addition to "Playing" and
"Paused").
Diffstat (limited to 'src/media-player.vala')
-rw-r--r-- | src/media-player.vala | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/src/media-player.vala b/src/media-player.vala index b767268..5b59efb 100644 --- a/src/media-player.vala +++ b/src/media-player.vala @@ -66,18 +66,7 @@ public class MediaPlayer: Object { } public string state { - get { - if (this.proxy != null && this.proxy.PlaybackStatus == "Playing") - return "Playing"; - else - return "Paused"; - } - } - - public bool is_playing { - get { - return this.proxy != null && this.proxy.PlaybackStatus == "Playing"; - } + get; private set; default = "Paused"; } public class Track : Object { @@ -120,6 +109,7 @@ public class MediaPlayer: Object { this.proxy = null; this._dbus_name = null; this.notify_property ("is-running"); + this.state = "Paused"; this.current_track = null; } @@ -136,6 +126,7 @@ public class MediaPlayer: Object { catch (Error e) { warning ("unable to launch %s: %s", appinfo.get_name (), e.message); } + this.state = "Launching"; } /** @@ -176,7 +167,7 @@ public class MediaPlayer: Object { gproxy.g_properties_changed.connect (this.proxy_properties_changed); this.notify_property ("is-running"); - this.notify_property ("state"); + this.state = this.proxy.PlaybackStatus; this.update_current_track (gproxy.get_cached_property ("Metadata")); } catch (Error e) { @@ -201,8 +192,7 @@ public class MediaPlayer: Object { void proxy_properties_changed (DBusProxy proxy, Variant changed_properties, string[] invalidated_properties) { if (changed_properties.lookup ("PlaybackStatus", "s", null)) { - this.notify_property ("state"); - this.notify_property ("is-running"); + this.state = this.proxy.PlaybackStatus; } var metadata = changed_properties.lookup_value ("Metadata", new VariantType ("a{sv}")); |