aboutsummaryrefslogtreecommitdiff
path: root/src
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 /src
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
Diffstat (limited to 'src')
-rw-r--r--src/volume-control-pulse.vala16
-rw-r--r--src/volume-control.vala2
-rw-r--r--src/volume-warning.vala32
3 files changed, 11 insertions, 39 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)
{