diff options
author | Ted Gould <ted@gould.cx> | 2015-02-05 17:19:13 +0000 |
---|---|---|
committer | CI Train Bot <ci-train-bot@canonical.com> | 2015-02-05 17:19:13 +0000 |
commit | c9cb54483cc5966b3c542ec86dd4e6bf7b33d4ec (patch) | |
tree | c4bf747687988a9a24cd0cf069a997b7adfc9913 /src/service.vala | |
parent | 59dfdd3906fd238e5ea3606d72b938677096e2c5 (diff) | |
parent | c6002f571882de3b7bf3d3a6a2045272d818b4db (diff) | |
download | ayatana-indicator-sound-c9cb54483cc5966b3c542ec86dd4e6bf7b33d4ec.tar.gz ayatana-indicator-sound-c9cb54483cc5966b3c542ec86dd4e6bf7b33d4ec.tar.bz2 ayatana-indicator-sound-c9cb54483cc5966b3c542ec86dd4e6bf7b33d4ec.zip |
Don't show notification when output mode changes Fixes: #1416233
Approved by: Charles Kerr, PS Jenkins bot
Diffstat (limited to 'src/service.vala')
-rw-r--r-- | src/service.vala | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/service.vala b/src/service.vala index fb56215..b07f267 100644 --- a/src/service.vala +++ b/src/service.vala @@ -270,6 +270,8 @@ public class IndicatorSound.Service: Object { private bool check_sync_notification = false; private bool support_sync_notification = false; + private string last_output_notification = "multimedia"; + private double last_volume_notification = 0; void update_sync_notification () { if (!check_sync_notification) { @@ -283,6 +285,21 @@ public class IndicatorSound.Service: Object { if (!support_sync_notification) return; + /* Update our volume and output */ + var oldoutput = this.last_output_notification; + this.last_output_notification = this.volume_control.stream; + + var oldvolume = this.last_volume_notification; + this.last_volume_notification = volume_control.volume; + + /* Suppress notifications of volume changes if it is because the + output stream changed. */ + if (oldoutput != this.last_output_notification) + return; + /* Supress updates that don't change the value */ + if (GLib.Math.fabs(oldvolume - this.last_volume_notification) < 0.01) + return; + var shown_action = actions.lookup_action ("indicator-shown") as SimpleAction; if (shown_action != null && shown_action.get_state().get_boolean()) return; |