Merge lp:~larsu/indicator-sound/change-volume-on-scrolling into lp:indicator-sound/13.10

Proposed by Lars Karlitski
Status: Merged
Approved by: Charles Kerr
Approved revision: 374
Merged at revision: 373
Proposed branch: lp:~larsu/indicator-sound/change-volume-on-scrolling
Merge into: lp:indicator-sound/13.10
Diff against target: 44 lines (+16/-0)
2 files modified
src/service.vala (+14/-0)
src/sound-menu.vala (+2/-0)
To merge this branch: bzr merge lp:~larsu/indicator-sound/change-volume-on-scrolling
Reviewer Review Type Date Requested Status
Charles Kerr (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+184568@code.launchpad.net

Description of the change

Fixes bug #1221242 and #1204036 (make scrolling and middle clicking work on the sound indicator)

It soft-depends on lp:~larsu/libindicator/ng-add-scrolling. That means, this branch can be merged without problems, as it only adds an action and a few attributes on the root item. The bugs won't be fixed until both branches land, though.

Please the other merge request for a description of the new attributes.

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-08-22 16:15:09 +0000
3+++ src/service.vala 2013-09-09 13:02:35 +0000
4@@ -64,6 +64,7 @@
5
6 const ActionEntry[] action_entries = {
7 { "root", null, null, "@a{sv} {}", null },
8+ { "scroll", activate_scroll_action, "i", null, null },
9 { "desktop-settings", activate_desktop_settings, null, null, null },
10 { "phone-settings", activate_phone_settings, null, null, null },
11 };
12@@ -76,6 +77,19 @@
13 MediaPlayerList players;
14 uint player_action_update_id;
15
16+ void activate_scroll_action (SimpleAction action, Variant? param) {
17+ const double volume_step_percentage = 0.06;
18+ int delta = param.get_int32(); /* positive for up, negative for down */
19+
20+ double v = this.volume_control.get_volume () + volume_step_percentage * delta;
21+ if (v > 1.0)
22+ v = 1.0;
23+ else if (v < 0.0)
24+ v = 0.0;
25+
26+ this.volume_control.set_volume (v);
27+ }
28+
29 void activate_desktop_settings (SimpleAction action, Variant? param) {
30 var env = Environment.get_variable ("DESKTOP_SESSION");
31 string cmd;
32
33=== modified file 'src/sound-menu.vala'
34--- src/sound-menu.vala 2013-08-16 03:13:41 +0000
35+++ src/sound-menu.vala 2013-09-09 13:02:35 +0000
36@@ -40,6 +40,8 @@
37
38 var root_item = new MenuItem (null, "indicator.root");
39 root_item.set_attribute ("x-canonical-type", "s", "com.canonical.indicator.root");
40+ root_item.set_attribute ("x-canonical-scroll-action", "s", "indicator.scroll");
41+ root_item.set_attribute ("x-canonical-secondary-action", "s", "indicator.mute");
42 root_item.set_submenu (this.menu);
43
44 this.root = new Menu ();

Subscribers

People subscribed via source and target branches