diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 6 | ||||
-rw-r--r-- | src/service.vala | 2 | ||||
-rw-r--r-- | src/volume-control-pulse.vala (renamed from src/volume-control.vala) | 24 |
3 files changed, 19 insertions, 13 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b6f006a..479d01a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -43,6 +43,7 @@ vala_add(indicator-sound-service DEPENDS sound-menu volume-control + volume-control-pulse media-player media-player-list mpris2-interfaces @@ -52,6 +53,11 @@ vala_add(indicator-sound-service volume-control.vala ) vala_add(indicator-sound-service + volume-control-pulse.vala + DEPENDS + volume-control +) +vala_add(indicator-sound-service media-player.vala ) vala_add(indicator-sound-service diff --git a/src/service.vala b/src/service.vala index b07f267..b435726 100644 --- a/src/service.vala +++ b/src/service.vala @@ -32,7 +32,7 @@ public class IndicatorSound.Service: Object { this.settings.bind ("visible", this, "visible", SettingsBindFlags.GET); this.notify["visible"].connect ( () => this.update_root_icon () ); - this.volume_control = new VolumeControl (); + this.volume_control = new VolumeControlPulse (); /* If we're on the greeter, don't export */ if (GLib.Environment.get_user_name() != "lightdm") { diff --git a/src/volume-control.vala b/src/volume-control-pulse.vala index 62cb2d0..1e81ce1 100644 --- a/src/volume-control.vala +++ b/src/volume-control-pulse.vala @@ -32,7 +32,7 @@ interface GreeterListInterface : Object public signal void entry_selected (string entry_name); } -public class VolumeControl : Object +public class VolumeControlPulse : VolumeControl { /* this is static to ensure it being freed after @context (loop does not have ref counting) */ private static PulseAudio.GLibMainLoop loop; @@ -54,7 +54,7 @@ public class VolumeControl : Object private bool _pulse_use_stream_restore = false; private uint32 _active_sink_input = -1; private string[] _valid_roles = {"multimedia", "alert", "alarm", "phone"}; - public string stream { + public override string stream { get { if (_active_sink_input < 0 || _active_sink_input >= _valid_roles.length) return "multimedia"; @@ -79,19 +79,19 @@ public class VolumeControl : Object private bool _active_port_headphone = false; /** true when connected to the pulse server */ - public bool ready { get; set; } + public override bool ready { get; private set; } /** true when a microphone is active **/ - public bool active_mic { get; private set; default = false; } + public override bool active_mic { get; private set; default = false; } /** true when high volume warnings should be shown */ - public bool high_volume { + public override bool high_volume { get { return this._volume > 0.75 && _active_port_headphone; } } - public VolumeControl () + public VolumeControlPulse () { if (loop == null) loop = new PulseAudio.GLibMainLoop (); @@ -104,7 +104,7 @@ public class VolumeControl : Object this.reconnect_to_pulse (); } - ~VolumeControl () + ~VolumeControlPulse () { if (_reconnect_timer != 0) { Source.remove (_reconnect_timer); @@ -490,7 +490,7 @@ public class VolumeControl : Object } } - public void set_mute (bool mute) + public override void set_mute (bool mute) { if (set_mute_internal (mute)) sync_mute_to_accountsservice.begin (mute); @@ -501,7 +501,7 @@ public class VolumeControl : Object this.set_mute (!this._mute); } - public bool mute + public override bool mute { get { @@ -509,7 +509,7 @@ public class VolumeControl : Object } } - public bool is_playing + public override bool is_playing { get { @@ -627,7 +627,7 @@ public class VolumeControl : Object } } - public double volume { + public override double volume { get { return _volume; } @@ -638,7 +638,7 @@ public class VolumeControl : Object } } - public double mic_volume { + public override double mic_volume { get { return _mic_volume; } |