Merge lp:~larsu/indicator-sound/lp1381871 into lp:indicator-sound/rtm-14.09

Proposed by Lars Karlitski
Status: Merged
Approved by: Ted Gould
Approved revision: 460
Merged at revision: 460
Proposed branch: lp:~larsu/indicator-sound/lp1381871
Merge into: lp:indicator-sound/rtm-14.09
Diff against target: 13 lines (+3/-0)
1 file modified
src/service.vala (+3/-0)
To merge this branch: bzr merge lp:~larsu/indicator-sound/lp1381871
Reviewer Review Type Date Requested Status
Ted Gould (community) Approve
Review via email: mp+238555@code.launchpad.net

Commit message

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...

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
Ted Gould (ted) wrote :

Cool! Thanks!

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-15 14:15:26 +0000
3+++ src/service.vala 2014-10-16 13:16:24 +0000
4@@ -139,6 +139,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