Merge lp:~donadigo/wingpanel-indicator-sound/not-freeze-on-scroll into lp:~wingpanel-devs/wingpanel-indicator-sound/trunk

Proposed by Adam Bieńkowski
Status: Merged
Approved by: Djax
Approved revision: 114
Merged at revision: 114
Proposed branch: lp:~donadigo/wingpanel-indicator-sound/not-freeze-on-scroll
Merge into: lp:~wingpanel-devs/wingpanel-indicator-sound/trunk
Diff against target: 62 lines (+9/-6)
2 files modified
src/Indicator.vala (+5/-2)
src/Services/Volume-control.vala (+4/-4)
To merge this branch: bzr merge lp:~donadigo/wingpanel-indicator-sound/not-freeze-on-scroll
Reviewer Review Type Date Requested Status
Djax Approve
Review via email: mp+305385@code.launchpad.net

Commit message

* Do not create an instance on every scroll event
* Correct name property
* Pulseaduio async connecting

Description of the change

This branch fixes issue with freezing wingpanel for a while when scrolling over the indicator. Currently it creates an instance when the scroll event occurs which is not optimal and takes long time to connect to pulseaudio. I also corrected the name property and made connecting to pulseaudio async.

To post a comment you must log in.
Revision history for this message
Djax (parnold-x) wrote :

Got no freezing before but it works and looks good.

review: Needs Fixing
Revision history for this message
Djax (parnold-x) wrote :

missed the right box :)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Indicator.vala'
2--- src/Indicator.vala 2016-05-04 14:00:58 +0000
3+++ src/Indicator.vala 2016-09-09 21:20:56 +0000
4@@ -217,6 +217,10 @@
5
6 return Gdk.EVENT_PROPAGATE;
7 });
8+
9+ var vol = new Services.VolumeControl.Volume ();
10+ vol.reason = Services.VolumeControl.VolumeReasons.USER_KEYPRESS;
11+
12 // change volume on scroll
13 panel_icon.scroll_event.connect ((e) => {
14 int dir = 0;
15@@ -225,10 +229,9 @@
16 } else if (e.direction == Gdk.ScrollDirection.DOWN) {
17 dir = -1;
18 }
19+
20 double v = this.volume_control.volume.volume + volume_step_percentage * dir;
21- var vol = new Services.VolumeControl.Volume();
22 vol.volume = v.clamp (0.0, this.max_volume);
23- vol.reason = Services.VolumeControl.VolumeReasons.USER_KEYPRESS;
24 this.volume_control.volume = vol;
25
26 if (open == false && this.notification != null && v >= -0.05 && v <= (this.max_volume + 0.05)) {
27
28=== modified file 'src/Services/Volume-control.vala'
29--- src/Services/Volume-control.vala 2015-09-14 21:09:53 +0000
30+++ src/Services/Volume-control.vala 2016-09-09 21:20:56 +0000
31@@ -126,7 +126,7 @@
32 _mute_cancellable = new Cancellable ();
33 _volume_cancellable = new Cancellable ();
34
35- this.reconnect_to_pulse ();
36+ reconnect_to_pulse.begin ();
37 }
38
39 ~VolumeControlPulse () {
40@@ -453,11 +453,11 @@
41
42 bool reconnect_timeout () {
43 _reconnect_timer = 0;
44- reconnect_to_pulse ();
45+ reconnect_to_pulse.begin ();
46 return false; // G_SOURCE_REMOVE
47 }
48
49- void reconnect_to_pulse () {
50+ async void reconnect_to_pulse () {
51 if (this.ready) {
52 this.context.disconnect ();
53 this.context = null;
54@@ -465,7 +465,7 @@
55 }
56
57 var props = new PulseAudio.Proplist ();
58- props.sets (PulseAudio.Proplist.PROP_APPLICATION_NAME, "Elementary Audio Settings");
59+ props.sets (PulseAudio.Proplist.PROP_APPLICATION_NAME, "elementary OS Audio Settings");
60 props.sets (PulseAudio.Proplist.PROP_APPLICATION_ID, "org.pantheon.desktop.wingpanel.indicators.sound");
61 props.sets (PulseAudio.Proplist.PROP_APPLICATION_ICON_NAME, "multimedia-volume-control");
62 props.sets (PulseAudio.Proplist.PROP_APPLICATION_VERSION, "0.1");

Subscribers

People subscribed via source and target branches

to all changes: