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
1=== modified file 'src/service.vala'
2--- src/service.vala 2013-10-02 19:13:49 +0000
3+++ src/service.vala 2013-10-10 03:38:40 +0000
4@@ -87,8 +87,9 @@
5 uint player_action_update_id;
6 Notify.Notification notification;
7
8+ const double volume_step_percentage = 0.06;
9+
10 void activate_scroll_action (SimpleAction action, Variant? param) {
11- const double volume_step_percentage = 0.06;
12 int delta = param.get_int32(); /* positive for up, negative for down */
13
14 double v = this.volume_control.get_volume () + volume_step_percentage * delta;
15@@ -202,12 +203,18 @@
16 }
17
18 Action create_volume_action () {
19- var volume_action = new SimpleAction.stateful ("volume", null, this.volume_control.get_volume ());
20+ var volume_action = new SimpleAction.stateful ("volume", VariantType.INT32, this.volume_control.get_volume ());
21
22 volume_action.change_state.connect ( (action, val) => {
23 volume_control.set_volume (val.get_double ());
24 });
25
26+ /* activating this action changes the volume by the amount given in the parameter */
27+ volume_action.activate.connect ( (action, param) => {
28+ double v = volume_control.get_volume () + volume_step_percentage * param.get_int32 ();
29+ volume_control.set_volume (v.clamp (0.0, 1.0));
30+ });
31+
32 this.volume_control.volume_changed.connect (volume_changed);
33
34 this.volume_control.bind_property ("ready", volume_action, "enabled", BindingFlags.SYNC_CREATE);
35
36=== modified file 'src/sound-menu.vala'
37--- src/sound-menu.vala 2013-10-02 19:40:00 +0000
38+++ src/sound-menu.vala 2013-10-10 03:38:40 +0000
39@@ -31,7 +31,7 @@
40 this.volume_section = new Menu ();
41 if (show_mute)
42 volume_section.append (_("Mute"), "indicator.mute");
43- volume_section.append_item (this.create_slider_menu_item ("indicator.volume", 0.0, 1.0, 0.01,
44+ volume_section.append_item (this.create_slider_menu_item ("indicator.volume(0)", 0.0, 1.0, 0.01,
45 "audio-volume-low-zero-panel",
46 "audio-volume-high-panel"));
47

Subscribers

People subscribed via source and target branches