aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcharles kerr <charlesk@canonical.com>2015-12-19 22:14:31 -0600
committercharles kerr <charlesk@canonical.com>2015-12-19 22:14:31 -0600
commitf008f077e6978c99ba9548eda26ac29c073a46a8 (patch)
treeaff23ac2f067fb17d30ca004500b1c4f18dfcc6a
parentcdc14fd12e145a775f7f103125f4624947ac4d95 (diff)
downloadayatana-indicator-sound-f008f077e6978c99ba9548eda26ac29c073a46a8.tar.gz
ayatana-indicator-sound-f008f077e6978c99ba9548eda26ac29c073a46a8.tar.bz2
ayatana-indicator-sound-f008f077e6978c99ba9548eda26ac29c073a46a8.zip
remove 'is-playing' property from volume-warning
-rw-r--r--src/volume-control-pulse.vala16
-rw-r--r--src/volume-control.vala2
-rw-r--r--src/volume-warning.vala32
-rw-r--r--tests/volume-control-mock.vala3
4 files changed, 12 insertions, 41 deletions
diff --git a/src/volume-control-pulse.vala b/src/volume-control-pulse.vala
index 251eae5..22c3ee4 100644
--- a/src/volume-control-pulse.vala
+++ b/src/volume-control-pulse.vala
@@ -41,7 +41,6 @@ public class VolumeControlPulse : VolumeControl
private PulseAudio.Context context;
private bool _mute = true;
- private bool _is_playing = false;
private VolumeControl.Volume _volume = new VolumeControl.Volume();
private double _mic_volume = 0.0;
@@ -241,11 +240,8 @@ public class VolumeControlPulse : VolumeControl
}
var playing = (i.state == PulseAudio.SinkState.RUNNING);
- if (_is_playing != playing)
- {
- _is_playing = playing;
- this.notify_property ("is-playing");
- }
+ if (is_playing != playing)
+ is_playing = playing;
// store the current status of the active output
VolumeControl.ActiveOutput active_output_before = active_output;
@@ -575,14 +571,6 @@ public class VolumeControlPulse : VolumeControl
}
}
- public override bool is_playing
- {
- get
- {
- return this._is_playing;
- }
- }
-
public override VolumeControl.ActiveOutput active_output
{
get
diff --git a/src/volume-control.vala b/src/volume-control.vala
index d35708f..f1c74a0 100644
--- a/src/volume-control.vala
+++ b/src/volume-control.vala
@@ -56,7 +56,7 @@ public abstract class VolumeControl : Object
public virtual bool active_mic { get { return false; } set { } }
public virtual bool high_volume { get { return false; } protected set { } }
public virtual bool mute { get { return false; } }
- public virtual bool is_playing { get { return false; } }
+ public bool is_playing { get; protected set; default = false; }
public virtual VolumeControl.ActiveOutput active_output { get { return VolumeControl.ActiveOutput.SPEAKERS; } }
private Volume _volume;
private double _pre_clamp_volume;
diff --git a/src/volume-warning.vala b/src/volume-warning.vala
index 4c00ba9..2bb4dae 100644
--- a/src/volume-warning.vala
+++ b/src/volume-warning.vala
@@ -43,7 +43,6 @@ public class VolumeWarning : VolumeControl
private uint _reconnect_timer = 0;
private PulseAudio.Context context;
- private bool _is_playing = false;
private bool _ignore_warning_this_time = false;
private VolumeControl.Volume _volume = new VolumeControl.Volume();
private double _mic_volume = 0.0;
@@ -125,21 +124,21 @@ public class VolumeWarning : VolumeControl
}
private VolumeControl.ActiveOutput calculate_active_output (SinkInfo? sink) {
-
+
VolumeControl.ActiveOutput ret_output = VolumeControl.ActiveOutput.SPEAKERS;
/* 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' */
-
+
// first of all check if we are in call mode
if (sink.active_port != null && sink.active_port.name == "output-speaker+wired_headphone") {
return VolumeControl.ActiveOutput.CALL_MODE;
}
// look if it's a headset/headphones
if (sink.name == "indicator_sound_test_headphones" ||
- (sink.active_port != null &&
+ (sink.active_port != null &&
(sink.active_port.name.contains("headset") ||
sink.active_port.name.contains("headphone")))) {
_active_port_headphone = true;
@@ -225,22 +224,15 @@ public class VolumeWarning : VolumeControl
if (i == null)
return;
- var playing = (i.state == PulseAudio.SinkState.RUNNING);
- if (_is_playing != playing)
- {
- _is_playing = playing;
- this.notify_property ("is-playing");
- }
-
// store the current status of the active output
VolumeControl.ActiveOutput active_output_before = active_output;
- // calculate the output
+ // calculate the output
_active_output = calculate_active_output (i);
-
+
// check if the output has changed, if so... emit a signal
VolumeControl.ActiveOutput active_output_now = active_output;
- if (active_output_now != active_output_before &&
+ if (active_output_now != active_output_before &&
(active_output_now != VolumeControl.ActiveOutput.CALL_MODE &&
active_output_before != VolumeControl.ActiveOutput.CALL_MODE)) {
this.active_output_changed (active_output_now);
@@ -526,22 +518,14 @@ public class VolumeWarning : VolumeControl
warning( "pa_context_connect() failed: %s\n", PulseAudio.strerror(context.errno()));
}
- public override bool is_playing
+ public override VolumeControl.ActiveOutput active_output
{
get
{
- return this._is_playing;
+ return _active_output;
}
}
- public override VolumeControl.ActiveOutput active_output
- {
- get
- {
- return _active_output;
- }
- }
-
/* Volume operations */
private static PulseAudio.Volume double_to_volume (double vol)
{
diff --git a/tests/volume-control-mock.vala b/tests/volume-control-mock.vala
index 7f958b2..d67a9db 100644
--- a/tests/volume-control-mock.vala
+++ b/tests/volume-control-mock.vala
@@ -30,8 +30,7 @@ public class VolumeControlMock : VolumeControl
public override bool active_mic { get; set; }
public bool mock_mute { get; set; }
public override bool mute { get { return mock_mute; } }
- public bool mock_is_playing { get; set; }
- public override bool is_playing { get { return mock_is_playing; } }
+ public void mock_set_is_playing(bool b) { is_playing = b; }
private VolumeControl.Volume _vol = new VolumeControl.Volume();
public override VolumeControl.Volume volume { get { return _vol; } set { _vol = value; }}
public override double mic_volume { get; set; }