From 87992a57e5f517d5ceb5dfabaea662ac64983720 Mon Sep 17 00:00:00 2001
From: Markus Volk <f_l_k@t-online.de>
Date: Fri, 27 May 2022 18:37:53 +0200
Subject: [PATCH] pavucontrol: remove canberra-gtk support

libcanberra-gtk3 module isn't buildable for wayland.
Remove its dpendency.

Signed-off-by: Markus Volk <f_l_k@t-online.de>

Upstream-Status: Inappropriate
---
 configure.ac           |  2 +-
 src/pavuapplication.cc |  2 --
 src/pavucontrol.cc     |  4 ----
 src/sinkwidget.cc      | 17 -----------------
 4 files changed, 1 insertion(+), 24 deletions(-)

diff --git a/configure.ac b/configure.ac
index 056ba5e..e857563 100644
--- a/configure.ac
+++ b/configure.ac
@@ -41,7 +41,7 @@ AC_TYPE_SIGNAL
 AC_HEADER_STDC
 AX_CXX_COMPILE_STDCXX_11
 
-PKG_CHECK_MODULES(GUILIBS, [ gtkmm-3.0 >= 3.22 sigc++-2.0 libcanberra-gtk3 >= 0.16 json-glib-1.0 ])
+PKG_CHECK_MODULES(GUILIBS, [ gtkmm-3.0 >= 3.22 sigc++-2.0 json-glib-1.0 ])
 AC_SUBST(GUILIBS_CFLAGS)
 AC_SUBST(GUILIBS_LIBS)
 
diff --git a/src/pavuapplication.cc b/src/pavuapplication.cc
index 6773b53..60c016c 100644
--- a/src/pavuapplication.cc
+++ b/src/pavuapplication.cc
@@ -24,8 +24,6 @@
 
 #include "i18n.h"
 
-#include <canberra-gtk.h>
-
 #include "pavuapplication.h"
 #include "pavucontrol.h"
 #include "mainwindow.h"
diff --git a/src/pavucontrol.cc b/src/pavucontrol.cc
index 18d5400..10ab646 100644
--- a/src/pavucontrol.cc
+++ b/src/pavucontrol.cc
@@ -29,8 +29,6 @@
 #include <json-glib/json-glib.h>
 #endif
 
-#include <canberra-gtk.h>
-
 #include "pavucontrol.h"
 #include "i18n.h"
 #include "minimalstreamwidget.h"
@@ -916,8 +914,6 @@ MainWindow* pavucontrol_get_window(pa_glib_mainloop *m, bool maximize, bool _ret
     tab_number = _tab_number;
     retry = _retry;
 
-    ca_context_set_driver(ca_gtk_context_get(), "pulse");
-
     mainWindow = MainWindow::create(maximize);
 
     api = pa_glib_mainloop_get_api(m);
diff --git a/src/sinkwidget.cc b/src/sinkwidget.cc
index f30bd37..482fd1f 100644
--- a/src/sinkwidget.cc
+++ b/src/sinkwidget.cc
@@ -24,7 +24,6 @@
 
 #include "sinkwidget.h"
 
-#include <canberra-gtk.h>
 #if HAVE_EXT_DEVICE_RESTORE_API
 #  include <pulse/format.h>
 #  include <pulse/ext-device-restore.h>
@@ -111,7 +110,6 @@ SinkWidget* SinkWidget::create(MainWindow* mainWindow) {
 void SinkWidget::executeVolumeUpdate() {
     pa_operation* o;
     char dev[64];
-    int playing = 0;
 
     if (!(o = pa_context_set_sink_volume_by_index(get_context(), index, &volume, NULL, NULL))) {
         show_error(_("pa_context_set_sink_volume_by_index() failed"));
@@ -120,22 +118,7 @@ void SinkWidget::executeVolumeUpdate() {
 
     pa_operation_unref(o);
 
-    ca_context_playing(ca_gtk_context_get(), 2, &playing);
-    if (playing)
-        return;
-
     snprintf(dev, sizeof(dev), "%lu", (unsigned long) index);
-    ca_context_change_device(ca_gtk_context_get(), dev);
-
-    ca_gtk_play_for_widget(GTK_WIDGET(gobj()),
-                           2,
-                           CA_PROP_EVENT_DESCRIPTION, _("Volume Control Feedback Sound"),
-                           CA_PROP_EVENT_ID, "audio-volume-change",
-                           CA_PROP_CANBERRA_CACHE_CONTROL, "permanent",
-                           CA_PROP_CANBERRA_ENABLE, "1",
-                           NULL);
-
-    ca_context_change_device(ca_gtk_context_get(), NULL);
 }
 
 void SinkWidget::onMuteToggleButton() {
-- 
2.25.1

