Merge lp:~xavi-garcia-mena/indicator-sound/bug-pressing-cancel-accounts-service into lp:indicator-sound/15.10

Proposed by Xavi Garcia
Status: Merged
Approved by: Charles Kerr
Approved revision: 538
Merged at revision: 538
Proposed branch: lp:~xavi-garcia-mena/indicator-sound/bug-pressing-cancel-accounts-service
Merge into: lp:indicator-sound/15.10
Diff against target: 37 lines (+14/-0)
2 files modified
src/service.vala (+4/-0)
src/volume-warning.vala (+10/-0)
To merge this branch: bzr merge lp:~xavi-garcia-mena/indicator-sound/bug-pressing-cancel-accounts-service
Reviewer Review Type Date Requested Status
Charles Kerr (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+291985@code.launchpad.net

Commit message

This branch adds a new signal in volumeWarning to set the warning level volume after pressing cancel.
We are setting the warning level before pressing cancel, which is alright, but sometimes we have issues with the value set to the accounts service that steps on the warning level.

Description of the change

This branch adds a new signal in volumeWarning to set the warning level volume after pressing cancel.
We are setting the warning level before pressing cancel, which is alright, but sometimes we have issues with the value set to the accounts service that steps on the warning level.

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 :

The patch is fine, approved.

Just thinking out loud, the existing codebase is a little clumsy in how it treats volumes as sometimes a PulseAudio.Volume level, and sometimes a percentage of norm, etc. It might be better to have an actual Volume class that understands these things s.t. we have a consistent volume and don't repeat the conversion utils.

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 2016-04-05 21:28:26 +0000
3+++ src/service.vala 2016-04-15 10:05:04 +0000
4@@ -68,6 +68,10 @@
5 update_notification();
6 });
7
8+ this._volume_warning.cancel_pressed.connect( (cancel_volume) => {
9+ volume_control.set_volume_clamp (cancel_volume, VolumeControl.VolumeReasons.USER_KEYPRESS);
10+ });
11+
12 this.accounts_service = accounts;
13 /* If we're on the greeter, don't export */
14 if (this.accounts_service != null) {
15
16=== modified file 'src/volume-warning.vala'
17--- src/volume-warning.vala 2016-03-01 09:41:41 +0000
18+++ src/volume-warning.vala 2016-04-15 10:05:04 +0000
19@@ -213,8 +213,18 @@
20 if (response == IndicatorSound.WarnNotification.Response.OK) {
21 approve_high_volume ();
22 sound_system_set_multimedia_volume (_ok_volume);
23+ } else {
24+ this.cancel_pressed (this.volume_to_double(_options.loud_volume));
25 }
26
27 _ok_volume = PulseAudio.Volume.INVALID;
28 }
29+
30+ private static double volume_to_double (PulseAudio.Volume vol)
31+ {
32+ double tmp = (double)(vol - PulseAudio.Volume.MUTED);
33+ return tmp / (double)(PulseAudio.Volume.NORM - PulseAudio.Volume.MUTED);
34+ }
35+
36+ public signal void cancel_pressed (double cancel_volume);
37 }

Subscribers

People subscribed via source and target branches