[gnome-shell/wip/carlosg/sound-abstraction: 2/5] messageTray: Port to MetaSoundPlayer for emitting sounds



commit 505cd0f9c766143c6e071904922a0d8e7151563c
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Dec 13 20:32:16 2018 +0100

    messageTray: Port to MetaSoundPlayer for emitting sounds
    
    Move away from ShellGlobal API, which is too tightly coupled to
    libcanberra-gtk. The app ID/name seem unused in canberra, so we
    may simplify this to a single case.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/327

 js/ui/messageTray.js | 26 +++++---------------------
 1 file changed, 5 insertions(+), 21 deletions(-)
---
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index eebc93fdf..fc4e00c9d 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -448,27 +448,11 @@ var Notification = new Lang.Class({
             return;
         }
 
-        if (this._soundName) {
-            if (this.source.app) {
-                let app = this.source.app;
-
-                global.play_theme_sound_full(0, this._soundName,
-                                             this.title, null,
-                                             app.get_id(), app.get_name());
-            } else {
-                global.play_theme_sound(0, this._soundName, this.title, null);
-            }
-        } else if (this._soundFile) {
-            if (this.source.app) {
-                let app = this.source.app;
-
-                global.play_sound_file_full(0, this._soundFile,
-                                            this.title, null,
-                                            app.get_id(), app.get_name());
-            } else {
-                global.play_sound_file(0, this._soundFile, this.title, null);
-            }
-        }
+        let player = global.display.get_sound_player();
+        if (this._soundName)
+            player.play_from_theme(this._soundName, this.title, null);
+        else if (this._soundFile)
+            player.play_from_file(this._soundFile, this.title, null);
     },
 
     // Allow customizing the banner UI:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]