diff options
author | Xavi Garcia Mena <xavi.garcia.mena@canonical.com> | 2016-04-15 11:55:49 +0200 |
---|---|---|
committer | Xavi Garcia Mena <xavi.garcia.mena@canonical.com> | 2016-04-15 11:55:49 +0200 |
commit | cae62db5c6ad966fbc68f892c9723b010bcd774a (patch) | |
tree | 0c88c16f4ea26e2303648537212fb7e8a440f8f6 /src/volume-warning.vala | |
parent | 10537be76c7675bf7ade87a62f6be01b5beb3b2f (diff) | |
download | ayatana-indicator-sound-cae62db5c6ad966fbc68f892c9723b010bcd774a.tar.gz ayatana-indicator-sound-cae62db5c6ad966fbc68f892c9723b010bcd774a.tar.bz2 ayatana-indicator-sound-cae62db5c6ad966fbc68f892c9723b010bcd774a.zip |
Added a new signal in volumeWarning to notify when the user has pressed cancel. We use that to set the volume after pressing cancel, as sometimes setting the accounts service volume steps over the warning level
Diffstat (limited to 'src/volume-warning.vala')
-rw-r--r-- | src/volume-warning.vala | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/volume-warning.vala b/src/volume-warning.vala index d43d34c..b1cc518 100644 --- a/src/volume-warning.vala +++ b/src/volume-warning.vala @@ -213,8 +213,18 @@ public abstract class VolumeWarning : Object if (response == IndicatorSound.WarnNotification.Response.OK) { approve_high_volume (); sound_system_set_multimedia_volume (_ok_volume); + } else { + this.cancel_pressed (this.volume_to_double(_options.loud_volume)); } _ok_volume = PulseAudio.Volume.INVALID; } + + private static double volume_to_double (PulseAudio.Volume vol) + { + double tmp = (double)(vol - PulseAudio.Volume.MUTED); + return tmp / (double)(PulseAudio.Volume.NORM - PulseAudio.Volume.MUTED); + } + + public signal void cancel_pressed (double cancel_volume); } |