Merge lp:~ted/indicator-sound/lp1381871-no-initial-value-for-utopic into lp:indicator-sound/15.04

Proposed by Ted Gould
Status: Merged
Approved by: Charles Kerr
Approved revision: 462
Merged at revision: 461
Proposed branch: lp:~ted/indicator-sound/lp1381871-no-initial-value-for-utopic
Merge into: lp:indicator-sound/15.04
Prerequisite: lp:~ted/indicator-sound/extreme-volume-warning
Diff against target: 13 lines (+3/-0)
1 file modified
src/service.vala (+3/-0)
To merge this branch: bzr merge lp:~ted/indicator-sound/lp1381871-no-initial-value-for-utopic
Reviewer Review Type Date Requested Status
Charles Kerr (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+240202@code.launchpad.net

This proposal supersedes a proposal from 2014-10-16.

Commit message

service.vala: don't call set_volume unnecessarily

Description of the change

service.vala: don't call set_volume unnecessarily

The allow-amplified-volume setting is bound to a property on the service with the same name. GSettings always sets the target property when the binding is created. The property setter calls set_volume() unconditionally, which lead to a call on every startup of indicator-sound. That wasn't a problem until set_volume() started emitting a notification for volume changes...

Fix this by only updating the property when the underlying value has actually changed.

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

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 2014-10-31 02:46:21 +0000
3+++ src/service.vala 2014-10-31 02:46:21 +0000
4@@ -131,6 +131,9 @@
5 }
6
7 set {
8+ if (this.allow_amplified_volume == value)
9+ return;
10+
11 if (value) {
12 /* from pulse/volume.h: #define PA_VOLUME_UI_MAX (pa_sw_volume_from_dB(+11.0)) */
13 this.max_volume = (double)PulseAudio.Volume.sw_from_dB(11.0) / PulseAudio.Volume.NORM;

Subscribers

People subscribed via source and target branches