volume: Port to MetaSoundPlayer for emitting sounds

Move away from ShellGlobal API, which is too tightly coupled to
libcanberra-gtk.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/327
This commit is contained in:
Carlos Garnacho 2018-12-13 20:33:45 +01:00 committed by Florian Müllner
parent 25bfe99ed5
commit a6002652d0

View File

@ -57,6 +57,7 @@ var StreamSlider = new Lang.Class({
}); });
this._stream = null; this._stream = null;
this._volumeCancellable = null;
}, },
get stream() { get stream() {
@ -129,11 +130,14 @@ var StreamSlider = new Lang.Class({
}, },
_notifyVolumeChange() { _notifyVolumeChange() {
global.cancel_theme_sound(VOLUME_NOTIFY_ID); if (this._volumeCancellable)
global.play_theme_sound(VOLUME_NOTIFY_ID, this._volumeCancellable.cancel();
'audio-volume-change',
_("Volume changed"), this._volumeCancellable = new Gio.Cancellable();
Clutter.get_current_event ()); let player = global.display.get_sound_player();
player.play_from_theme('audio-volume-change',
_("Volume changed"),
this._volumeCancellable);
}, },
_updateVolume() { _updateVolume() {