aboutsummaryrefslogtreecommitdiff
path: root/src/volume-control.vala
diff options
context:
space:
mode:
authorMirco Müller <mirco.mueller@canonical.com>2014-07-31 16:46:43 +0200
committerMirco Müller <mirco.mueller@canonical.com>2014-07-31 16:46:43 +0200
commite964fb77076144d577f85260896a18648b5b40f8 (patch)
tree296cdd7f6ad6efdfef4c69b3bef86795c4e0f0a2 /src/volume-control.vala
parent5bac1dc620f1499b6b2bf9d4b0371a5f2e530696 (diff)
downloadayatana-indicator-sound-e964fb77076144d577f85260896a18648b5b40f8.tar.gz
ayatana-indicator-sound-e964fb77076144d577f85260896a18648b5b40f8.tar.bz2
ayatana-indicator-sound-e964fb77076144d577f85260896a18648b5b40f8.zip
Test use of synchronous notifications for volume-changes.
Diffstat (limited to 'src/volume-control.vala')
-rw-r--r--src/volume-control.vala15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/volume-control.vala b/src/volume-control.vala
index 2efa186..5a16621 100644
--- a/src/volume-control.vala
+++ b/src/volume-control.vala
@@ -19,6 +19,7 @@
*/
using PulseAudio;
+using Notify;
[CCode(cname="pa_cvolume_set", cheader_filename = "pulse/volume.h")]
extern unowned PulseAudio.CVolume? vol_set (PulseAudio.CVolume? cv, uint channels, PulseAudio.Volume v);
@@ -51,6 +52,7 @@ public class VolumeControl : Object
private uint _accountservice_volume_timer = 0;
private bool _send_next_local_volume = false;
private double _account_service_volume = 0.0;
+ private Notify.Notification _notification;
public signal void volume_changed (double v);
public signal void mic_volume_changed (double v);
@@ -68,6 +70,13 @@ public class VolumeControl : Object
_mute_cancellable = new Cancellable ();
_volume_cancellable = new Cancellable ();
+
+ Notify.init ("Volume");
+ _notification = new Notify.Notification("Volume", "", "audio-volume-muted");
+ _notification.set_hint ("value", 0);
+ _notification.set_hint ("x-canonical-private-synchronous", "true");
+ _notification.set_hint ("x-canonical-non-shaped-icon", "true");
+
setup_accountsservice.begin ();
this.reconnect_to_pulse ();
@@ -301,8 +310,12 @@ public class VolumeControl : Object
private void set_volume_success_cb (Context c, int success)
{
- if ((bool)success)
+ if ((bool)success) {
volume_changed (_volume);
+ _notification.update ("Volume", "", "audio-volume-medium");
+ _notification.set_hint ("value", _volume);
+ _notification.show ();
+ }
}
private void sink_info_set_volume_cb (Context c, SinkInfo? i, int eol)