diff options
author | charles kerr <charlesk@canonical.com> | 2015-12-19 21:42:15 -0600 |
---|---|---|
committer | charles kerr <charlesk@canonical.com> | 2015-12-19 21:42:15 -0600 |
commit | cdc14fd12e145a775f7f103125f4624947ac4d95 (patch) | |
tree | 65f873b56d1bdfc75e2e4c5b43c59e7d43f076c3 | |
parent | af0d715e8a451cac638980c67d1a4be0634a6b79 (diff) | |
download | ayatana-indicator-sound-cdc14fd12e145a775f7f103125f4624947ac4d95.tar.gz ayatana-indicator-sound-cdc14fd12e145a775f7f103125f4624947ac4d95.tar.bz2 ayatana-indicator-sound-cdc14fd12e145a775f7f103125f4624947ac4d95.zip |
move service.waiting_user_approve_warn into warning-volume
-rw-r--r-- | src/service.vala | 16 | ||||
-rw-r--r-- | src/volume-warning.vala | 3 |
2 files changed, 10 insertions, 9 deletions
diff --git a/src/service.vala b/src/service.vala index f03fe19..a333c19 100644 --- a/src/service.vala +++ b/src/service.vala @@ -45,8 +45,8 @@ public class IndicatorSound.Service: Object { 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(); - waiting_user_approve_warn=false; + n.clear_actions (); + _volume_warning.active = false; increment_volume_sync_action(); }); BusWatcher.watch_namespace (GLib.BusType.SESSION, @@ -288,7 +288,6 @@ public class IndicatorSound.Service: Object { private bool notify_server_supports_actions = false; private bool notify_server_supports_sync = false; private bool block_info_notifications = false; - private bool waiting_user_approve_warn = false; private string get_volume_icon (double volume, VolumeControl.ActiveOutput active_output) { @@ -624,7 +623,7 @@ public class IndicatorSound.Service: Object { && this.notify_server_supports_actions && !_volume_warning.high_volume_approved && !ignore_warning_this_time; - if (waiting_user_approve_warn && !_options.is_loud(volume_control.volume)) { + if (_volume_warning.active && !_options.is_loud(volume_control.volume)) { volume_control.set_warning_volume(); close_notification(warn_notification); } @@ -645,18 +644,17 @@ public class IndicatorSound.Service: Object { vol.reason = VolumeControl.VolumeReasons.USER_KEYPRESS; _pre_warn_volume = null; volume_control.volume = vol; - - waiting_user_approve_warn = false; + _volume_warning.active = false; }); warn_notification.add_action ("cancel", _("Cancel"), (n, a) => { _pre_warn_volume = null; - waiting_user_approve_warn = false; + _volume_warning.active = false; increment_volume_sync_action(); }); - waiting_user_approve_warn = true; + _volume_warning.active = true; show_notification(warn_notification); } else { - if (!waiting_user_approve_warn) { + if (!_volume_warning.active) { close_notification(warn_notification); if (notify_server_supports_sync && !block_info_notifications && !ignore_warning_this_time) { diff --git a/src/volume-warning.vala b/src/volume-warning.vala index 99ae772..4c00ba9 100644 --- a/src/volume-warning.vala +++ b/src/volume-warning.vala @@ -27,6 +27,9 @@ extern unowned PulseAudio.CVolume? vol_set2 (PulseAudio.CVolume? cv, uint channe public class VolumeWarning : VolumeControl { + // true if the warning dialog is currently active + public bool active { get; public set; default = false; } + // FIXME: this is temporarily necessary while bootstrapping this // code because VolumeWarning is still subclassed from VolumeControl, // but TBH we don't need any concept of mute here. |