[mutter/wip/carlosg/sound-abstraction: 3/4] workspace: Port to MetaSoundPlayer



commit 085f918195916f68b46d2ccc54b9488f427388ca
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Dec 17 23:38:43 2018 +0100

    workspace: Port to MetaSoundPlayer
    
    Use MetaSoundPlayer to play workspace switch sounds, instead of using
    libcanberra directly.

 src/core/workspace.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)
---
diff --git a/src/core/workspace.c b/src/core/workspace.c
index 1f129fd12..a88c9784c 100644
--- a/src/core/workspace.c
+++ b/src/core/workspace.c
@@ -37,9 +37,6 @@
 
 #include <X11/Xatom.h>
 #include <string.h>
-#ifdef HAVE_LIBCANBERRA
-#include <canberra-gtk.h>
-#endif
 
 #include "backends/meta-backend-private.h"
 #include "backends/meta-logical-monitor.h"
@@ -441,7 +438,7 @@ static void
 workspace_switch_sound(MetaWorkspace *from,
                        MetaWorkspace *to)
 {
-#ifdef HAVE_LIBCANBERRA
+  MetaSoundPlayer *player;
   MetaWorkspaceLayout layout;
   int i, nw, x, y, fi, ti;
   const char *e;
@@ -489,15 +486,11 @@ workspace_switch_sound(MetaWorkspace *from,
       goto finish;
     }
 
-  ca_context_play(ca_gtk_context_get(), 1,
-                  CA_PROP_EVENT_ID, e,
-                  CA_PROP_EVENT_DESCRIPTION, "Desktop switched",
-                  CA_PROP_CANBERRA_CACHE_CONTROL, "permanent",
-                  NULL);
+  player = meta_display_get_sound_player (from->display);
+  meta_sound_player_play_from_theme (player, e, "Desktop switched", NULL);
 
  finish:
   meta_workspace_manager_free_workspace_layout (&layout);
-#endif /* HAVE_LIBCANBERRA */
 }
 
 /**


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