1
0
Fork 0

core: Make MetaBell use MetaSoundPlayer to play the bell sound

Instead of using libcanberra/gtk+.
This commit is contained in:
Carlos Garnacho 2018-12-09 12:58:00 +01:00
parent 12f8325cbc
commit 8715f7481b

View file

@ -51,8 +51,6 @@
#include "core/bell.h" #include "core/bell.h"
#include <canberra-gtk.h>
#include "compositor/compositor-private.h" #include "compositor/compositor-private.h"
#include "core/util-private.h" #include "core/util-private.h"
#include "core/window-private.h" #include "core/window-private.h"
@ -246,27 +244,14 @@ static gboolean
bell_audible_notify (MetaDisplay *display, bell_audible_notify (MetaDisplay *display,
MetaWindow *window) MetaWindow *window)
{ {
ca_proplist *p; MetaSoundPlayer *player;
int res;
ca_proplist_create (&p); player = meta_display_get_sound_player (display);
ca_proplist_sets (p, CA_PROP_EVENT_ID, "bell-window-system"); meta_sound_player_play_from_theme (player,
ca_proplist_sets (p, CA_PROP_EVENT_DESCRIPTION, _("Bell event")); "bell-window-system",
ca_proplist_sets (p, CA_PROP_CANBERRA_CACHE_CONTROL, "permanent"); _("Bell event"),
NULL);
if (window) return TRUE;
{
ca_proplist_sets (p, CA_PROP_WINDOW_NAME, window->title);
ca_proplist_setf (p, CA_PROP_WINDOW_X11_XID, "%lu", (unsigned long)window->xwindow);
ca_proplist_sets (p, CA_PROP_APPLICATION_NAME, window->res_name);
ca_proplist_setf (p, CA_PROP_APPLICATION_PROCESS_ID, "%d", window->net_wm_pid);
}
res = ca_context_play_full (ca_gtk_context_get (), 1, p, NULL, NULL);
ca_proplist_destroy (p);
return res == CA_SUCCESS || res == CA_ERROR_DISABLED;
} }
gboolean gboolean