aboutsummaryrefslogtreecommitdiff
path: root/src/volume-control.vala
diff options
context:
space:
mode:
authorcharles kerr <charlesk@canonical.com>2016-01-13 20:37:55 +0000
committerCI Train Bot <ci-train-bot@canonical.com>2016-01-13 20:37:55 +0000
commite43001712810b56a1579545ecafd9f9826e7a438 (patch)
tree068221198bc1ca78180ac7106d2303cbc4e3079e /src/volume-control.vala
parent9a861c0911ce8345f48909993249c8a74d8bfb2c (diff)
parent9b72c7f662440844bf59521e124f59bcbddec4a5 (diff)
downloadayatana-indicator-sound-e43001712810b56a1579545ecafd9f9826e7a438.tar.gz
ayatana-indicator-sound-e43001712810b56a1579545ecafd9f9826e7a438.tar.bz2
ayatana-indicator-sound-e43001712810b56a1579545ecafd9f9826e7a438.zip
Be more selective about when to show and dismiss the High Volume Warning Dialog. Fixes: #1504065
Approved by: PS Jenkins bot, Xavi Garcia
Diffstat (limited to 'src/volume-control.vala')
-rw-r--r--src/volume-control.vala32
1 files changed, 18 insertions, 14 deletions
diff --git a/src/volume-control.vala b/src/volume-control.vala
index 90fc325..3d02f70 100644
--- a/src/volume-control.vala
+++ b/src/volume-control.vala
@@ -40,36 +40,39 @@ public abstract class VolumeControl : Object
CALL_MODE
}
+ public enum Stream {
+ ALERT,
+ MULTIMEDIA,
+ ALARM,
+ PHONE
+ }
+
public class Volume : Object {
public double volume;
public VolumeReasons reason;
}
- public virtual string stream { get { return ""; } }
- public virtual bool ready { get { return false; } set { } }
+ protected IndicatorSound.Options _options = null;
+
+ public VolumeControl(IndicatorSound.Options options) {
+ _options = options;
+ }
+
+ public Stream active_stream { get; protected set; default = Stream.ALERT; }
+ public bool ready { get; protected set; default = false; }
public virtual bool active_mic { get { return false; } set { } }
- public virtual bool high_volume { get { return false; } protected set { } }
- public virtual bool ignore_high_volume { get { return false; } protected set { } }
- public virtual bool below_warning_volume { get { return false; } protected set { } }
public virtual bool mute { get { return false; } }
- public virtual bool is_playing { get { return false; } }
- public virtual VolumeControl.ActiveOutput active_output { get { return VolumeControl.ActiveOutput.SPEAKERS; } }
+ public bool is_playing { get; protected set; default = false; }
private Volume _volume;
private double _pre_clamp_volume;
public virtual Volume volume { get { return _volume; } set { } }
public virtual double mic_volume { get { return 0.0; } set { } }
- public virtual double max_volume { get { return 1.0; } protected set { } }
-
- public virtual bool high_volume_approved { get { return false; } protected set { } }
- public virtual void approve_high_volume() { }
- public virtual void clamp_to_high_volume() { }
- public virtual void set_warning_volume() { }
public abstract void set_mute (bool mute);
public void set_volume_clamp (double unclamped, VolumeControl.VolumeReasons reason) {
var v = new VolumeControl.Volume();
- v.volume = unclamped.clamp (0.0, this.max_volume);
+ v.volume = unclamped.clamp (0.0, _options.max_volume);
v.reason = reason;
this.volume = v;
_pre_clamp_volume = unclamped;
@@ -79,5 +82,6 @@ public abstract class VolumeControl : Object
return _pre_clamp_volume;
}
+ public abstract VolumeControl.ActiveOutput active_output();
public signal void active_output_changed (VolumeControl.ActiveOutput active_output);
}