From f06c2ddee06bce9ed8320d78a65fd6206db3e6f1 Mon Sep 17 00:00:00 2001 From: Xavi Garcia Mena Date: Thu, 19 Nov 2015 15:14:47 +0100 Subject: Fix issues with warning dialog --- src/service.vala | 6 ++++-- src/volume-control-pulse.vala | 4 ++++ src/volume-control.vala | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/service.vala b/src/service.vala index 12e2ac2..2b2d667 100644 --- a/src/service.vala +++ b/src/service.vala @@ -40,7 +40,7 @@ public class IndicatorSound.Service: Object { warn_notification.set_hint ("x-canonical-non-shaped-icon", "true"); warn_notification.set_hint ("x-canonical-snap-decisions", "true"); warn_notification.set_hint ("x-canonical-private-affirmative-tint", "true"); - warn_notification.closed.connect((n) => { n.clear_actions(); }); + warn_notification.closed.connect((n) => { n.clear_actions(); waiting_user_approve_warn=false; }); BusWatcher.watch_namespace (GLib.BusType.SESSION, "org.freedesktop.Notifications", () => { debug("Notifications name appeared"); }, @@ -609,7 +609,9 @@ public class IndicatorSound.Service: Object { var warn = loud && this.notify_server_supports_actions && !this.volume_control.high_volume_approved; - + if (waiting_user_approve_warn && volume_control.below_warning_volume) { + close_notification(warn_notification); + } if (warn) { close_notification(info_notification); if (_pre_warn_volume == null) { diff --git a/src/volume-control-pulse.vala b/src/volume-control-pulse.vala index 8122f26..45cf8a6 100644 --- a/src/volume-control-pulse.vala +++ b/src/volume-control-pulse.vala @@ -738,6 +738,10 @@ public class VolumeControlPulse : VolumeControl get { return this._high_volume; } private set { this._high_volume = value; } } + public override bool below_warning_volume { + get { return this._volume.volume < this._warning_volume_norms; } + private set { } + } private void init_high_volume() { _settings.changed["warning-volume-enabled"].connect(() => update_high_volume_cache()); _settings.changed["warning-volume-decibels"].connect(() => update_high_volume_cache()); diff --git a/src/volume-control.vala b/src/volume-control.vala index 8e615ea..632af08 100644 --- a/src/volume-control.vala +++ b/src/volume-control.vala @@ -48,6 +48,7 @@ public abstract class VolumeControl : Object public virtual bool ready { get { return false; } set { } } public virtual bool active_mic { get { return false; } set { } } public virtual bool 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; } } -- cgit v1.2.3