From 9660d0b5c1cee59d7b34e989fc2da19b67167619 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 10 Feb 2014 11:54:07 -0600 Subject: Trying to put together all our account service pieces --- ....canonical.indicator.sound.AccountsService.pkla | 6 ++++ data/CMakeLists.txt | 32 ++++++++++++++++++++++ ...anonical.indicator.sound.AccountsService.policy | 23 ++++++++++++++++ ...m.canonical.indicator.sound.AccountsService.xml | 20 ++++++++++++++ 4 files changed, 81 insertions(+) create mode 100644 data/50-com.canonical.indicator.sound.AccountsService.pkla create mode 100644 data/com.canonical.indicator.sound.AccountsService.policy create mode 100644 data/com.canonical.indicator.sound.AccountsService.xml (limited to 'data') diff --git a/data/50-com.canonical.indicator.sound.AccountsService.pkla b/data/50-com.canonical.indicator.sound.AccountsService.pkla new file mode 100644 index 0000000..bbcca1e --- /dev/null +++ b/data/50-com.canonical.indicator.sound.AccountsService.pkla @@ -0,0 +1,6 @@ +[Allow LightDM to set Unity AccountsService fields] +Identity=unix-user:lightdm +Action=com.canonical.indicator.sound.AccountsService.ModifyAnyUser +ResultActive=yes +ResultInactive=yes +ResultAny=yes diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt index 565e652..9694a9e 100644 --- a/data/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -61,3 +61,35 @@ install( ########################### add_schema ("com.canonical.indicator.sound.gschema.xml") + +########################### +# Accounts Service +########################### + + +set(POLKIT_LIB_DIR "${CMAKE_INSTALL_LOCALSTATEDIR}/lib/polkit-1") +set(POLKIT_DATA_DIR "${CMAKE_INSTALL_PREFIX}/share/polkit-1") +set(DBUS_IFACE_DIR "${CMAKE_INSTALL_PREFIX}/share/dbus-1/interfaces") +set(ACCOUNTS_IFACE_DIR "${CMAKE_INSTALL_PREFIX}/share/accountsservice/interfaces") + +install(FILES com.canonical.indicator.sound.AccountsService.xml + DESTINATION "${DBUS_IFACE_DIR}" +) + +# Create accountsservice symlink for above dbus interface +install(CODE " + execute_process(COMMAND mkdir -p \"\$ENV{DESTDIR}${ACCOUNTS_IFACE_DIR}\") + execute_process(COMMAND ln -sf ../../dbus-1/interfaces/com.canonical.indicator.sound.AccountsService.xml \"\$ENV{DESTDIR}${ACCOUNTS_IFACE_DIR}\") +") + +install(FILES com.canonical.indicator.sound.AccountsService.policy +DESTINATION "${POLKIT_DATA_DIR}/actions" +) + +install(FILES 50-com.canonical.indicator.sound.AccountsService.pkla +DESTINATION "${POLKIT_LIB_DIR}/localauthority/10-vendor.d" +) + + + + diff --git a/data/com.canonical.indicator.sound.AccountsService.policy b/data/com.canonical.indicator.sound.AccountsService.policy new file mode 100644 index 0000000..4d0ee75 --- /dev/null +++ b/data/com.canonical.indicator.sound.AccountsService.policy @@ -0,0 +1,23 @@ + + + + + Set properties of own user + Authentication is required to set one's own indicator sound properties. + + yes + yes + yes + + + + + Set properties of any user + Authentication is required to set another user's indicator sound properties. + + no + no + no + + + diff --git a/data/com.canonical.indicator.sound.AccountsService.xml b/data/com.canonical.indicator.sound.AccountsService.xml new file mode 100644 index 0000000..bb73efd --- /dev/null +++ b/data/com.canonical.indicator.sound.AccountsService.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + -- cgit v1.2.3 From 28e3a8eff7e1305c93c5c7b8283bb7aedfce56b2 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 11 Feb 2014 17:33:42 -0600 Subject: All the properties we need --- ...m.canonical.indicator.sound.AccountsService.xml | 23 +++++++++- src/accounts-service-user.vala | 53 ++++++++++++++++++---- 2 files changed, 64 insertions(+), 12 deletions(-) (limited to 'data') 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 @@ - - + + + + + + + + + + + + + + + + + + + + + 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); } } - - - - - - - - - } -- cgit v1.2.3 From 6974a81bd969f97fb685ea021af4d1406fa13679 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 21 Feb 2014 12:11:02 -0600 Subject: Make sure to timestamp our updates --- data/com.canonical.indicator.sound.AccountsService.xml | 3 +++ src/accounts-service-user.vala | 3 +++ 2 files changed, 6 insertions(+) (limited to 'data') diff --git a/data/com.canonical.indicator.sound.AccountsService.xml b/data/com.canonical.indicator.sound.AccountsService.xml index 1651a43..fb7e96f 100644 --- a/data/com.canonical.indicator.sound.AccountsService.xml +++ b/data/com.canonical.indicator.sound.AccountsService.xml @@ -12,6 +12,9 @@ + + + diff --git a/src/accounts-service-user.vala b/src/accounts-service-user.vala index 19ca774..2062dc8 100644 --- a/src/accounts-service-user.vala +++ b/src/accounts-service-user.vala @@ -20,6 +20,7 @@ [DBus (name = "com.canonical.indicator.sound.AccountsService")] public interface AccountsServiceSoundSettings : Object { // properties + public abstract uint64 timestamp {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;} @@ -47,7 +48,9 @@ public class AccountsServiceUser : Object { if (this._player == null) { /* Clear it */ this.proxy.player_name = ""; + this.proxy.timestamp = 0; } else { + this.proxy.timestamp = GLib.get_monotonic_time(); this.proxy.player_name = this._player.name; if (this._player.icon == null) { var icon = new ThemedIcon.with_default_fallbacks ("application-default-icon"); -- cgit v1.2.3 From bef0abe544ecbb9e020b7d9f99255acefa5073ed Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 19 Mar 2014 16:00:43 -0500 Subject: Adding a setting for greeter exporting --- data/com.canonical.indicator.sound.gschema.xml | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'data') diff --git a/data/com.canonical.indicator.sound.gschema.xml b/data/com.canonical.indicator.sound.gschema.xml index 102a1db..c34dfd6 100644 --- a/data/com.canonical.indicator.sound.gschema.xml +++ b/data/com.canonical.indicator.sound.gschema.xml @@ -48,5 +48,14 @@ Whether or not to show the sound indicator in the menu bar. + + true + Whether or not to export the currently playing song to the greeter. + + If enabled the sound indicator will export the current player and + song to the greeter so that it can be shown if the user is selected + and the sound menu is shown. + + -- cgit v1.2.3