Merge lp:~xavi-garcia-mena/indicator-sound/bug-1512798-reenable-amplified-volume into lp:indicator-sound/15.10

Proposed by Xavi Garcia
Status: Merged
Approved by: Charles Kerr
Approved revision: 508
Merged at revision: 520
Proposed branch: lp:~xavi-garcia-mena/indicator-sound/bug-1512798-reenable-amplified-volume
Merge into: lp:indicator-sound/15.10
Diff against target: 73 lines (+28/-1)
2 files modified
src/service.vala (+26/-0)
src/volume-control.vala (+2/-1)
To merge this branch: bzr merge lp:~xavi-garcia-mena/indicator-sound/bug-1512798-reenable-amplified-volume
Reviewer Review Type Date Requested Status
Charles Kerr (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+277128@code.launchpad.net

Commit message

Reenables allow amplified volume.

Description of the change

Reenables allow amplified volume.

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. Thanks Xavi :)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/service.vala'
--- src/service.vala 2015-10-02 14:07:44 +0000
+++ src/service.vala 2015-11-10 14:02:00 +0000
@@ -47,6 +47,7 @@
47 () => { debug("Notifications name vanshed"); notify_server_caps_checked = false; });47 () => { debug("Notifications name vanshed"); notify_server_caps_checked = false; });
4848
49 this.settings = new Settings ("com.canonical.indicator.sound");49 this.settings = new Settings ("com.canonical.indicator.sound");
50 this.sharedsettings = new Settings ("com.ubuntu.sound");
5051
51 this.settings.bind ("visible", this, "visible", SettingsBindFlags.GET);52 this.settings.bind ("visible", this, "visible", SettingsBindFlags.GET);
52 this.notify["visible"].connect ( () => this.update_root_icon () );53 this.notify["visible"].connect ( () => this.update_root_icon () );
@@ -95,6 +96,8 @@
95 this.sync_preferred_players ();96 this.sync_preferred_players ();
96 });97 });
9798
99 sharedsettings.bind ("allow-amplified-volume", this, "allow-amplified-volume", SettingsBindFlags.GET);
100
98 /* Hide the notification when the menu is shown */101 /* Hide the notification when the menu is shown */
99 var shown_action = actions.lookup_action ("indicator-shown") as SimpleAction;102 var shown_action = actions.lookup_action ("indicator-shown") as SimpleAction;
100 shown_action.change_state.connect ((state) => {103 shown_action.change_state.connect ((state) => {
@@ -173,6 +176,28 @@
173176
174 public bool visible { get; set; }177 public bool visible { get; set; }
175178
179 public bool allow_amplified_volume {
180 get {
181 return this.volume_control.max_volume > 1.0;
182 }
183
184 set {
185 if (this.allow_amplified_volume == value)
186 return;
187
188 if (value) {
189 /* from pulse/volume.h: #define PA_VOLUME_UI_MAX (pa_sw_volume_from_dB(+11.0)) */
190 this.volume_control.max_volume = (double)PulseAudio.Volume.sw_from_dB(11.0) / PulseAudio.Volume.NORM;
191 }
192 else {
193 this.volume_control.max_volume = 1.0;
194 }
195
196 /* Normalize volume, because the volume action's state is [0.0, 1.0], see create_volume_action() */
197 this.actions.change_action_state ("volume", this.volume_control.volume.volume / this.volume_control.max_volume);
198 }
199 }
200
176 const ActionEntry[] action_entries = {201 const ActionEntry[] action_entries = {
177 { "root", null, null, "@a{sv} {}", null },202 { "root", null, null, "@a{sv} {}", null },
178 { "scroll", activate_scroll_action, "i", null, null },203 { "scroll", activate_scroll_action, "i", null, null },
@@ -184,6 +209,7 @@
184 SimpleActionGroup actions;209 SimpleActionGroup actions;
185 HashTable<string, SoundMenu> menus;210 HashTable<string, SoundMenu> menus;
186 Settings settings;211 Settings settings;
212 Settings sharedsettings;
187 VolumeControl volume_control;213 VolumeControl volume_control;
188 MediaPlayerList players;214 MediaPlayerList players;
189 uint player_action_update_id;215 uint player_action_update_id;
190216
=== modified file 'src/volume-control.vala'
--- src/volume-control.vala 2015-08-12 14:00:56 +0000
+++ src/volume-control.vala 2015-11-10 14:02:00 +0000
@@ -40,9 +40,10 @@
40 public virtual bool mute { get { return false; } }40 public virtual bool mute { get { return false; } }
41 public virtual bool is_playing { get { return false; } }41 public virtual bool is_playing { get { return false; } }
42 private Volume _volume;42 private Volume _volume;
43 private double _max_volume = 1.0;
43 public virtual Volume volume { get { return _volume; } set { } }44 public virtual Volume volume { get { return _volume; } set { } }
44 public virtual double mic_volume { get { return 0.0; } set { } }45 public virtual double mic_volume { get { return 0.0; } set { } }
45 public virtual double max_volume { get { return 1.0; } protected set { } }46 public virtual double max_volume { get { return _max_volume; } set { _max_volume = value;} }
4647
47 public virtual bool high_volume_approved { get { return false; } protected set { } }48 public virtual bool high_volume_approved { get { return false; } protected set { } }
48 public virtual void approve_high_volume() { }49 public virtual void approve_high_volume() { }

Subscribers

People subscribed via source and target branches