aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2014-02-11 17:33:42 -0600
committerTed Gould <ted@gould.cx>2014-02-11 17:33:42 -0600
commit28e3a8eff7e1305c93c5c7b8283bb7aedfce56b2 (patch)
treea16949b453cc985c0a70a3659a5cf615341e0326
parentb96572e7933c03fdd51529e6dd71e87c72bd062a (diff)
downloadayatana-indicator-sound-28e3a8eff7e1305c93c5c7b8283bb7aedfce56b2.tar.gz
ayatana-indicator-sound-28e3a8eff7e1305c93c5c7b8283bb7aedfce56b2.tar.bz2
ayatana-indicator-sound-28e3a8eff7e1305c93c5c7b8283bb7aedfce56b2.zip
All the properties we need
-rw-r--r--data/com.canonical.indicator.sound.AccountsService.xml23
-rw-r--r--src/accounts-service-user.vala53
2 files changed, 64 insertions, 12 deletions
diff --git a/data/com.canonical.indicator.sound.AccountsService.xml b/data/com.canonical.indicator.sound.AccountsService.xml
index bb73efd..1651a43 100644
--- a/data/com.canonical.indicator.sound.AccountsService.xml
+++ b/data/com.canonical.indicator.sound.AccountsService.xml
@@ -12,8 +12,27 @@
<annotation name="org.freedesktop.Accounts.Authentication.ChangeAny"
value="com.canonical.indicator.sound.AccountsService.ModifyAnyUser"/>
- <property name="playing" type="b" access="readwrite">
- <annotation name="org.freedesktop.Accounts.DefaultValue" value="true"/>
+ <property name="PlayerName" type="s" access="readwrite">
+ <annotation name="org.freedesktop.Accounts.DefaultValue" value=""/>
+ </property>
+ <property name="PlayerIcon" type="v" access="readwrite"/>
+ <property name="Running" type="b" access="readwrite">
+ <annotation name="org.freedesktop.Accounts.DefaultValue" value="false"/>
+ </property>
+ <property name="State" type="s" access="readwrite">
+ <annotation name="org.freedesktop.Accounts.DefaultValue" value=""/>
+ </property>
+ <property name="Title" type="s" access="readwrite">
+ <annotation name="org.freedesktop.Accounts.DefaultValue" value=""/>
+ </property>
+ <property name="Artist" type="s" access="readwrite">
+ <annotation name="org.freedesktop.Accounts.DefaultValue" value=""/>
+ </property>
+ <property name="Album" type="s" access="readwrite">
+ <annotation name="org.freedesktop.Accounts.DefaultValue" value=""/>
+ </property>
+ <property name="ArtUrl" type="s" access="readwrite">
+ <annotation name="org.freedesktop.Accounts.DefaultValue" value=""/>
</property>
</interface>
diff --git a/src/accounts-service-user.vala b/src/accounts-service-user.vala
index c476033..c5465ca 100644
--- a/src/accounts-service-user.vala
+++ b/src/accounts-service-user.vala
@@ -20,7 +20,14 @@
[DBus (name = "com.canonical.indicator.sound.AccountsService")]
public interface AccountsServiceSoundSettings : Object {
// properties
- public abstract bool playing{owned get; set;}
+ public abstract string player_name {owned get; set;}
+ public abstract Variant player_icon {owned get; set;}
+ public abstract bool running {owned get; set;}
+ public abstract string state {owned get; set;}
+ public abstract string title {owned get; set;}
+ public abstract string artist {owned get; set;}
+ public abstract string album {owned get; set;}
+ public abstract string art_url {owned get; set;}
}
public class AccountsServiceUser : Object {
@@ -32,6 +39,38 @@ public class AccountsServiceUser : Object {
public MediaPlayer? player {
set {
this._player = value;
+
+ /* No proxy, no settings to set */
+ if (this.proxy == null)
+ return;
+
+ if (this._player == null) {
+ /* Clear it */
+ this.proxy.player_name = "";
+ } else {
+ this.proxy.player_name = this._player.name;
+ if (this._player.icon == null) {
+ var icon = new ThemedIcon.with_default_fallbacks ("application-default-icon");
+ this.proxy.player_icon = icon.serialize();
+ } else {
+ this.proxy.player_icon = this._player.icon.serialize();
+ }
+
+ this.proxy.running = this._player.is_running;
+ this.proxy.state = this._player.state;
+
+ if (this._player.current_track != null) {
+ this.proxy.title = this._player.current_track.title;
+ this.proxy.artist = this._player.current_track.artist;
+ this.proxy.album = this._player.current_track.album;
+ this.proxy.art_url = this._player.current_track.art_url;
+ } else {
+ this.proxy.title = "";
+ this.proxy.artist = "";
+ this.proxy.album = "";
+ this.proxy.art_url = "";
+ }
+ }
}
get {
return this._player;
@@ -53,7 +92,10 @@ public class AccountsServiceUser : Object {
null,
new_proxy);
});
+ }
+ ~AccountsServiceUser () {
+ this.player = null;
}
void new_proxy (GLib.Object? obj, AsyncResult res) {
@@ -65,13 +107,4 @@ public class AccountsServiceUser : Object {
warning("Unable to get proxy to user sound settings: %s", e.message);
}
}
-
-
-
-
-
-
-
-
-
}