[balsa] Initial support for libcanberra-gtk



commit 70aa0a686b2d7093ec26837bef683a995bb3a1eb
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Tue Aug 4 07:23:13 2009 -0400

    Initial support for libcanberra-gtk

 ChangeLog         |    7 +++++++
 configure.in      |   19 +++++++++++++++++++
 libbalsa/filter.c |   17 +++++++++++++----
 3 files changed, 39 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 1c0f79c..4bfbb52 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-08-04  Peter Bloomfield
+
+	* configure.in: new option --with-canberra=no.
+	* libbalsa/filter.c (libbalsa_filter_mailbox_messages): use
+	libcanberra-gtk in preference to libgnome for filter sounds.
+
 2009-08-02  Peter Bloomfield
 
 	* src/sendmsg-window.c (bsmsg_set_subject_from_body): use
@@ -19,6 +25,7 @@
 2006-07-30  Pawel Salek
 
 	* libbalsa/imap/imap-commands.c: lock LIST fixed.
+
 2009-07-28  Peter Bloomfield
 
 	* libbalsa/address-view.c (lbav_add_from_list),
diff --git a/configure.in b/configure.in
index b24bc1e..587ce10 100644
--- a/configure.in
+++ b/configure.in
@@ -211,6 +211,11 @@ AC_ARG_WITH(unique,
                   [Use libUnique instead of BonoboActivation (default=no)]),
                   [with_unique=$withval],[with_unique=no])
 
+AC_ARG_WITH(canberra,
+   AC_HELP_STRING([--with-canberra],
+                  [Use libcanberra-gtk2 for filter sounds (default=no)]),
+                  [with_canberra=$withval],[with_canberra=no])
+
 AC_ARG_ENABLE(more-warnings,
    AC_HELP_STRING([--enable-more-warnings],
                   [Enable maximum compiler warnings (default=yes)]),
@@ -784,6 +789,19 @@ else
 fi
 AM_CONDITIONAL([BUILD_WITH_UNIQUE], [test $with_unique = "yes" ])
 
+# libcanberra configuration
+#
+AC_MSG_CHECKING([whether to build with canberra])
+if test x$with_canberra != xno; then
+    AC_MSG_RESULT([yes])
+    PKG_CHECK_MODULES(CANBERRA, [ libcanberra-gtk ])
+    AC_DEFINE(HAVE_CANBERRA,1,[Defined when canberra can be used.])
+    BALSA_CFLAGS="$BALSA_CFLAGS $CANBERRA_CFLAGS"
+    BALSA_LIBS="$BALSA_LIBS $CANBERRA_LIBS"
+else
+    AC_MSG_RESULT([no])
+fi
+
 # ige-mac-integration (Mac OS X desktop only)
 AC_MSG_CHECKING([whether to include Mac OS X Desktop Integration])
 if test x$use_igemacint != xno; then
@@ -980,6 +998,7 @@ echo "                Use ESMTP : $with_esmtp"
 echo " Use WebKit (experimental): $use_webkit"
 echo " Use Unique (experimental): $with_unique"
 echo "                 Use GNOME: $with_gnome"
+echo "              Use Canberra: $with_canberra"
 echo "               Use GtkHTML: $use_gtkhtml"
 echo "                 Use GPGME: $gpgmecfg"
 echo "                  Use LDAP: $with_ldap"
diff --git a/libbalsa/filter.c b/libbalsa/filter.c
index 49f07de..7c0f6bd 100644
--- a/libbalsa/filter.c
+++ b/libbalsa/filter.c
@@ -37,9 +37,11 @@
 #include <ctype.h>
 #include <string.h>
 
-#ifdef HAVE_GNOME
+#if HAVE_CANBERRA
+#include <canberra-gtk.h>
+#elif HAVE_GNOME
 #include <libgnome/gnome-sound.h>
-#endif
+#endif                          /* HAVE_CANBERRA */
 
 #include "libbalsa.h"
 #include "libbalsa_private.h"
@@ -254,10 +256,17 @@ libbalsa_filter_mailbox_messages(LibBalsaFilter * filt,
     if (msgnos->len == 0)
 	return FALSE;
 
-#ifdef HAVE_GNOME
+#if HAVE_CANBERRA
+    if (filt->sound) {
+        gint rc = ca_context_play(ca_gtk_context_get(), 0,
+                                  CA_PROP_MEDIA_FILENAME, filt->sound,
+                                  NULL);
+        g_message("(%s) play %s, %s", __func__, filt->sound, ca_strerror(rc));
+    }
+#elif HAVE_GNOME
     if (filt->sound)
 	gnome_sound_play(filt->sound);
-#endif /* HAVE_GNOME */
+#endif                          /* HAVE_CANBERRA */
     if (filt->popup_text)
 	libbalsa_information(LIBBALSA_INFORMATION_MESSAGE,
 			     "%s",



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