Merge lp:~ted/indicator-sound/lp1416233-notification-on-output into lp:indicator-sound/15.04

Proposed by Ted Gould
Status: Merged
Approved by: Ted Gould
Approved revision: 478
Merged at revision: 474
Proposed branch: lp:~ted/indicator-sound/lp1416233-notification-on-output
Merge into: lp:indicator-sound/15.04
Diff against target: 53 lines (+25/-0)
2 files modified
src/service.vala (+17/-0)
src/volume-control.vala (+8/-0)
To merge this branch: bzr merge lp:~ted/indicator-sound/lp1416233-notification-on-output
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Charles Kerr (community) Approve
Review via email: mp+248126@code.launchpad.net

Commit message

Don't show notification when output mode changes

Description of the change

Misread the design spec.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Charles Kerr (charlesk) wrote :

LGTM. Review only; haven't tested wrt 1416233

review: Approve
475. By Ted Gould

Watch for double updates from notifications. Supress them

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
476. By Ted Gould

Incorrect type

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
477. By Ted Gould

Making sure to record the output and volume for each invocation

478. By Ted Gould

Compare doubles with an accuracy range

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/service.vala'
2--- src/service.vala 2015-01-29 17:31:03 +0000
3+++ src/service.vala 2015-02-05 14:53:33 +0000
4@@ -270,6 +270,8 @@
5
6 private bool check_sync_notification = false;
7 private bool support_sync_notification = false;
8+ private string last_output_notification = "multimedia";
9+ private double last_volume_notification = 0;
10
11 void update_sync_notification () {
12 if (!check_sync_notification) {
13@@ -283,6 +285,21 @@
14 if (!support_sync_notification)
15 return;
16
17+ /* Update our volume and output */
18+ var oldoutput = this.last_output_notification;
19+ this.last_output_notification = this.volume_control.stream;
20+
21+ var oldvolume = this.last_volume_notification;
22+ this.last_volume_notification = volume_control.volume;
23+
24+ /* Suppress notifications of volume changes if it is because the
25+ output stream changed. */
26+ if (oldoutput != this.last_output_notification)
27+ return;
28+ /* Supress updates that don't change the value */
29+ if (GLib.Math.fabs(oldvolume - this.last_volume_notification) < 0.01)
30+ return;
31+
32 var shown_action = actions.lookup_action ("indicator-shown") as SimpleAction;
33 if (shown_action != null && shown_action.get_state().get_boolean())
34 return;
35
36=== modified file 'src/volume-control.vala'
37--- src/volume-control.vala 2015-01-29 17:31:55 +0000
38+++ src/volume-control.vala 2015-02-05 14:53:33 +0000
39@@ -54,6 +54,14 @@
40 private bool _pulse_use_stream_restore = false;
41 private uint32 _active_sink_input = -1;
42 private string[] _valid_roles = {"multimedia", "alert", "alarm", "phone"};
43+ public string stream {
44+ get {
45+ if (_active_sink_input < 0 || _active_sink_input >= _valid_roles.length)
46+ return "multimedia";
47+ else
48+ return _valid_roles[_active_sink_input];
49+ }
50+ }
51 private string? _objp_role_multimedia = null;
52 private string? _objp_role_alert = null;
53 private string? _objp_role_alarm = null;

Subscribers

People subscribed via source and target branches