aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/service.vala4
-rw-r--r--src/volume-warning.vala10
2 files changed, 14 insertions, 0 deletions
diff --git a/src/service.vala b/src/service.vala
index 33008a1..74c3fc5 100644
--- a/src/service.vala
+++ b/src/service.vala
@@ -68,6 +68,10 @@ public class IndicatorSound.Service: Object {
update_notification();
});
+ this._volume_warning.cancel_pressed.connect( (cancel_volume) => {
+ volume_control.set_volume_clamp (cancel_volume, VolumeControl.VolumeReasons.USER_KEYPRESS);
+ });
+
this.accounts_service = accounts;
/* If we're on the greeter, don't export */
if (this.accounts_service != null) {
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);
}