diff options
-rw-r--r-- | .gitlab-ci.yml | 2 | ||||
-rw-r--r-- | lib/bluetooth-settings-obexpush.c | 23 | ||||
-rw-r--r-- | lib/meson.build | 2 | ||||
-rw-r--r-- | meson.build | 2 |
4 files changed, 19 insertions, 10 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8ec39f7c..9f7d6813 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -6,7 +6,7 @@ variables: gobject-introspection-devel gtk3-devel systemd-devel - libcanberra-devel + gsound-devel libnotify-devel meson redhat-rpm-config diff --git a/lib/bluetooth-settings-obexpush.c b/lib/bluetooth-settings-obexpush.c index 9243062c..1b07f3ec 100644 --- a/lib/bluetooth-settings-obexpush.c +++ b/lib/bluetooth-settings-obexpush.c @@ -29,10 +29,10 @@ #include <glib/gstdio.h> #include <glib/gi18n-lib.h> #include <gio/gio.h> +#include <gsound.h> #include <gtk/gtk.h> #include <bluetooth-client.h> #include <libnotify/notify.h> -#include <canberra-gtk.h> #include "bluetooth-settings-obexpush.h" @@ -67,6 +67,7 @@ G_DEFINE_TYPE(ObexAgent, obex_agent, G_TYPE_OBJECT) static ObexAgent *agent; static BluetoothClient *client; static GCancellable *cancellable; +static GSoundContext *gsound_context; static void on_close_notification (NotifyNotification *notification) @@ -130,7 +131,6 @@ show_notification (const char *filename) { char *file_uri, *notification_text, *display, *mime_type; NotifyNotification *notification; - ca_context *ctx; GAppInfo *app; file_uri = g_filename_to_uri (filename, NULL, NULL); @@ -172,11 +172,12 @@ show_notification (const char *filename) g_free (notification_text); /* Now we do the audio notification */ - ctx = ca_gtk_context_get (); - ca_context_play (ctx, 0, - CA_PROP_EVENT_ID, "complete-download", - CA_PROP_EVENT_DESCRIPTION, _("File reception complete"), - NULL); + if (gsound_context) { + gsound_context_play_simple (gsound_context, cancellable, NULL, + GSOUND_ATTR_EVENT_ID, "complete-download", + GSOUND_ATTR_EVENT_DESCRIPTION, _("File reception complete"), + NULL); + } } static void @@ -852,4 +853,12 @@ obex_agent_up (void) g_assert (cancellable == NULL); cancellable = g_cancellable_new (); + + if (gsound_context == NULL) { + g_autoptr(GError) error = NULL; + + gsound_context = gsound_context_new (cancellable, &error); + if (!gsound_context) + g_warning ("Failed to open sound context: %s", error->message); + } } diff --git a/lib/meson.build b/lib/meson.build index 5080a952..91e176ff 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -74,7 +74,7 @@ deps = [ private_deps = [ gio_unix_dep, - libcanberra_gtk_dep, + gsound_dep, libnotify_dep, libudev_dep, ] diff --git a/meson.build b/meson.build index 79bf7a24..badeb896 100644 --- a/meson.build +++ b/meson.build @@ -100,7 +100,7 @@ add_project_arguments(common_flags + compiler_flags, language: 'c') gio_dep = dependency('gio-2.0', version: '>= 2.44') gio_unix_dep = dependency('gio-unix-2.0') gtk_dep = dependency('gtk+-3.0', version: '>= 3.12.0') -libcanberra_gtk_dep = dependency('libcanberra-gtk3') +gsound_dep = dependency('gsound') libnotify_dep = dependency('libnotify', version: '>= 0.7.0') libudev_dep = dependency('libudev') |