aboutsummaryrefslogtreecommitdiff
path: root/src/service.vala
diff options
context:
space:
mode:
authorXavi Garcia Mena <xavi.garcia.mena@canonical.com>2016-02-22 19:50:55 +0100
committerXavi Garcia Mena <xavi.garcia.mena@canonical.com>2016-02-22 19:50:55 +0100
commitba4e4b3973a00902ff0f3d9eb4650f5f61e76c78 (patch)
tree80521ced842b9c1c8b765c56ee9e08eb7916a8c8 /src/service.vala
parentde4abb7448d329f7e7c20e01f8b14f22627a69a3 (diff)
downloadayatana-indicator-sound-ba4e4b3973a00902ff0f3d9eb4650f5f61e76c78.tar.gz
ayatana-indicator-sound-ba4e4b3973a00902ff0f3d9eb4650f5f61e76c78.tar.bz2
ayatana-indicator-sound-ba4e4b3973a00902ff0f3d9eb4650f5f61e76c78.zip
Changed last running player to user Accounts service
Diffstat (limited to 'src/service.vala')
-rw-r--r--src/service.vala18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/service.vala b/src/service.vala
index cb30820..d55a3c8 100644
--- a/src/service.vala
+++ b/src/service.vala
@@ -91,12 +91,12 @@ public class IndicatorSound.Service: Object {
this.actions.add_action (this.create_high_volume_action ());
this.actions.add_action (this.create_volume_sync_action ());
- string last_player = this.settings.get_string ("last-running-player");
+ // OLD string last_player = this.settings.get_string ("last-running-player");
this.menus = new HashTable<string, SoundMenu> (str_hash, str_equal);
- this.menus.insert ("desktop_greeter", new SoundMenu (null, SoundMenu.DisplayFlags.SHOW_MUTE | SoundMenu.DisplayFlags.HIDE_PLAYERS | SoundMenu.DisplayFlags.GREETER_PLAYERS, last_player));
- this.menus.insert ("phone_greeter", new SoundMenu (null, SoundMenu.DisplayFlags.SHOW_SILENT_MODE | SoundMenu.DisplayFlags.HIDE_INACTIVE_PLAYERS | SoundMenu.DisplayFlags.GREETER_PLAYERS, last_player));
- this.menus.insert ("desktop", new SoundMenu ("indicator.desktop-settings", SoundMenu.DisplayFlags.SHOW_MUTE | SoundMenu.DisplayFlags.HIDE_INACTIVE_PLAYERS_PLAY_CONTROLS | SoundMenu.DisplayFlags.ADD_PLAY_CONTROL_INACTIVE_PLAYER, last_player));
- this.menus.insert ("phone", new SoundMenu ("indicator.phone-settings", SoundMenu.DisplayFlags.SHOW_SILENT_MODE | SoundMenu.DisplayFlags.HIDE_INACTIVE_PLAYERS, last_player));
+ this.menus.insert ("desktop_greeter", new SoundMenu (null, SoundMenu.DisplayFlags.SHOW_MUTE | SoundMenu.DisplayFlags.HIDE_PLAYERS | SoundMenu.DisplayFlags.GREETER_PLAYERS));
+ this.menus.insert ("phone_greeter", new SoundMenu (null, SoundMenu.DisplayFlags.SHOW_SILENT_MODE | SoundMenu.DisplayFlags.HIDE_INACTIVE_PLAYERS | SoundMenu.DisplayFlags.GREETER_PLAYERS));
+ this.menus.insert ("desktop", new SoundMenu ("indicator.desktop-settings", SoundMenu.DisplayFlags.SHOW_MUTE | SoundMenu.DisplayFlags.HIDE_INACTIVE_PLAYERS_PLAY_CONTROLS | SoundMenu.DisplayFlags.ADD_PLAY_CONTROL_INACTIVE_PLAYER));
+ this.menus.insert ("phone", new SoundMenu ("indicator.phone-settings", SoundMenu.DisplayFlags.SHOW_SILENT_MODE | SoundMenu.DisplayFlags.HIDE_INACTIVE_PLAYERS));
this.menus.@foreach ( (profile, menu) => {
this.volume_control.bind_property ("active-mic", menu, "show-mic-volume", BindingFlags.SYNC_CREATE);
@@ -112,7 +112,13 @@ public class IndicatorSound.Service: Object {
this.menus.@foreach ( (profile, menu) => {
menu.last_player_updated.connect ((player_id) => {
- this.settings.set_value ("last-running-player", player_id);
+ this.volume_control.last_running_player = player_id;
+ });
+ });
+
+ this.volume_control.notify["last-running-player"].connect(() => {
+ this.menus.@foreach ( (profile, menu) => {
+ menu.set_default_player (this.volume_control.last_running_player);
});
});