aboutsummaryrefslogtreecommitdiff
path: root/src/volume-control.vala
diff options
context:
space:
mode:
authorcharles kerr <charlesk@canonical.com>2015-12-19 16:01:46 -0600
committercharles kerr <charlesk@canonical.com>2015-12-19 16:01:46 -0600
commit4b695bacf20b7247f6b16483ede5e5d8b51dd355 (patch)
tree498ae73530a5aba219866f129f0420f9fabfb18a /src/volume-control.vala
parentaee4659081bbca43cb3e7d11bc3263e530876a86 (diff)
downloadayatana-indicator-sound-4b695bacf20b7247f6b16483ede5e5d8b51dd355.tar.gz
ayatana-indicator-sound-4b695bacf20b7247f6b16483ede5e5d8b51dd355.tar.bz2
ayatana-indicator-sound-4b695bacf20b7247f6b16483ede5e5d8b51dd355.zip
move max_volume into a reusable 'options' class
Diffstat (limited to 'src/volume-control.vala')
-rw-r--r--src/volume-control.vala9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/volume-control.vala b/src/volume-control.vala
index 90fc325..f33ae18 100644
--- a/src/volume-control.vala
+++ b/src/volume-control.vala
@@ -45,6 +45,12 @@ public abstract class VolumeControl : Object
public VolumeReasons reason;
}
+ private IndicatorSound.Options _options = null;
+
+ public VolumeControl(IndicatorSound.Options options) {
+ _options = options;
+ }
+
public virtual string stream { get { return ""; } }
public virtual bool ready { get { return false; } set { } }
public virtual bool active_mic { get { return false; } set { } }
@@ -58,7 +64,6 @@ public abstract class VolumeControl : Object
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() { }
@@ -69,7 +74,7 @@ public abstract class VolumeControl : Object
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;