aboutsummaryrefslogtreecommitdiff
path: root/src/service.vala
diff options
context:
space:
mode:
authorXavi Garcia Mena <xavi.garcia.mena@canonical.com>2016-02-10 14:08:49 +0100
committerXavi Garcia Mena <xavi.garcia.mena@canonical.com>2016-02-10 14:08:49 +0100
commitf1bdb863aea00a03acf9501432e2baa70dd9ee8b (patch)
tree8ab41e0d437047d35464a3c464c33cf037c35438 /src/service.vala
parentd17217847987bc11f139f2676715beb74e0406ff (diff)
downloadayatana-indicator-sound-f1bdb863aea00a03acf9501432e2baa70dd9ee8b.tar.gz
ayatana-indicator-sound-f1bdb863aea00a03acf9501432e2baa70dd9ee8b.tar.bz2
ayatana-indicator-sound-f1bdb863aea00a03acf9501432e2baa70dd9ee8b.zip
Added persistence for last running player
Diffstat (limited to 'src/service.vala')
-rw-r--r--src/service.vala15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/service.vala b/src/service.vala
index 2228ba2..cb30820 100644
--- a/src/service.vala
+++ b/src/service.vala
@@ -91,11 +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");
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));
- 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));
- this.menus.insert ("phone", new SoundMenu ("indicator.phone-settings", SoundMenu.DisplayFlags.SHOW_SILENT_MODE | SoundMenu.DisplayFlags.HIDE_INACTIVE_PLAYERS));
+ 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.@foreach ( (profile, menu) => {
this.volume_control.bind_property ("active-mic", menu, "show-mic-volume", BindingFlags.SYNC_CREATE);
@@ -109,6 +110,12 @@ public class IndicatorSound.Service: Object {
this.volume_control.active_output_changed.connect (menu.update_volume_slider);
});
+ this.menus.@foreach ( (profile, menu) => {
+ menu.last_player_updated.connect ((player_id) => {
+ this.settings.set_value ("last-running-player", player_id);
+ });
+ });
+
this.sync_preferred_players ();
this.settings.changed["interested-media-players"].connect ( () => {
this.sync_preferred_players ();