Merge lp:~larsu/indicator-sound/volume-action-activation into lp:indicator-sound/13.10

Proposed by Lars Karlitski
Status: Merged
Approved by: Charles Kerr
Approved revision: 390
Merged at revision: 389
Proposed branch: lp:~larsu/indicator-sound/volume-action-activation
Merge into: lp:indicator-sound/13.10
Diff against target: 46 lines (+10/-3)
2 files modified
src/service.vala (+9/-2)
src/sound-menu.vala (+1/-1)
To merge this branch: bzr merge lp:~larsu/indicator-sound/volume-action-activation
Reviewer Review Type Date Requested Status
Charles Kerr (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+190291@code.launchpad.net

Description of the change

Allow activating the 'volume' action

It does the same as the 'scroll' action except showing a notification.

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 :

looks good!

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 2013-10-02 19:13:49 +0000
+++ src/service.vala 2013-10-10 03:38:40 +0000
@@ -87,8 +87,9 @@
87 uint player_action_update_id;87 uint player_action_update_id;
88 Notify.Notification notification;88 Notify.Notification notification;
8989
90 const double volume_step_percentage = 0.06;
91
90 void activate_scroll_action (SimpleAction action, Variant? param) {92 void activate_scroll_action (SimpleAction action, Variant? param) {
91 const double volume_step_percentage = 0.06;
92 int delta = param.get_int32(); /* positive for up, negative for down */93 int delta = param.get_int32(); /* positive for up, negative for down */
9394
94 double v = this.volume_control.get_volume () + volume_step_percentage * delta;95 double v = this.volume_control.get_volume () + volume_step_percentage * delta;
@@ -202,12 +203,18 @@
202 }203 }
203204
204 Action create_volume_action () {205 Action create_volume_action () {
205 var volume_action = new SimpleAction.stateful ("volume", null, this.volume_control.get_volume ());206 var volume_action = new SimpleAction.stateful ("volume", VariantType.INT32, this.volume_control.get_volume ());
206207
207 volume_action.change_state.connect ( (action, val) => {208 volume_action.change_state.connect ( (action, val) => {
208 volume_control.set_volume (val.get_double ());209 volume_control.set_volume (val.get_double ());
209 });210 });
210211
212 /* activating this action changes the volume by the amount given in the parameter */
213 volume_action.activate.connect ( (action, param) => {
214 double v = volume_control.get_volume () + volume_step_percentage * param.get_int32 ();
215 volume_control.set_volume (v.clamp (0.0, 1.0));
216 });
217
211 this.volume_control.volume_changed.connect (volume_changed);218 this.volume_control.volume_changed.connect (volume_changed);
212219
213 this.volume_control.bind_property ("ready", volume_action, "enabled", BindingFlags.SYNC_CREATE);220 this.volume_control.bind_property ("ready", volume_action, "enabled", BindingFlags.SYNC_CREATE);
214221
=== modified file 'src/sound-menu.vala'
--- src/sound-menu.vala 2013-10-02 19:40:00 +0000
+++ src/sound-menu.vala 2013-10-10 03:38:40 +0000
@@ -31,7 +31,7 @@
31 this.volume_section = new Menu ();31 this.volume_section = new Menu ();
32 if (show_mute)32 if (show_mute)
33 volume_section.append (_("Mute"), "indicator.mute");33 volume_section.append (_("Mute"), "indicator.mute");
34 volume_section.append_item (this.create_slider_menu_item ("indicator.volume", 0.0, 1.0, 0.01,34 volume_section.append_item (this.create_slider_menu_item ("indicator.volume(0)", 0.0, 1.0, 0.01,
35 "audio-volume-low-zero-panel",35 "audio-volume-low-zero-panel",
36 "audio-volume-high-panel"));36 "audio-volume-high-panel"));
3737

Subscribers

People subscribed via source and target branches