Merge lp:~macslow/indicator-sound/synchronous-notification into lp:indicator-sound/14.10

Proposed by Mirco Müller
Status: Merged
Approved by: Ted Gould
Approved revision: 450
Merged at revision: 450
Proposed branch: lp:~macslow/indicator-sound/synchronous-notification
Merge into: lp:indicator-sound/14.10
Diff against target: 56 lines (+23/-1)
1 file modified
src/volume-control.vala (+23/-1)
To merge this branch: bzr merge lp:~macslow/indicator-sound/synchronous-notification
Reviewer Review Type Date Requested Status
Michał Sawicz Needs Information
Ted Gould (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+229061@code.launchpad.net

Commit message

Added use of synchronous notifications for volume-changes.

Description of the change

Added use of synchronous notifications for volume-changes.

With the proper support in the notification-backend and frontend this will allow doing this: https://www.youtube.com/watch?v=VBhxf2iQK8o

Which is what latest design-requirements request.

* Are there any related MPs required for this MP to build/function as expected? Please list.
Yes. This can be merged right away, but in order to see any effect lp:~macslow/unity-notifications/synchronous-notification and lp:~macslow/unity8/synchronous-notification have to be merged to their respective trunks.

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
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Ted Gould (ted) wrote :

How does this work on desktop? I don't see an MR to remove the functionality from USD.

review: Needs Information
Revision history for this message
Mirco Müller (macslow) wrote :

I've to recheck... been too long since I last look at this and tested it.

Revision history for this message
Mirco Müller (macslow) wrote :

I just ran unity8 on the desktop. When hitting the hardware-multimedia keys for volume-up/down the notification-daemon from unity8 picks up the triggered volume-notifications and displays them on the unity8-shell.

Revision history for this message
Ted Gould (ted) wrote :

On Wed, 2014-09-17 at 17:25 +0000, Mirco Müller wrote:

> I just ran unity8 on the desktop. When hitting the hardware-multimedia
> keys for volume-up/down the notification-daemon from unity8 picks up
> the triggered volume-notifications and displays them on the
> unity8-shell.

Cool, good that works. I was more concerned about the case of running
Unity7 and having indicator-sound and ubuntu-settings-daemon both
sending synchronous notifications to notify-osd.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Mirco Müller (macslow) wrote :

> ...
> Cool, good that works. I was more concerned about the case of running
> Unity7 and having indicator-sound and ubuntu-settings-daemon both
> sending synchronous notifications to notify-osd.

There is no harm in that. Both synchronous notifications (from ubuntu-settings-daemon and indicator-sound) are rendered correctly by unity7 (via notify-osd) and unity8 (via notification-plugin). Since they will also report the same volume-status there also no risk of the user seeing wrong information being displayed.

Revision history for this message
Ted Gould (ted) wrote :

Cool, great!

review: Approve
Revision history for this message
Ted Gould (ted) wrote :

Uhg, sorry took to long to land and it seems this no conflicts with trunk. Sorry!

review: Needs Fixing
Revision history for this message
Ted Gould (ted) wrote :

Figured out a work around :-)

review: Approve
Revision history for this message
Michał Sawicz (saviq) wrote :

Testing this with the unity8 parts shows that the values as displayed in the notification seem to be from the previous change, meaning that if you switch direction, you will see a change counter to the direction you pressed the button.

review: Needs Information

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/volume-control.vala'
2--- src/volume-control.vala 2014-04-18 17:41:44 +0000
3+++ src/volume-control.vala 2014-09-19 17:43:29 +0000
4@@ -19,6 +19,7 @@
5 */
6
7 using PulseAudio;
8+using Notify;
9
10 [CCode(cname="pa_cvolume_set", cheader_filename = "pulse/volume.h")]
11 extern unowned PulseAudio.CVolume? vol_set (PulseAudio.CVolume? cv, uint channels, PulseAudio.Volume v);
12@@ -51,6 +52,7 @@
13 private uint _accountservice_volume_timer = 0;
14 private bool _send_next_local_volume = false;
15 private double _account_service_volume = 0.0;
16+ private Notify.Notification _notification;
17
18 public signal void volume_changed (double v);
19 public signal void mic_volume_changed (double v);
20@@ -68,6 +70,13 @@
21
22 _mute_cancellable = new Cancellable ();
23 _volume_cancellable = new Cancellable ();
24+
25+ Notify.init ("Volume");
26+ _notification = new Notify.Notification("Volume", "", "audio-volume-muted");
27+ _notification.set_hint ("value", 0);
28+ _notification.set_hint ("x-canonical-private-synchronous", "true");
29+ _notification.set_hint ("x-canonical-non-shaped-icon", "true");
30+
31 setup_accountsservice.begin ();
32
33 this.reconnect_to_pulse ();
34@@ -340,8 +349,21 @@
35
36 public void set_volume (double volume)
37 {
38- if (set_volume_internal (volume))
39+ if (_volume == 0.0)
40+ _notification.update ("Volume", "", "audio-volume-muted");
41+ if (_volume > 0.0 && _volume <= 0.33)
42+ _notification.update ("Volume", "", "audio-volume-low");
43+ if (_volume > 0.33 && _volume <= 0.66)
44+ _notification.update ("Volume", "", "audio-volume-medium");
45+ if (_volume > 0.66 && _volume <= 1.0)
46+ _notification.update ("Volume", "", "audio-volume-high");
47+ _notification.set_hint ("value", _volume * 100.0);
48+ _notification.set_hint ("sound-file", "/usr/share/sounds/ubuntu/stereo/message.ogg");
49+ _notification.show ();
50+
51+ if (set_volume_internal (volume)) {
52 start_local_volume_timer();
53+ }
54 }
55
56 void set_mic_volume_success_cb (Context c, int success)

Subscribers

People subscribed via source and target branches