[gnome-shell/wip/carlosg/sound-abstraction: 2/4] volume: Port to MetaSoundPlayer for emitting sounds
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/carlosg/sound-abstraction: 2/4] volume: Port to MetaSoundPlayer for emitting sounds
- Date: Tue, 8 Jan 2019 18:15:00 +0000 (UTC)
commit 8b7d40e59675efbf82ca7a65b7c9cc0b45129622
Author: Carlos Garnacho <carlosg gnome org>
Date: Thu Dec 13 20:33:45 2018 +0100
volume: Port to MetaSoundPlayer for emitting sounds
Move away from ShellGlobal API, which is too tightly coupled to
libcanberra-gtk.
js/ui/status/volume.js | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/js/ui/status/volume.js b/js/ui/status/volume.js
index 00af791a6..019030570 100644
--- a/js/ui/status/volume.js
+++ b/js/ui/status/volume.js
@@ -57,6 +57,7 @@ var StreamSlider = new Lang.Class({
});
this._stream = null;
+ this._volumeCancellable = null;
},
get stream() {
@@ -129,11 +130,14 @@ var StreamSlider = new Lang.Class({
},
_notifyVolumeChange() {
- global.cancel_theme_sound(VOLUME_NOTIFY_ID);
- global.play_theme_sound(VOLUME_NOTIFY_ID,
- 'audio-volume-change',
- _("Volume changed"),
- Clutter.get_current_event ());
+ if (this._volumeCancellable)
+ this._volumeCancellable.cancel();
+
+ this._volumeCancellable = new Gio.Cancellable();
+ let player = global.display.get_sound_player();
+ player.play_from_theme('audio-volume-change',
+ _("Volume changed"),
+ this._volumeCancellable);
},
_updateVolume() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]