From 03a879f644d27ec45a97caa7681e4428f7b341fd Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 8 Oct 2014 13:40:04 -0500 Subject: Make volume string translatable --- src/volume-control.vala | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/volume-control.vala b/src/volume-control.vala index 5a8bbe2..a4c97b6 100644 --- a/src/volume-control.vala +++ b/src/volume-control.vala @@ -578,13 +578,13 @@ public class VolumeControl : Object public void set_volume (double volume) { if (_volume == 0.0) - _notification.update ("Volume", "", "audio-volume-muted"); + _notification.update (_("Volume"), "", "audio-volume-muted"); if (_volume > 0.0 && _volume <= 0.33) - _notification.update ("Volume", "", "audio-volume-low"); + _notification.update (_("Volume"), "", "audio-volume-low"); if (_volume > 0.33 && _volume <= 0.66) - _notification.update ("Volume", "", "audio-volume-medium"); + _notification.update (_("Volume"), "", "audio-volume-medium"); if (_volume > 0.66 && _volume <= 1.0) - _notification.update ("Volume", "", "audio-volume-high"); + _notification.update (_("Volume"), "", "audio-volume-high"); _notification.set_hint ("value", _volume * 100.0); _notification.set_hint ("sound-file", "/usr/share/sounds/ubuntu/stereo/message.ogg"); _notification.show (); -- cgit v1.2.3 From 27e2a3618ac09e9ca3dbbc30ed4d8ebec71feba9 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 9 Oct 2014 09:47:01 -0500 Subject: No audio ping if we're doing multimedia, and no notification if we're not on phone --- src/volume-control.vala | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/volume-control.vala b/src/volume-control.vala index a4c97b6..17367e8 100644 --- a/src/volume-control.vala +++ b/src/volume-control.vala @@ -577,17 +577,22 @@ public class VolumeControl : Object public void set_volume (double volume) { - if (_volume == 0.0) - _notification.update (_("Volume"), "", "audio-volume-muted"); - if (_volume > 0.0 && _volume <= 0.33) - _notification.update (_("Volume"), "", "audio-volume-low"); - if (_volume > 0.33 && _volume <= 0.66) - _notification.update (_("Volume"), "", "audio-volume-medium"); - if (_volume > 0.66 && _volume <= 1.0) - _notification.update (_("Volume"), "", "audio-volume-high"); - _notification.set_hint ("value", _volume * 100.0); - _notification.set_hint ("sound-file", "/usr/share/sounds/ubuntu/stereo/message.ogg"); - _notification.show (); + /* Using this to detect whether we're on the phone or not */ + if (_pulse_use_stream_restore) { + if (_volume == 0.0) + _notification.update (_("Volume"), "", "audio-volume-muted"); + if (_volume > 0.0 && _volume <= 0.33) + _notification.update (_("Volume"), "", "audio-volume-low"); + if (_volume > 0.33 && _volume <= 0.66) + _notification.update (_("Volume"), "", "audio-volume-medium"); + if (_volume > 0.66 && _volume <= 1.0) + _notification.update (_("Volume"), "", "audio-volume-high"); + _notification.set_hint ("value", _volume * 100.0); + if (_active_sink_input == -1 || _valid_roles[_active_sink_input] != "multimedia") + /* No audio ping if we're playing multimedia */ + _notification.set_hint ("sound-file", "/usr/share/sounds/ubuntu/stereo/message.ogg"); + _notification.show (); + } if (set_volume_internal (volume)) { start_local_volume_timer(); -- cgit v1.2.3 From d10cf747faeebb0b363fe80666c82cf659a116ab Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 9 Oct 2014 09:52:40 -0500 Subject: Adding a notifications test case --- tests/manual | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/manual b/tests/manual index 201465c..d9fb7d5 100644 --- a/tests/manual +++ b/tests/manual @@ -22,3 +22,20 @@ Test-case indicator-sound/unity8-items-check
The menu is populated with items
+Test-case indicator-sound/unity8-sound-notifications +
+
Adjust volume using HW keys if available
+
A notification bubble should appear with the sound volume
+
An audibule sound should play at the level of the audio
+
Adjust volume with slider in sound indicator
+
A notification bubble should appear with the sound volume
+
An audibule sound should play at the level of the audio
+
Open a video with sound and play in media player
+
The video should play and the sound should be audible
+
Adjust volume using HW keys if available
+
A notification bubble should appear with the sound volume
+
No notification sound should be heard
+
Adjust volume with slider in sound indicator
+
A notification bubble should appear with the sound volume
+
No notification sound should be heard
+
-- cgit v1.2.3 From 7df37f358ee186e95362c88e9013f7f079d2c8ae Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 9 Oct 2014 11:18:21 -0500 Subject: Test plan test for the greeter mode --- tests/manual | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/manual b/tests/manual index 201465c..039eead 100644 --- a/tests/manual +++ b/tests/manual @@ -22,3 +22,29 @@ Test-case indicator-sound/unity8-items-check
The menu is populated with items
+Test-case indicator-sound/unity8-embedded-greeter +
+
NOTE: Only works with embedded greeter, split greeter will require modifications to this test
+
Ensure System Settings is set to "Show Messages on Greeter"
+
Play a song in the media player
+
The song should be heard
+
There should be an entry in the sound menu with the meta data for the song being played
+
Go to the greeter. This can be done by hitting the lock button twice.
+
Ensure the sound menu has song meta data
+
There should be an entry in the sound menu with the meta data for the song being played
+
Pause the song in the greeter
+
The song should stop playing
+
Resume the song in the greeter
+
The song should continue to play
+
Disable System Settings value "Show Messages on Greeter"
+
Ensure the sound menu has song meta data
+
There should be an entry in the sound menu with the meta data for the song being played
+
Go to the greeter. This can be done by hitting the lock button twice.
+
Ensure the sound menu does not have song meta data
+
There should be an entry for the player but it should have no information on the song being played
+
Pause the song in the greeter
+
The song should stop playing
+
Resume the song in the greeter
+
The song should continue to play
+
+ -- cgit v1.2.3 From 228153f72649485111052f5f13a84fd73f290b94 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 9 Oct 2014 21:52:03 -0500 Subject: Make sure to clear the sound hint --- src/volume-control.vala | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/volume-control.vala b/src/volume-control.vala index 17367e8..86b976e 100644 --- a/src/volume-control.vala +++ b/src/volume-control.vala @@ -588,9 +588,12 @@ public class VolumeControl : Object if (_volume > 0.66 && _volume <= 1.0) _notification.update (_("Volume"), "", "audio-volume-high"); _notification.set_hint ("value", _volume * 100.0); - if (_active_sink_input == -1 || _valid_roles[_active_sink_input] != "multimedia") + if (_active_sink_input == -1 || _valid_roles[_active_sink_input] != "multimedia") { /* No audio ping if we're playing multimedia */ _notification.set_hint ("sound-file", "/usr/share/sounds/ubuntu/stereo/message.ogg"); + } else { + _notification.set_hint ("sound-file", null); + } _notification.show (); } -- cgit v1.2.3 From 365f0a5af2b6327531f49a0fa3754359063dfea1 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 9 Oct 2014 21:54:40 -0500 Subject: Catch the error that show can throw and present a warning --- src/volume-control.vala | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/volume-control.vala b/src/volume-control.vala index 86b976e..dbc1797 100644 --- a/src/volume-control.vala +++ b/src/volume-control.vala @@ -594,7 +594,12 @@ public class VolumeControl : Object } else { _notification.set_hint ("sound-file", null); } - _notification.show (); + + try { + _notification.show (); + } catch (GLib.Error e) { + warning("Unable to send volume change notification: %s", e.message); + } } if (set_volume_internal (volume)) { -- cgit v1.2.3 From 70601ef284279d6db7b8add3c50cd0350fdfb707 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 9 Oct 2014 21:58:20 -0500 Subject: Make sure to use the passed parameter for the volume. --- src/volume-control.vala | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/volume-control.vala b/src/volume-control.vala index dbc1797..e35b3e5 100644 --- a/src/volume-control.vala +++ b/src/volume-control.vala @@ -579,15 +579,15 @@ public class VolumeControl : Object { /* Using this to detect whether we're on the phone or not */ if (_pulse_use_stream_restore) { - if (_volume == 0.0) + if (volume == 0.0) _notification.update (_("Volume"), "", "audio-volume-muted"); - if (_volume > 0.0 && _volume <= 0.33) + if (volume > 0.0 && volume <= 0.33) _notification.update (_("Volume"), "", "audio-volume-low"); - if (_volume > 0.33 && _volume <= 0.66) + if (volume > 0.33 && volume <= 0.66) _notification.update (_("Volume"), "", "audio-volume-medium"); - if (_volume > 0.66 && _volume <= 1.0) + if (volume > 0.66 && volume <= 1.0) _notification.update (_("Volume"), "", "audio-volume-high"); - _notification.set_hint ("value", _volume * 100.0); + _notification.set_hint ("value", volume * 100.0); if (_active_sink_input == -1 || _valid_roles[_active_sink_input] != "multimedia") { /* No audio ping if we're playing multimedia */ _notification.set_hint ("sound-file", "/usr/share/sounds/ubuntu/stereo/message.ogg"); -- cgit v1.2.3 From a0dc1f66614ac40bc527ccad537ff607a4bef642 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 9 Oct 2014 22:06:15 -0500 Subject: Didn't make initial string translated --- src/volume-control.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/volume-control.vala b/src/volume-control.vala index e35b3e5..aee670e 100644 --- a/src/volume-control.vala +++ b/src/volume-control.vala @@ -88,7 +88,7 @@ public class VolumeControl : Object _volume_cancellable = new Cancellable (); Notify.init ("Volume"); - _notification = new Notify.Notification("Volume", "", "audio-volume-muted"); + _notification = new Notify.Notification(_("Volume"), "", "audio-volume-muted"); _notification.set_hint ("value", 0); _notification.set_hint ("x-canonical-private-synchronous", "true"); _notification.set_hint ("x-canonical-non-shaped-icon", "true"); -- cgit v1.2.3 From 4da707591f393735ed3306421e2c1518eff4d3e5 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 9 Oct 2014 22:15:35 -0500 Subject: Ensure we send an integer to the notification service --- src/volume-control.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/volume-control.vala b/src/volume-control.vala index aee670e..0541397 100644 --- a/src/volume-control.vala +++ b/src/volume-control.vala @@ -587,7 +587,7 @@ public class VolumeControl : Object _notification.update (_("Volume"), "", "audio-volume-medium"); if (volume > 0.66 && volume <= 1.0) _notification.update (_("Volume"), "", "audio-volume-high"); - _notification.set_hint ("value", volume * 100.0); + _notification.set_hint ("value", (int32)(volume * 100.0)); if (_active_sink_input == -1 || _valid_roles[_active_sink_input] != "multimedia") { /* No audio ping if we're playing multimedia */ _notification.set_hint ("sound-file", "/usr/share/sounds/ubuntu/stereo/message.ogg"); -- cgit v1.2.3 From eaa8592f4a4ad49cd462a04e2d008ce49d5a3206 Mon Sep 17 00:00:00 2001 From: Ricardo Salveti Date: Fri, 10 Oct 2014 10:43:07 -0500 Subject: Integration test for audio roles --- tests/manual | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/manual b/tests/manual index 201465c..2816984 100644 --- a/tests/manual +++ b/tests/manual @@ -22,3 +22,22 @@ Test-case indicator-sound/unity8-items-check
The menu is populated with items
+Test-case indicator-sound/unity8-audio-roles +
+
Without playing anything (no active audio stream), change the volume on the indicator or with the volume buttons and then try playing one of the following audio streams: camera shutter, ringtone, message notification, dtmf
+
The audio stream should reflect the volume set on the indicator
+
Without playing anything (no active audio stream), change the volume on the indicator or with volume buttons and then try playing one of the following audio streams: music-app, webrowser (youtube)
+
The audio stream should not be affected by the volume set on the indicator when there was no other active stream +
Play a multimedia stream (music-app, webrowser) and change the volume on the indicator when the stream is active
+
The multimedia audio stream should reflect the volume set on the indicator
+
When stopping/closing the multimedia stream, it should automatically show up the volume for the alert role (ringtone, notification, etc)
+
No other role should be affected by the volume level used by the multimedia role
+
Play a alarm stream (clock-app) and change the volume on the indicator when the stream is active
+
The alarm audio stream should reflect the volume set on the indicator
+
When stopping/closing the alarm stream, it should automatically show up the volume for the alert role (ringtone, notification, etc)
+
No other role should be affected by the volume level used by the alarm role
+
Start a voice call using the dialer-app and change the volume on the indicator when the call is active
+
The phone audio stream should reflect the volume set on the indicator
+
When hanging up the voice call it should automatically show up the volume for the alert role (ringtone, notification, etc)
+
No other role should be affected by the volume level used by the phone role
+
-- cgit v1.2.3 From f079f5a27a70a377b8787610f1bef62d8af7fe7c Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 10 Oct 2014 12:43:29 -0500 Subject: Make notifications check for high volumes and change based on that --- src/volume-control.vala | 42 +++++++++++++++++++++++++++++++----------- 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/src/volume-control.vala b/src/volume-control.vala index f9db556..0e5abbb 100644 --- a/src/volume-control.vala +++ b/src/volume-control.vala @@ -580,22 +580,42 @@ public class VolumeControl : Object { /* Using this to detect whether we're on the phone or not */ if (_pulse_use_stream_restore) { - if (volume == 0.0) - _notification.update (_("Volume"), "", "audio-volume-muted"); + /* Watch for extreme */ + bool extreme_volume = false; + if (volume > 0.75) /* TODO: Also if headphones */ + extreme_volume = true; + + /* Determine Label */ + string volume_label = _("Volume"); + if (extreme_volume) + volume_label = _("High volume"); + + /* Choose an icon */ + string icon = "audio-volume-muted"; if (volume > 0.0 && volume <= 0.33) - _notification.update (_("Volume"), "", "audio-volume-low"); + icon = "audio-volume-low"; if (volume > 0.33 && volume <= 0.66) - _notification.update (_("Volume"), "", "audio-volume-medium"); + icon = "audio-volume-medium"; if (volume > 0.66 && volume <= 1.0) - _notification.update (_("Volume"), "", "audio-volume-high"); + icon = "audio-volume-high"; + + /* Choose a sound */ + string? sound = null; + if (_active_sink_input == -1 || _valid_roles[_active_sink_input] != "multimedia") + sound = "/usr/share/sounds/ubuntu/stereo/message.ogg"; + + /* Check tint */ + string tint = "false"; + if (extreme_volume) + tint = "true"; + + /* Put it all into the notification */ + _notification.update (volume_label, "", icon); _notification.set_hint ("value", (int32)(volume * 100.0)); - if (_active_sink_input == -1 || _valid_roles[_active_sink_input] != "multimedia") { - /* No audio ping if we're playing multimedia */ - _notification.set_hint ("sound-file", "/usr/share/sounds/ubuntu/stereo/message.ogg"); - } else { - _notification.set_hint ("sound-file", null); - } + _notification.set_hint ("sound-file", sound); + _notification.set_hint ("x-canonical-value-bar-tint", tint); + /* Show it */ try { _notification.show (); } catch (GLib.Error e) { -- cgit v1.2.3 From b6081ca691dc5d7cc41b41837378f8045a8741e8 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 10 Oct 2014 14:16:59 -0500 Subject: Adding in a manual test for the high volume notification --- tests/manual | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/manual b/tests/manual index d9fb7d5..f69cf14 100644 --- a/tests/manual +++ b/tests/manual @@ -39,3 +39,21 @@ Test-case indicator-sound/unity8-sound-notifications
A notification bubble should appear with the sound volume
No notification sound should be heard
+ +Test-case indicator-sound/unity8-high-volume +
+
Plug headphones into the headphone jack
+
Adjust volume so that it is at the midpoint of volume range
+
The slider should be in the middle of the scale
+
Increase the volume once using HW keys if available
+
A notification bubble should appear with the sound volume
+
The text on the notification should read "Volume"
+
Increase the volume using HW keys until it is roughly 90% of the range
+
A notification bubble should appear with the sound volume
+
The text on the notification should read "High volume"
+
The range on the notification bubble should have a different color signifying the higher volume
+
Decrease the volume using HW keys until it is roughly 50% of the range
+
A notification bubble should appear with the sound volume
+
The text on the notification should read "Volume"
+
The range on the notification bubble should have a standard color
+
-- cgit v1.2.3 From 53edccc48b6b1999457aaa4241bfc8eee413f16c Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 10 Oct 2014 16:10:15 -0500 Subject: Turn high volume into a property --- src/volume-control.vala | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/volume-control.vala b/src/volume-control.vala index 0e5abbb..e09f212 100644 --- a/src/volume-control.vala +++ b/src/volume-control.vala @@ -79,6 +79,9 @@ public class VolumeControl : Object /** true when a microphone is active **/ public bool active_mic { get; private set; default = false; } + /** true when high volume warnings should be shown */ + public bool high_volume { get; set; } + public VolumeControl () { if (loop == null) @@ -581,13 +584,14 @@ public class VolumeControl : Object /* Using this to detect whether we're on the phone or not */ if (_pulse_use_stream_restore) { /* Watch for extreme */ - bool extreme_volume = false; if (volume > 0.75) /* TODO: Also if headphones */ - extreme_volume = true; + high_volume = true; + else + high_volume = false; /* Determine Label */ string volume_label = _("Volume"); - if (extreme_volume) + if (high_volume) volume_label = _("High volume"); /* Choose an icon */ @@ -606,7 +610,7 @@ public class VolumeControl : Object /* Check tint */ string tint = "false"; - if (extreme_volume) + if (high_volume) tint = "true"; /* Put it all into the notification */ -- cgit v1.2.3 -- cgit v1.2.3 From 88956a3657cc0f0f8f76b2935a7ae46033d5c200 Mon Sep 17 00:00:00 2001 From: Ricardo Salveti Date: Mon, 13 Oct 2014 20:48:06 -0500 Subject: Headphone detection --- src/volume-control.vala | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/volume-control.vala b/src/volume-control.vala index e09f212..c9ba42c 100644 --- a/src/volume-control.vala +++ b/src/volume-control.vala @@ -70,6 +70,8 @@ public class VolumeControl : Object private double _account_service_volume = 0.0; private Notify.Notification _notification; + private bool _active_port_headphone = false; + public signal void volume_changed (double v); public signal void mic_volume_changed (double v); @@ -177,6 +179,19 @@ public class VolumeControl : Object this.notify_property ("is-playing"); } + /* Check if the current active port is headset/headphone */ + /* There is not easy way to check if the port is a headset/headphone besides + * checking for the port name. On touch (with the pulseaudio droid element) + * the headset/headphone port is called 'output-headset' and 'output-headphone'. + * On the desktop this is usually called 'analog-output-headphones' */ + if (i.active_port.name == "output-wired_headset" || + i.active_port.name == "output-wired_headphone" || + i.active_port.name == "analog-output-headphones") { + _active_port_headphone = true; + } else { + _active_port_headphone = false; + } + if (_pulse_use_stream_restore == false && _volume != volume_to_double (i.volume.max ())) { -- cgit v1.2.3 From 9c8f845b511cf8a8a02cb90df5546ff852978ed6 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 13 Oct 2014 20:49:19 -0500 Subject: Use the headphone detection --- src/volume-control.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/volume-control.vala b/src/volume-control.vala index c9ba42c..b32146f 100644 --- a/src/volume-control.vala +++ b/src/volume-control.vala @@ -599,7 +599,7 @@ public class VolumeControl : Object /* Using this to detect whether we're on the phone or not */ if (_pulse_use_stream_restore) { /* Watch for extreme */ - if (volume > 0.75) /* TODO: Also if headphones */ + if (volume > 0.75 && _active_port_headphone) high_volume = true; else high_volume = false; -- cgit v1.2.3 From 7ec3795022cbfff0e1c0c094309a4b67d1dd3b04 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 13 Oct 2014 20:51:07 -0500 Subject: Create actions based on the high volume status --- src/service.vala | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/service.vala b/src/service.vala index 2a65492..92523aa 100644 --- a/src/service.vala +++ b/src/service.vala @@ -49,6 +49,7 @@ public class IndicatorSound.Service: Object { this.actions.add_action (this.create_mute_action ()); this.actions.add_action (this.create_volume_action ()); this.actions.add_action (this.create_mic_volume_action ()); + this.actions.add_action (this.create_high_volume_actions ()); 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)); @@ -388,6 +389,36 @@ public class IndicatorSound.Service: Object { return volume_action; } + Action create_high_volume_actions () { + var high_volume_action = new SimpleAction.stateful("high-volume", null, new Variant.boolean (this.volume_control.high_volume)); + + this.volume_control.notify["high_volume"].connect( () => + high_volume_action.set_state(new Variant.boolean (this.volume_control.high_volume))); + + /* So this is a bit confusing, putting it here because everywhere else + sucks too. It might create an action and put it into the action group. + Which is sneaky. Better to have the code not duplicated, but no good + place to put code like that. */ + setup_high_volume_menu_action(); + + return high_volume_action; + } + + void setup_high_volume_menu_action () { + this.volume_control.notify["high_volume"].connect(update_high_volume_menu_action); + update_high_volume_menu_action(); + } + + void update_high_volume_menu_action () { + if (this.volume_control.high_volume) { + var menu_action = new SimpleAction("high-volume-menu", null); + menu_action.set_enabled(false); + this.actions.add_action(menu_action); + } else { + this.actions.remove_action("high-volume-menu"); + } + } + void bus_acquired (DBusConnection connection, string name) { try { connection.export_action_group ("/com/canonical/indicator/sound", this.actions); -- cgit v1.2.3 From 9e39fba127c95aee79b26d2b88cb80dc279a5011 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 13 Oct 2014 21:32:30 -0500 Subject: Ensure we reevaluate the high volume warning when we switch from headphones or not --- src/volume-control.vala | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/volume-control.vala b/src/volume-control.vala index b32146f..ea8e3ac 100644 --- a/src/volume-control.vala +++ b/src/volume-control.vala @@ -163,6 +163,8 @@ public class VolumeControl : Object private void sink_info_cb_for_props (Context c, SinkInfo? i, int eol) { + bool old_active_port_headphone = this._active_port_headphone; + if (i == null) return; @@ -197,6 +199,8 @@ public class VolumeControl : Object { _volume = volume_to_double (i.volume.max ()); volume_changed (_volume); + } else if (this._active_port_headphone != old_active_port_headphone) { + volume_changed (_volume); } } -- cgit v1.2.3 From 973b4eb057f466ad88e62d25f733ed1700e1ac38 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 14 Oct 2014 07:59:43 -0500 Subject: Use title for the a11y info and the body for the message on sync notifications --- src/volume-control.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/volume-control.vala b/src/volume-control.vala index ea8e3ac..b65cbc8 100644 --- a/src/volume-control.vala +++ b/src/volume-control.vala @@ -633,7 +633,7 @@ public class VolumeControl : Object tint = "true"; /* Put it all into the notification */ - _notification.update (volume_label, "", icon); + _notification.update (_("Volume"), volume_label, icon); _notification.set_hint ("value", (int32)(volume * 100.0)); _notification.set_hint ("sound-file", sound); _notification.set_hint ("x-canonical-value-bar-tint", tint); -- cgit v1.2.3 From 29576aceb257c868e5871972a1440b8602f2880b Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 14 Oct 2014 08:06:55 -0500 Subject: Adding a high volume warning menu item --- src/sound-menu.vala | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/sound-menu.vala b/src/sound-menu.vala index f245a1f..0094c22 100644 --- a/src/sound-menu.vala +++ b/src/sound-menu.vala @@ -25,7 +25,9 @@ public class SoundMenu: Object HIDE_INACTIVE_PLAYERS = 2, HIDE_PLAYERS = 4, GREETER_PLAYERS = 8, - SHOW_SILENT_MODE = 16 + SHOW_SILENT_MODE = 16, + HIGH_VOLUME_WARNING = 32 /* Everyone should get this eventually, but we don't + want it in the desktop initially because of freezes */ } public SoundMenu (string? settings_action, DisplayFlags flags) { @@ -48,6 +50,9 @@ public class SoundMenu: Object "audio-volume-low-zero-panel", "audio-volume-high-panel")); + if ((flags & DisplayFlags.HIGH_VOLUME_WARNING) != 0) + volume_section.append (_("High volume can damage your hearing."), "indicator.high-volume-menu"); + this.menu = new Menu (); this.menu.append_section (null, volume_section); -- cgit v1.2.3 From a2de8d1b337113ced7854683aad0183a841917f1 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 14 Oct 2014 08:12:58 -0500 Subject: Add high volume warnings to the phone menu --- src/service.vala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/service.vala b/src/service.vala index 92523aa..3edcba0 100644 --- a/src/service.vala +++ b/src/service.vala @@ -53,9 +53,9 @@ public class IndicatorSound.Service: Object { 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)); + this.menus.insert ("phone_greeter", new SoundMenu (null, SoundMenu.DisplayFlags.SHOW_SILENT_MODE | SoundMenu.DisplayFlags.HIDE_INACTIVE_PLAYERS | SoundMenu.DisplayFlags.GREETER_PLAYERS | SoundMenu.DisplayFlags.HIGH_VOLUME_WARNING)); this.menus.insert ("desktop", new SoundMenu ("indicator.desktop-settings", SoundMenu.DisplayFlags.SHOW_MUTE)); - this.menus.insert ("phone", new SoundMenu ("indicator.phone-settings", SoundMenu.DisplayFlags.SHOW_SILENT_MODE | SoundMenu.DisplayFlags.HIDE_INACTIVE_PLAYERS)); + this.menus.insert ("phone", new SoundMenu ("indicator.phone-settings", SoundMenu.DisplayFlags.SHOW_SILENT_MODE | SoundMenu.DisplayFlags.HIDE_INACTIVE_PLAYERS | SoundMenu.DisplayFlags.HIGH_VOLUME_WARNING)); this.menus.@foreach ( (profile, menu) => { this.volume_control.bind_property ("active-mic", menu, "show-mic-volume", BindingFlags.SYNC_CREATE); -- cgit v1.2.3 From 52e2c2d3dce6ded517f9666d5d0412d56054d9d9 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 14 Oct 2014 09:45:40 -0500 Subject: Ensure that we're always getting a vlue in the list --- src/volume-control.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/volume-control.vala b/src/volume-control.vala index b65cbc8..cf2dacf 100644 --- a/src/volume-control.vala +++ b/src/volume-control.vala @@ -624,7 +624,7 @@ public class VolumeControl : Object /* Choose a sound */ string? sound = null; - if (_active_sink_input == -1 || _valid_roles[_active_sink_input] != "multimedia") + if (!((_active_sink_input in _sink_input_list) && (_valid_roles[_active_sink_input] == "multimedia"))) sound = "/usr/share/sounds/ubuntu/stereo/message.ogg"; /* Check tint */ -- cgit v1.2.3 From 23b3fd431a312f2b02504b998c697241c30caa0b Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 14 Oct 2014 10:00:32 -0500 Subject: Drop the high volume menu action as that wasn't working --- src/service.vala | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/src/service.vala b/src/service.vala index 3edcba0..93e6a51 100644 --- a/src/service.vala +++ b/src/service.vala @@ -395,30 +395,9 @@ public class IndicatorSound.Service: Object { this.volume_control.notify["high_volume"].connect( () => high_volume_action.set_state(new Variant.boolean (this.volume_control.high_volume))); - /* So this is a bit confusing, putting it here because everywhere else - sucks too. It might create an action and put it into the action group. - Which is sneaky. Better to have the code not duplicated, but no good - place to put code like that. */ - setup_high_volume_menu_action(); - return high_volume_action; } - void setup_high_volume_menu_action () { - this.volume_control.notify["high_volume"].connect(update_high_volume_menu_action); - update_high_volume_menu_action(); - } - - void update_high_volume_menu_action () { - if (this.volume_control.high_volume) { - var menu_action = new SimpleAction("high-volume-menu", null); - menu_action.set_enabled(false); - this.actions.add_action(menu_action); - } else { - this.actions.remove_action("high-volume-menu"); - } - } - void bus_acquired (DBusConnection connection, string name) { try { connection.export_action_group ("/com/canonical/indicator/sound", this.actions); -- cgit v1.2.3 From 16828d0102efae82bf760097988474e434b884fd Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 14 Oct 2014 10:07:30 -0500 Subject: Changing tact to change the menu when we want to show the warning --- src/service.vala | 4 ++-- src/sound-menu.vala | 27 +++++++++++++++++++++------ 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/service.vala b/src/service.vala index 93e6a51..51060d4 100644 --- a/src/service.vala +++ b/src/service.vala @@ -53,9 +53,9 @@ public class IndicatorSound.Service: Object { 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 | SoundMenu.DisplayFlags.HIGH_VOLUME_WARNING)); + 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)); - this.menus.insert ("phone", new SoundMenu ("indicator.phone-settings", SoundMenu.DisplayFlags.SHOW_SILENT_MODE | SoundMenu.DisplayFlags.HIDE_INACTIVE_PLAYERS | SoundMenu.DisplayFlags.HIGH_VOLUME_WARNING)); + 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); diff --git a/src/sound-menu.vala b/src/sound-menu.vala index 0094c22..e1c4e98 100644 --- a/src/sound-menu.vala +++ b/src/sound-menu.vala @@ -25,9 +25,7 @@ public class SoundMenu: Object HIDE_INACTIVE_PLAYERS = 2, HIDE_PLAYERS = 4, GREETER_PLAYERS = 8, - SHOW_SILENT_MODE = 16, - HIGH_VOLUME_WARNING = 32 /* Everyone should get this eventually, but we don't - want it in the desktop initially because of freezes */ + SHOW_SILENT_MODE = 16 } public SoundMenu (string? settings_action, DisplayFlags flags) { @@ -50,9 +48,6 @@ public class SoundMenu: Object "audio-volume-low-zero-panel", "audio-volume-high-panel")); - if ((flags & DisplayFlags.HIGH_VOLUME_WARNING) != 0) - volume_section.append (_("High volume can damage your hearing."), "indicator.high-volume-menu"); - this.menu = new Menu (); this.menu.append_section (null, volume_section); @@ -98,12 +93,31 @@ public class SoundMenu: Object this.mic_volume_shown = true; } else if (!value && this.mic_volume_shown) { + /* TODO: Make smarter */ this.volume_section.remove (this.volume_section.get_n_items () -1); this.mic_volume_shown = false; } } } + public bool show_high_volume_warning { + get { + return this.high_volume_warning_shown; + } + set { + if (value && !this.high_volume_warning_shown) { + var item = new MenuItem(_("High volume can damage your hearing."), null); + volume_section.append_item (item); + this.high_volume_warning_shown = true; + } + else if (!value && this.high_volume_warning_shown) { + /* TODO: Make smarter */ + this.volume_section.remove (this.volume_section.get_n_items () -1); + this.high_volume_warning_shown = false; + } + } + } + public void add_player (MediaPlayer player) { if (this.notify_handlers.contains (player)) return; @@ -146,6 +160,7 @@ public class SoundMenu: Object Menu volume_section; bool mic_volume_shown; bool settings_shown = false; + bool high_volume_warning_shown = false; bool hide_inactive; bool hide_players = false; HashTable notify_handlers; -- cgit v1.2.3 From 8e7cbaadfed452063b2d659bc679746cad5cbb14 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 14 Oct 2014 10:16:15 -0500 Subject: Linking volume control and the menu visibility --- src/service.vala | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/service.vala b/src/service.vala index 51060d4..8f58110 100644 --- a/src/service.vala +++ b/src/service.vala @@ -61,6 +61,10 @@ public class IndicatorSound.Service: Object { this.volume_control.bind_property ("active-mic", menu, "show-mic-volume", BindingFlags.SYNC_CREATE); }); + this.menus.@foreach ( (profile, menu) => { + this.volume_control.bind_property ("high-volume", menu, "show-high-volume-warning", BindingFlags.SYNC_CREATE); + }); + this.sync_preferred_players (); this.settings.changed["interested-media-players"].connect ( () => { this.sync_preferred_players (); -- cgit v1.2.3 From a3de59a992980727e05c58e052be53a8adc5bf08 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 14 Oct 2014 16:02:23 -0500 Subject: Making the removal of items smarter --- src/sound-menu.vala | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/src/sound-menu.vala b/src/sound-menu.vala index e1c4e98..a9efd74 100644 --- a/src/sound-menu.vala +++ b/src/sound-menu.vala @@ -93,8 +93,10 @@ public class SoundMenu: Object this.mic_volume_shown = true; } else if (!value && this.mic_volume_shown) { - /* TODO: Make smarter */ - this.volume_section.remove (this.volume_section.get_n_items () -1); + int location = -1; + while ((location = find_action(this.volume_section, "indicator.mic-volume")) != -1) { + this.volume_section.remove (location); + } this.mic_volume_shown = false; } } @@ -106,18 +108,35 @@ public class SoundMenu: Object } set { if (value && !this.high_volume_warning_shown) { - var item = new MenuItem(_("High volume can damage your hearing."), null); + /* NOTE: Action doesn't really exist, just used to find below when removing */ + var item = new MenuItem(_("High volume can damage your hearing."), "indicator.high-volume-warning-item"); volume_section.append_item (item); this.high_volume_warning_shown = true; } else if (!value && this.high_volume_warning_shown) { - /* TODO: Make smarter */ + int location = -1; + while ((location = find_action(this.volume_section, "indicator.high-volume-warning-item")) != -1) { + this.volume_section.remove (location); + } this.volume_section.remove (this.volume_section.get_n_items () -1); this.high_volume_warning_shown = false; } } } + int find_action (Menu menu, string in_action) { + int n = menu.get_n_items (); + for (int i = 0; i < n; i++) { + string action; + menu.get_item_attribute (0, "action", "s", out action); + if (in_action == action) + return i; + } + + return -1; + } + + public void add_player (MediaPlayer player) { if (this.notify_handlers.contains (player)) return; -- cgit v1.2.3 From d7fbfc4d0babbcd54a3951f5da721153cc194d9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mirco=20M=C3=BCller?= Date: Tue, 14 Oct 2014 18:27:46 -0500 Subject: Make High-volume text work correctly --- src/volume-control.vala | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/volume-control.vala b/src/volume-control.vala index 8245c50..5a7e66d 100644 --- a/src/volume-control.vala +++ b/src/volume-control.vala @@ -612,7 +612,7 @@ public class VolumeControl : Object high_volume = false; /* Determine Label */ - string volume_label = _("Volume"); + string volume_label = ""; if (high_volume) volume_label = _("High volume"); @@ -636,10 +636,13 @@ public class VolumeControl : Object tint = "true"; /* Put it all into the notification */ + _notification.clear_hints (); _notification.update (_("Volume"), volume_label, icon); _notification.set_hint ("value", (int32)(volume * 100.0)); _notification.set_hint ("sound-file", sound); _notification.set_hint ("x-canonical-value-bar-tint", tint); + _notification.set_hint ("x-canonical-private-synchronous", "true"); + _notification.set_hint ("x-canonical-non-shaped-icon", "true"); /* Show it */ try { -- cgit v1.2.3 From 69b9c090d86e46a0af7e74e68ded1d0f5b4c52cd Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 14 Oct 2014 22:12:13 -0500 Subject: Check more precisely the valid roles --- src/volume-control.vala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/volume-control.vala b/src/volume-control.vala index 5a7e66d..d666708 100644 --- a/src/volume-control.vala +++ b/src/volume-control.vala @@ -627,7 +627,8 @@ public class VolumeControl : Object /* Choose a sound */ string? sound = null; - if (!((_active_sink_input in _sink_input_list) && (_valid_roles[_active_sink_input] == "multimedia"))) + if (!((_active_sink_input >= 0) && (_active_sink_input < _valid_roles.length) + && (_valid_roles[_active_sink_input] == "multimedia"))) sound = "/usr/share/sounds/ubuntu/stereo/message.ogg"; /* Check tint */ -- cgit v1.2.3 From 0414b149396497e4c837a126d1945905ceb2623c Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 14 Oct 2014 23:38:00 -0500 Subject: Get propery property name --- src/service.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/service.vala b/src/service.vala index 8f58110..b4c7c44 100644 --- a/src/service.vala +++ b/src/service.vala @@ -396,7 +396,7 @@ public class IndicatorSound.Service: Object { Action create_high_volume_actions () { var high_volume_action = new SimpleAction.stateful("high-volume", null, new Variant.boolean (this.volume_control.high_volume)); - this.volume_control.notify["high_volume"].connect( () => + this.volume_control.notify["high-volume"].connect( () => high_volume_action.set_state(new Variant.boolean (this.volume_control.high_volume))); return high_volume_action; -- cgit v1.2.3 From abf10def9f86ccbf5e1bc9f32669ef28353983c6 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 15 Oct 2014 08:32:11 -0500 Subject: Remove volume text from manual test --- tests/manual | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/manual b/tests/manual index f69cf14..0df4186 100644 --- a/tests/manual +++ b/tests/manual @@ -47,13 +47,13 @@ Test-case indicator-sound/unity8-high-volume
The slider should be in the middle of the scale
Increase the volume once using HW keys if available
A notification bubble should appear with the sound volume
-
The text on the notification should read "Volume"
+
There should be no text on the notification
Increase the volume using HW keys until it is roughly 90% of the range
A notification bubble should appear with the sound volume
The text on the notification should read "High volume"
The range on the notification bubble should have a different color signifying the higher volume
Decrease the volume using HW keys until it is roughly 50% of the range
A notification bubble should appear with the sound volume
-
The text on the notification should read "Volume"
+
There should be no text on the notification
The range on the notification bubble should have a standard color
-- cgit v1.2.3 From 33998ab08618bb6d513f91b2d49685ede072432b Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 15 Oct 2014 08:35:54 -0500 Subject: Found other notification --- src/service.vala | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/service.vala b/src/service.vala index b4c7c44..d9a2dd3 100644 --- a/src/service.vala +++ b/src/service.vala @@ -179,6 +179,8 @@ public class IndicatorSound.Service: Object { double v = this.volume_control.get_volume () + volume_step_percentage * delta; this.volume_control.set_volume (v.clamp (0.0, this.max_volume)); + /* TODO: Don't want to mess up the desktop today, but we should remove this + scrolling change and merge that into volume control's notification */ if (this.notification != null) { string icon; if (v <= 0.0) -- cgit v1.2.3 From 46c7d4c1cb1a6552ba205beaf233d66dcd4fc8a7 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 15 Oct 2014 08:38:43 -0500 Subject: Make volume icons match the panel icons --- src/volume-control.vala | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/volume-control.vala b/src/volume-control.vala index d666708..f6f54d2 100644 --- a/src/volume-control.vala +++ b/src/volume-control.vala @@ -618,11 +618,13 @@ public class VolumeControl : Object /* Choose an icon */ string icon = "audio-volume-muted"; - if (volume > 0.0 && volume <= 0.33) + if (volume <= 0.0) + icon = "audio-volume-muted"; + else if (volume <= 0.3) icon = "audio-volume-low"; - if (volume > 0.33 && volume <= 0.66) + else if (volume <= 0.7) icon = "audio-volume-medium"; - if (volume > 0.66 && volume <= 1.0) + else icon = "audio-volume-high"; /* Choose a sound */ -- cgit v1.2.3 From 0b6434da43e5a5dd280df9014a182fc51cb05423 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 15 Oct 2014 09:43:24 -0500 Subject: Commenting out the sound for now --- src/volume-control.vala | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/volume-control.vala b/src/volume-control.vala index f6f54d2..6f48c5d 100644 --- a/src/volume-control.vala +++ b/src/volume-control.vala @@ -642,7 +642,10 @@ public class VolumeControl : Object _notification.clear_hints (); _notification.update (_("Volume"), volume_label, icon); _notification.set_hint ("value", (int32)(volume * 100.0)); + /* TODO: Removing sound until we can get all the roles cleaned up for + when to play it. We expect this to come back, but in another landing. _notification.set_hint ("sound-file", sound); + */ _notification.set_hint ("x-canonical-value-bar-tint", tint); _notification.set_hint ("x-canonical-private-synchronous", "true"); _notification.set_hint ("x-canonical-non-shaped-icon", "true"); -- cgit v1.2.3 From ea570316012b87f04d1de7aff11d2bebff670b97 Mon Sep 17 00:00:00 2001 From: CI bot Date: Wed, 15 Oct 2014 16:19:13 +0000 Subject: Releasing 12.10.2+14.10.20141015.5~rtm-0ubuntu1 --- debian/changelog | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/debian/changelog b/debian/changelog index e9e29d1..8d235fe 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +indicator-sound (12.10.2+14.10.20141015.5~rtm-0ubuntu1) 14.09; urgency=low + + [ Ted Gould ] + * Show notifications on volume change (LP: #1378564) + + -- Ubuntu daily release Wed, 15 Oct 2014 16:19:12 +0000 + indicator-sound (12.10.2+14.10.20141010-0ubuntu1) utopic; urgency=low [ Ricardo Salveti de Araujo ] -- cgit v1.2.3 From 5dd9bda0ea449024dbc97e26f92631401048bc57 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 15 Oct 2014 13:24:48 -0500 Subject: Removing the remove code that was supposed to be removed earlier --- src/sound-menu.vala | 1 - 1 file changed, 1 deletion(-) diff --git a/src/sound-menu.vala b/src/sound-menu.vala index a9efd74..05570b9 100644 --- a/src/sound-menu.vala +++ b/src/sound-menu.vala @@ -118,7 +118,6 @@ public class SoundMenu: Object while ((location = find_action(this.volume_section, "indicator.high-volume-warning-item")) != -1) { this.volume_section.remove (location); } - this.volume_section.remove (this.volume_section.get_n_items () -1); this.high_volume_warning_shown = false; } } -- cgit v1.2.3 From 1e193a4b99e62b52fb759d00a8745f1c477d965f Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 15 Oct 2014 13:52:31 -0500 Subject: Make sure to check the item in the loop --- src/sound-menu.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sound-menu.vala b/src/sound-menu.vala index 05570b9..3881faf 100644 --- a/src/sound-menu.vala +++ b/src/sound-menu.vala @@ -127,7 +127,7 @@ public class SoundMenu: Object int n = menu.get_n_items (); for (int i = 0; i < n; i++) { string action; - menu.get_item_attribute (0, "action", "s", out action); + menu.get_item_attribute (i, "action", "s", out action); if (in_action == action) return i; } -- cgit v1.2.3 From 16a72ae6f4c18c621e16e259bc9122cdaf39eb6b Mon Sep 17 00:00:00 2001 From: Lars Uebernickel Date: Thu, 16 Oct 2014 15:07:51 +0200 Subject: service.vala: don't call set_volume unnecessarily The allow-amplified-volume setting is bound to a property on the service with the same name. GSettings always sets the target property when the binding is created. The property setter calls set_volume() unconditionally, which lead to a call on every startup of indicator-sound. That wasn't a problem until set_volume() started emitting a notification for volume changes... Fix this by only updating the property when the underlying value has actually changed. --- src/service.vala | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/service.vala b/src/service.vala index bd44b0d..0a5725a 100644 --- a/src/service.vala +++ b/src/service.vala @@ -139,6 +139,9 @@ public class IndicatorSound.Service: Object { } set { + if (this.allow_amplified_volume == value) + return; + if (value) { /* from pulse/volume.h: #define PA_VOLUME_UI_MAX (pa_sw_volume_from_dB(+11.0)) */ this.max_volume = (double)PulseAudio.Volume.sw_from_dB(11.0) / PulseAudio.Volume.NORM; -- cgit v1.2.3 From 8cfba863c2ce74c326cb31f13f14a1de801e69f2 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 16 Oct 2014 11:12:28 -0500 Subject: No RTM changelog entries in Utopic --- debian/changelog | 7 ------- 1 file changed, 7 deletions(-) diff --git a/debian/changelog b/debian/changelog index e82b0e3..483c78b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,10 +1,3 @@ -indicator-sound (12.10.2+14.10.20141015.5~rtm-0ubuntu1) 14.09; urgency=low - - [ Ted Gould ] - * Show notifications on volume change (LP: #1378564) - - -- Ubuntu daily release Wed, 15 Oct 2014 16:19:12 +0000 - indicator-sound (12.10.2+14.10.20141010-0ubuntu1) utopic; urgency=low [ Ricardo Salveti de Araujo ] -- cgit v1.2.3 From ebf6a44938610ec386e269d5d5538cbb82a73290 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 22 Oct 2014 12:38:46 -0400 Subject: Silent mode test --- tests/manual | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/manual b/tests/manual index 2816984..05993ed 100644 --- a/tests/manual +++ b/tests/manual @@ -22,6 +22,24 @@ Test-case indicator-sound/unity8-items-check
The menu is populated with items
+Test-case indicator-sound/unity8-silent-mode +
+
NOTE: This test currently doesn't work because of a bug:
+
Open the Sound menu
+
The sound menu includes an item "Silent Mode" which is a check box
+
The checkbox is not checked
+
Enable silent mode
+
Selecting the "Silent Mode" item should cause the box to be checked
+
Open the sound panel in system settings
+
The sound panel includes an item "Silent Mode" which is a check box
+
The checkbox is checked
+
Disable silent mode in system settings
+
The checkbox is not checked
+
Open the Sound menu
+
The sound menu includes an item "Silent Mode" which is a check box
+
The checkbox is not checked
+
+ Test-case indicator-sound/unity8-audio-roles
Without playing anything (no active audio stream), change the volume on the indicator or with the volume buttons and then try playing one of the following audio streams: camera shutter, ringtone, message notification, dtmf
-- cgit v1.2.3 From 6e42c539dd125c3a44c82d135df3f0788d974771 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 22 Oct 2014 12:40:07 -0400 Subject: Adding a bug number to the test --- tests/manual | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/manual b/tests/manual index 05993ed..ab18469 100644 --- a/tests/manual +++ b/tests/manual @@ -24,7 +24,7 @@ Test-case indicator-sound/unity8-items-check Test-case indicator-sound/unity8-silent-mode
-
NOTE: This test currently doesn't work because of a bug:
+
NOTE: This test currently doesn't work because of a bug: http://pad.lv/1336715
Open the Sound menu
The sound menu includes an item "Silent Mode" which is a check box
The checkbox is not checked
-- cgit v1.2.3 From 8a25cabee9738ced0da921fcac693495006070af Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 22 Oct 2014 15:52:54 -0400 Subject: Allow for the invalidated properties to be NULL --- src/volume-control.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/volume-control.vala b/src/volume-control.vala index ad186a7..e8d35a4 100644 --- a/src/volume-control.vala +++ b/src/volume-control.vala @@ -689,7 +689,7 @@ public class VolumeControl : Object } /* AccountsService operations */ - private void accountsservice_props_changed_cb (DBusProxy proxy, Variant changed_properties, string[] invalidated_properties) + private void accountsservice_props_changed_cb (DBusProxy proxy, Variant changed_properties, string[]? invalidated_properties) { Variant volume_variant = changed_properties.lookup_value ("Volume", new VariantType ("d")); if (volume_variant != null) { -- cgit v1.2.3 From edf067bcf194607f0f51f0152e3ad5eb6d70d0be Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 22 Oct 2014 15:58:32 -0400 Subject: Setup a try/catch on the getting of properties --- src/volume-control.vala | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/volume-control.vala b/src/volume-control.vala index e8d35a4..5061ae8 100644 --- a/src/volume-control.vala +++ b/src/volume-control.vala @@ -747,10 +747,14 @@ public class VolumeControl : Object // Get current values and listen for changes _user_proxy.g_properties_changed.connect (accountsservice_props_changed_cb); - var props_variant = yield _user_proxy.get_connection ().call (_user_proxy.get_name (), _user_proxy.get_object_path (), "org.freedesktop.DBus.Properties", "GetAll", new Variant ("(s)", _user_proxy.get_interface_name ()), null, DBusCallFlags.NONE, -1); - Variant props; - props_variant.get ("(@a{sv})", out props); - accountsservice_props_changed_cb(_user_proxy, props, null); + try { + var props_variant = yield _user_proxy.get_connection ().call (_user_proxy.get_name (), _user_proxy.get_object_path (), "org.freedesktop.DBus.Properties", "GetAll", new Variant ("(s)", _user_proxy.get_interface_name ()), null, DBusCallFlags.NONE, -1); + Variant props; + props_variant.get ("(@a{sv})", out props); + accountsservice_props_changed_cb(_user_proxy, props, null); + } catch (GLib.Error e) { + debug("Unable to get properties for user %s at first try: %s", username, e.message); + } } private void greeter_user_changed (string username) -- cgit v1.2.3 From 9ab88593b90ee51361c4b4789daf11a2f1d08429 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 22 Oct 2014 16:00:18 -0400 Subject: Remove usage of deprecated hint functions --- src/service.vala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/service.vala b/src/service.vala index 2a65492..4298ad7 100644 --- a/src/service.vala +++ b/src/service.vala @@ -69,7 +69,7 @@ public class IndicatorSound.Service: Object { List caps = Notify.get_server_caps (); if (caps.find_custom ("x-canonical-private-synchronous", strcmp) != null) { this.notification = new Notify.Notification ("indicator-sound", "", ""); - this.notification.set_hint_string ("x-canonical-private-synchronous", "indicator-sound"); + this.notification.set_hint ("x-canonical-private-synchronous", "indicator-sound"); } } @@ -186,7 +186,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 / this.max_volume)).clamp (-1, 101)); + this.notification.set_hint ("value", ((int32) (100 * v / this.max_volume)).clamp (-1, 101)); try { this.notification.show (); } -- cgit v1.2.3 From e03e82a36d5662c80ad61c6758591ae40d551f6b Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 5 Nov 2014 10:46:56 -0600 Subject: Fixing bug number --- debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 3fb71d9..899fa03 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,7 +2,7 @@ indicator-sound (12.10.2+14.10.20141010-0ubuntu8) UNRELEASED; urgency=medium * Remove various Vala warnings * Show notifications on volume change (LP: #1378564, #1378961) - * Warn on high audio levels when using headphones (LP: #123633, #1373404) + * Warn on high audio levels when using headphones (LP: #1232633, #1373404) * service.vala: don't call set_volume unnecessarily (LP: #1381871) * Integration test for audio roles * Integration test for silent mode -- cgit v1.2.3 From 08bcdc3b069c4c5ce7cb2a769daa8573fce5cd5d Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 5 Nov 2014 10:48:22 -0600 Subject: Missed part of a merge --- src/volume-control.vala | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/volume-control.vala b/src/volume-control.vala index 295ebf5..6f22dc5 100644 --- a/src/volume-control.vala +++ b/src/volume-control.vala @@ -604,16 +604,6 @@ public class VolumeControl : Object { /* Using this to detect whether we're on the phone or not */ if (_pulse_use_stream_restore) { -<<<<<<< TREE - if (volume == 0.0) - _notification.update (_("Volume"), "", "audio-volume-muted"); - if (volume > 0.0 && volume <= 0.33) - _notification.update (_("Volume"), "", "audio-volume-low"); - if (volume > 0.33 && volume <= 0.66) - _notification.update (_("Volume"), "", "audio-volume-medium"); - if (volume > 0.66 && volume <= 1.0) - _notification.update (_("Volume"), "", "audio-volume-high"); -======= /* Watch for extreme */ if (volume > 0.75 && _active_port_headphone) high_volume = true; -- cgit v1.2.3