From 2ad60576f3975fab265bd44751c9af634f51a375 Mon Sep 17 00:00:00 2001 From: Lars Uebernickel Date: Sun, 16 Mar 2014 17:43:06 +0100 Subject: Show a red icon in the panel when a sound is playing while mute is on --- src/service.vala | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'src/service.vala') diff --git a/src/service.vala b/src/service.vala index 2b21275..66bb42f 100644 --- a/src/service.vala +++ b/src/service.vala @@ -113,6 +113,8 @@ public class IndicatorSound.Service: Object { VolumeControl volume_control; MediaPlayerList players; uint player_action_update_id; + bool mute_blocks_sound; + uint sound_was_blocked_timeout_id; Notify.Notification notification; bool syncing_preferred_players = false; @@ -186,7 +188,7 @@ public class IndicatorSound.Service: Object { double volume = this.volume_control.get_volume (); string icon; if (this.volume_control.mute) - icon = "audio-volume-muted-panel"; + icon = this.mute_blocks_sound ? "audio-volume-muted-blocked-panel" : "audio-volume-muted-panel"; else if (volume <= 0.0) icon = "audio-volume-low-zero-panel"; else if (volume <= 0.3) @@ -229,6 +231,31 @@ public class IndicatorSound.Service: Object { this.update_root_icon (); }); + this.volume_control.notify["is-playing"].connect( () => { + if (!this.volume_control.mute) { + this.mute_blocks_sound = false; + return; + } + + if (this.volume_control.is_playing) { + this.mute_blocks_sound = true; + } + else if (this.mute_blocks_sound) { + /* Continue to show the blocking icon five seconds after a player has tried to play something */ + if (this.sound_was_blocked_timeout_id > 0) + Source.remove (this.sound_was_blocked_timeout_id); + + this.sound_was_blocked_timeout_id = Timeout.add_seconds (5, () => { + this.mute_blocks_sound = false; + this.sound_was_blocked_timeout_id = 0; + this.update_root_icon (); + return false; + }); + } + + this.update_root_icon (); + }); + return mute_action; } -- cgit v1.2.3 From 00ff3526be3255b0a942828119761fe0e70c02b5 Mon Sep 17 00:00:00 2001 From: Lars Uebernickel Date: Tue, 18 Mar 2014 09:51:40 +0100 Subject: Scale volume in notifications when allow-amplified-volume is set --- src/service.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/service.vala') diff --git a/src/service.vala b/src/service.vala index 970867f..4c4f6e6 100644 --- a/src/service.vala +++ b/src/service.vala @@ -141,7 +141,7 @@ public class IndicatorSound.Service: Object { icon = "notification-audio-volume-high"; this.notification.update ("indicator-sound", "", icon); - this.notification.set_hint_int32 ("value", ((int32) (100 * v)).clamp (-1, 101)); + this.notification.set_hint_int32 ("value", ((int32) (100 * v / this.max_volume)).clamp (-1, 101)); try { this.notification.show (); } -- cgit v1.2.3 From 67c63fc4d15e239d15a76f22b4b6eadc1654e383 Mon Sep 17 00:00:00 2001 From: Lars Uebernickel Date: Wed, 19 Mar 2014 18:22:09 +0100 Subject: Use audio-volume-mute-blocking-panel instead of *-blocked-panel --- src/service.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/service.vala') diff --git a/src/service.vala b/src/service.vala index 507a39e..2b3c84d 100644 --- a/src/service.vala +++ b/src/service.vala @@ -188,7 +188,7 @@ public class IndicatorSound.Service: Object { double volume = this.volume_control.get_volume (); string icon; if (this.volume_control.mute) - icon = this.mute_blocks_sound ? "audio-volume-muted-blocked-panel" : "audio-volume-muted-panel"; + icon = this.mute_blocks_sound ? "audio-volume-muted-blocking-panel" : "audio-volume-muted-panel"; else if (volume <= 0.0) icon = "audio-volume-low-zero-panel"; else if (volume <= 0.3) -- cgit v1.2.3 From 006c044b3063c905a5c7aa8c31e91a4545acedae Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 20 Mar 2014 11:35:45 -0500 Subject: Connect to the setting for exporting to the greeter to the creation of the accounts service user --- src/service.vala | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'src/service.vala') diff --git a/src/service.vala b/src/service.vala index 6835896..7f4982f 100644 --- a/src/service.vala +++ b/src/service.vala @@ -46,9 +46,9 @@ public class IndicatorSound.Service: Object { this.volume_control.bind_property ("active-mic", menu, "show-mic-volume", BindingFlags.SYNC_CREATE); }); - if (GLib.Environment.get_user_name() != "lightdm") { - accounts_service = new AccountsServiceUser(); - } + /* Setup handling for the greeter-export setting */ + this.settings.changed["greeter-export"].connect( () => this.build_accountsservice() ); + build_accountsservice(); this.sync_preferred_players (); this.settings.changed["interested-media-players"].connect ( () => { @@ -66,6 +66,22 @@ public class IndicatorSound.Service: Object { sharedsettings.bind ("allow-amplified-volume", this, "allow-amplified-volume", SettingsBindFlags.GET); } + void build_accountsservice () { + this.accounts_service = null; + + /* If we're not exporting, don't build anything */ + if (!this.settings.get_boolean("greeter-export")) { + return; + } + + /* If we're on the greeter, don't export */ + if (GLib.Environment.get_user_name() == "lightdm") { + return; + } + + this.accounts_service = new AccountsServiceUser(); + } + public int run () { if (this.loop != null) { warning ("service is already running"); -- cgit v1.2.3