diff options
author | Ted Gould <ted@gould.cx> | 2015-02-06 08:16:47 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2015-02-06 08:16:47 -0600 |
commit | 9ea7cad48eec56bafb47c7f05f1b04c79c7c3e78 (patch) | |
tree | 1d1e99d047bcd375247456bcd7fad605afae0fce | |
parent | 6ac4cc8173c25b12cf8c18869f7d1e142c28ad44 (diff) | |
parent | 1b0c78a1bd4237a920a569a64efe6bd006e4a9ca (diff) | |
download | ayatana-indicator-sound-9ea7cad48eec56bafb47c7f05f1b04c79c7c3e78.tar.gz ayatana-indicator-sound-9ea7cad48eec56bafb47c7f05f1b04c79c7c3e78.tar.bz2 ayatana-indicator-sound-9ea7cad48eec56bafb47c7f05f1b04c79c7c3e78.zip |
Update to trunk
-rw-r--r-- | debian/changelog | 9 | ||||
-rw-r--r-- | src/service.vala | 17 | ||||
-rw-r--r-- | src/volume-control.vala | 8 |
3 files changed, 34 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog index aad0867..718e4e4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +indicator-sound (12.10.2+15.04.20150205-0ubuntu1) vivid; urgency=medium + + [ Ted Gould ] + * Don't show notification when output mode changes (LP: #1416233) + * Initial support for indicator service testing from the GMenu/GAction + interfaces + + -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Thu, 05 Feb 2015 17:19:42 +0000 + indicator-sound (12.10.2+15.04.20150129.1-0ubuntu1) vivid; urgency=low [ Ted Gould ] 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; diff --git a/src/volume-control.vala b/src/volume-control.vala index bf97021..62cb2d0 100644 --- a/src/volume-control.vala +++ b/src/volume-control.vala @@ -54,6 +54,14 @@ 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 { + get { + if (_active_sink_input < 0 || _active_sink_input >= _valid_roles.length) + return "multimedia"; + else + return _valid_roles[_active_sink_input]; + } + } private string? _objp_role_multimedia = null; private string? _objp_role_alert = null; private string? _objp_role_alarm = null; |