aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--calendar/gui/alarm-notify/alarm-queue.c5
-rw-r--r--configure.ac10
-rw-r--r--mail/mail-session.c8
-rw-r--r--plugins/mail-notification/mail-notification.c9
4 files changed, 29 insertions, 3 deletions
diff --git a/calendar/gui/alarm-notify/alarm-queue.c b/calendar/gui/alarm-notify/alarm-queue.c
index 53963da5eb..5544d49c99 100644
--- a/calendar/gui/alarm-notify/alarm-queue.c
+++ b/calendar/gui/alarm-notify/alarm-queue.c
@@ -30,7 +30,10 @@
#include <glib.h>
#include <gtk/gtk.h>
#include <glib/gi18n.h>
+
+#ifdef HAVE_CANBERRA
#include <canberra-gtk.h>
+#endif
#include <libecal/e-cal-time-util.h>
#include <libecal/e-cal-component.h>
@@ -1632,9 +1635,11 @@ audio_notification (time_t trigger, CompQueuedAlarms *cqa,
g_error_free (error);
} else if (g_file_test (filename, G_FILE_TEST_EXISTS)) {
flag = 1;
+#ifdef HAVE_CANBERRA
ca_context_play (
ca_gtk_context_get(), 0,
CA_PROP_MEDIA_FILENAME, filename, NULL);
+#endif
}
g_free (filename);
diff --git a/configure.ac b/configure.ac
index 7115f98983..a9a91f7b5d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -254,7 +254,15 @@ PKG_CHECK_MODULES([EVOLUTION_DATA_SERVER],
dnl ******************************
dnl Canberra / Canberra-GTK Sound
dnl ******************************
-PKG_CHECK_MODULES([CANBERRA],[libcanberra-gtk])
+AC_ARG_ENABLE([canberra],
+ [AS_HELP_STRING([--enable-canberra],
+ [Enable Canberra and Canberra-GTK sound @<:@default=yes@:>@])],
+ [enable_canberra="$enableval"], [enable_canberra=yes])
+
+if test $enable_canberra = yes; then
+ PKG_CHECK_MODULES([CANBERRA],[libcanberra-gtk])
+ AC_DEFINE(HAVE_CANBERRA, 1, [Define if using Canberra and Canberra-GTK for sound])
+fi
AC_SUBST(CANBERRA_CFLAGS)
AC_SUBST(CANBERRA_LIBS)
diff --git a/mail/mail-session.c b/mail/mail-session.c
index 967909d6e3..14aec15866 100644
--- a/mail/mail-session.c
+++ b/mail/mail-session.c
@@ -33,7 +33,9 @@
#include <gconf/gconf-client.h>
+#ifdef HAVE_CANBERRA
#include <canberra-gtk.h>
+#endif
#include <libedataserverui/e-passwords.h>
#include <libedataserver/e-flag.h>
@@ -462,11 +464,13 @@ get_folder (CamelFilterDriver *d, const gchar *uri, gpointer data, CamelExceptio
static void
main_play_sound (CamelFilterDriver *driver, gchar *filename, gpointer user_data)
{
- if (filename && *filename)
+ if (filename && *filename) {
+#ifdef HAVE_CANBERRA
ca_context_play(ca_gtk_context_get(), 0,
CA_PROP_MEDIA_FILENAME, filename,
NULL);
- else
+#endif
+ } else
gdk_beep ();
g_free (filename);
diff --git a/plugins/mail-notification/mail-notification.c b/plugins/mail-notification/mail-notification.c
index ab4fcda689..22b0eeacd1 100644
--- a/plugins/mail-notification/mail-notification.c
+++ b/plugins/mail-notification/mail-notification.c
@@ -29,7 +29,10 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <gconf/gconf-client.h>
+
+#ifdef HAVE_CANBERRA
#include <canberra-gtk.h>
+#endif
#include <dbus/dbus-glib.h>
#include <dbus/dbus-glib-lowlevel.h>
@@ -659,12 +662,15 @@ get_config_widget_status (void)
#define GCONF_KEY_SOUND_PLAY_FILE GCONF_KEY_ROOT "sound-play-file"
#define GCONF_KEY_SOUND_USE_THEME GCONF_KEY_ROOT "sound-use-theme"
+#ifdef HAVE_CANBERRA
static ca_context *mailnotification = NULL;
+#endif
static void
do_play_sound (gboolean beep, gboolean use_theme, const gchar *file)
{
if (!beep) {
+#ifdef HAVE_CANBERRA
if (!use_theme && file && *file)
ca_context_play(mailnotification, 0,
CA_PROP_MEDIA_FILENAME, file,
@@ -673,6 +679,7 @@ do_play_sound (gboolean beep, gboolean use_theme, const gchar *file)
ca_context_play(mailnotification, 0,
CA_PROP_EVENT_ID,"message-new-email",
NULL);
+#endif
}
else
gdk_beep();
@@ -778,6 +785,7 @@ read_notify_sound (EMEventTargetMessage *t)
static void
enable_sound (gint enable)
{
+#ifdef HAVE_CANBERRA
if (enable) {
ca_context_create(&mailnotification);
ca_context_change_props(
@@ -788,6 +796,7 @@ enable_sound (gint enable)
}
else
ca_context_destroy(mailnotification);
+#endif
}
static GtkWidget *