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
=== modified file 'src/Indicator.vala'
--- src/Indicator.vala 2016-05-04 14:00:58 +0000
+++ src/Indicator.vala 2016-09-09 21:20:56 +0000
@@ -217,6 +217,10 @@
217217
218 return Gdk.EVENT_PROPAGATE;218 return Gdk.EVENT_PROPAGATE;
219 });219 });
220
221 var vol = new Services.VolumeControl.Volume ();
222 vol.reason = Services.VolumeControl.VolumeReasons.USER_KEYPRESS;
223
220 // change volume on scroll224 // change volume on scroll
221 panel_icon.scroll_event.connect ((e) => {225 panel_icon.scroll_event.connect ((e) => {
222 int dir = 0;226 int dir = 0;
@@ -225,10 +229,9 @@
225 } else if (e.direction == Gdk.ScrollDirection.DOWN) {229 } else if (e.direction == Gdk.ScrollDirection.DOWN) {
226 dir = -1;230 dir = -1;
227 }231 }
232
228 double v = this.volume_control.volume.volume + volume_step_percentage * dir;233 double v = this.volume_control.volume.volume + volume_step_percentage * dir;
229 var vol = new Services.VolumeControl.Volume();
230 vol.volume = v.clamp (0.0, this.max_volume);234 vol.volume = v.clamp (0.0, this.max_volume);
231 vol.reason = Services.VolumeControl.VolumeReasons.USER_KEYPRESS;
232 this.volume_control.volume = vol;235 this.volume_control.volume = vol;
233236
234 if (open == false && this.notification != null && v >= -0.05 && v <= (this.max_volume + 0.05)) {237 if (open == false && this.notification != null && v >= -0.05 && v <= (this.max_volume + 0.05)) {
235238
=== modified file 'src/Services/Volume-control.vala'
--- src/Services/Volume-control.vala 2015-09-14 21:09:53 +0000
+++ src/Services/Volume-control.vala 2016-09-09 21:20:56 +0000
@@ -126,7 +126,7 @@
126 _mute_cancellable = new Cancellable ();126 _mute_cancellable = new Cancellable ();
127 _volume_cancellable = new Cancellable ();127 _volume_cancellable = new Cancellable ();
128128
129 this.reconnect_to_pulse ();129 reconnect_to_pulse.begin ();
130 }130 }
131131
132 ~VolumeControlPulse () {132 ~VolumeControlPulse () {
@@ -453,11 +453,11 @@
453453
454 bool reconnect_timeout () {454 bool reconnect_timeout () {
455 _reconnect_timer = 0;455 _reconnect_timer = 0;
456 reconnect_to_pulse ();456 reconnect_to_pulse.begin ();
457 return false; // G_SOURCE_REMOVE457 return false; // G_SOURCE_REMOVE
458 }458 }
459459
460 void reconnect_to_pulse () {460 async void reconnect_to_pulse () {
461 if (this.ready) {461 if (this.ready) {
462 this.context.disconnect ();462 this.context.disconnect ();
463 this.context = null;463 this.context = null;
@@ -465,7 +465,7 @@
465 }465 }
466466
467 var props = new PulseAudio.Proplist ();467 var props = new PulseAudio.Proplist ();
468 props.sets (PulseAudio.Proplist.PROP_APPLICATION_NAME, "Elementary Audio Settings");468 props.sets (PulseAudio.Proplist.PROP_APPLICATION_NAME, "elementary OS Audio Settings");
469 props.sets (PulseAudio.Proplist.PROP_APPLICATION_ID, "org.pantheon.desktop.wingpanel.indicators.sound");469 props.sets (PulseAudio.Proplist.PROP_APPLICATION_ID, "org.pantheon.desktop.wingpanel.indicators.sound");
470 props.sets (PulseAudio.Proplist.PROP_APPLICATION_ICON_NAME, "multimedia-volume-control");470 props.sets (PulseAudio.Proplist.PROP_APPLICATION_ICON_NAME, "multimedia-volume-control");
471 props.sets (PulseAudio.Proplist.PROP_APPLICATION_VERSION, "0.1");471 props.sets (PulseAudio.Proplist.PROP_APPLICATION_VERSION, "0.1");

Subscribers

People subscribed via source and target branches

to all changes: