From ba4e4b3973a00902ff0f3d9eb4650f5f61e76c78 Mon Sep 17 00:00:00 2001 From: Xavi Garcia Mena Date: Mon, 22 Feb 2016 19:50:55 +0100 Subject: Changed last running player to user Accounts service --- src/service.vala | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src/service.vala') 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 (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); }); }); -- cgit v1.2.3 From 957c495207b8c53ffa9d3622c24fdff4f31cebfa Mon Sep 17 00:00:00 2001 From: Xavi Garcia Mena Date: Tue, 23 Feb 2016 10:07:50 +0100 Subject: added integration test to check last running player --- src/service.vala | 1 - 1 file changed, 1 deletion(-) (limited to 'src/service.vala') diff --git a/src/service.vala b/src/service.vala index d55a3c8..d72f16e 100644 --- a/src/service.vala +++ b/src/service.vala @@ -91,7 +91,6 @@ public class IndicatorSound.Service: Object { this.actions.add_action (this.create_high_volume_action ()); this.actions.add_action (this.create_volume_sync_action ()); - // OLD string last_player = this.settings.get_string ("last-running-player"); this.menus = new HashTable (str_hash, str_equal); 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)); -- cgit v1.2.3 From e40da89a473b15b64d036cdce2e1ead59770778b Mon Sep 17 00:00:00 2001 From: Xavi Garcia Mena Date: Tue, 23 Feb 2016 13:48:46 +0100 Subject: Created new class AccountsServiceAccess to hold all accounts service operations --- src/service.vala | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/service.vala') diff --git a/src/service.vala b/src/service.vala index d72f16e..2a50b53 100644 --- a/src/service.vala +++ b/src/service.vala @@ -20,7 +20,9 @@ public class IndicatorSound.Service: Object { DBusConnection bus; - public Service (MediaPlayerList playerlist, VolumeControl volume, AccountsServiceUser? accounts, Options options, VolumeWarning volume_warning) { + public Service (MediaPlayerList playerlist, VolumeControl volume, AccountsServiceUser? accounts, Options options, VolumeWarning volume_warning, AccountsServiceAccess? accounts_service_access) { + + _accounts_service_access = accounts_service_access; try { bus = Bus.get_sync(GLib.BusType.SESSION); @@ -111,13 +113,13 @@ public class IndicatorSound.Service: Object { this.menus.@foreach ( (profile, menu) => { menu.last_player_updated.connect ((player_id) => { - this.volume_control.last_running_player = player_id; + this._accounts_service_access.last_running_player = player_id; }); }); - this.volume_control.notify["last-running-player"].connect(() => { + this._accounts_service_access.notify["last-running-player"].connect(() => { this.menus.@foreach ( (profile, menu) => { - menu.set_default_player (this.volume_control.last_running_player); + menu.set_default_player (this._accounts_service_access.last_running_player); }); }); @@ -204,6 +206,7 @@ public class IndicatorSound.Service: Object { private Options _options; private VolumeWarning _volume_warning; private IndicatorSound.InfoNotification _info_notification = new IndicatorSound.InfoNotification(); + private AccountsServiceAccess _accounts_service_access; const double volume_step_percentage = 0.06; -- cgit v1.2.3 From 7604867025faaf3b015193ca89454b72d981bd58 Mon Sep 17 00:00:00 2001 From: Xavi Garcia Mena Date: Wed, 2 Mar 2016 14:50:43 +0100 Subject: Changed following Charles's suggestions --- src/service.vala | 1 - 1 file changed, 1 deletion(-) (limited to 'src/service.vala') diff --git a/src/service.vala b/src/service.vala index 2a50b53..bdc4d40 100644 --- a/src/service.vala +++ b/src/service.vala @@ -62,7 +62,6 @@ public class IndicatorSound.Service: Object { headphones = false; break; } - message("setting _volume_warning.headphones_active to %d", (int)headphones); _volume_warning.headphones_active = headphones; update_root_icon(); -- cgit v1.2.3