xchat-gnome r2652 - in trunk: . plugins/sound-notification



Author: cosimoc
Date: Fri Sep  5 13:28:38 2008
New Revision: 2652
URL: http://svn.gnome.org/viewvc/xchat-gnome?rev=2652&view=rev

Log:
2008-09-05  Cosimo Cecchi  <cosimoc gnome org>

	* configure.ac:
	* plugins/sound-notification/Makefile.am:
	* plugins/sound-notification/sound-notification.c: (new_msg_cb),
	(xchat_plugin_init), (xchat_plugin_deinit):
	Use libcanberra-gtk instead of gnome_sound API (#550984).


Modified:
   trunk/ChangeLog
   trunk/configure.ac
   trunk/plugins/sound-notification/Makefile.am
   trunk/plugins/sound-notification/sound-notification.c

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac	(original)
+++ trunk/configure.ac	Fri Sep  5 13:28:38 2008
@@ -26,7 +26,7 @@
 DBUS_GLIB_REQUIRED=0.60
 LIBSEXY_REQUIRED=0.1.11
 LIBNOTIFY_REQUIRED=0.3.2
-
+LIBCANBERRAGTK_REQUIRED=0.3
 
 AC_PROG_CC
 AM_PROG_CC_C_O
@@ -118,6 +118,15 @@
 	AC_MSG_WARN([Library requirements (libnotify >= $LIBNOTIFY_REQUIRED) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.])
 fi
 
+# libcanberra-gtk soft dependency
+PKG_CHECK_MODULES([LIBCANBERRAGTK], [libcanberra-gtk >= $LIBCANBERRAGTK_REQUIRED], libcanberra=yes, libcanberra=no)
+AC_SUBST([LIBCANBERRAGTK_CFLAGS])
+AC_SUBST([LIBCANBERRAGTK_LIBS])
+AM_CONDITIONAL([ENABLE_LIBCANBERRA],[test "x$libcanberra" = "xyes"])
+if test "x$libcanberra" != "xyes"; then
+        AC_MSG_WARN([Library requirements (libcanberra-gtk >= $LIBCANBERRAGTK_REQUIRED) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.])
+fi
+
 # GConf
 AM_GCONF_SOURCE_2
 AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
@@ -327,14 +336,22 @@
 AM_CONDITIONAL(USE_MMX, test "x$mmx" = "xyes")
 
 # plugins
-ALL_PLUGINS="autoaway notification url_scraper sound-notification"
+ALL_PLUGINS="autoaway notification url_scraper"
+CANBERRA_PLUGINS="sound-notification"
 DBUS_PLUGINS="net-monitor"
 LIBNOTIFY_PLUGINS="notify-osd"
 PYTHON_PLUGINS="python"
 PERL_PLUGINS="perl"
 TCL_PLUGINS="tcl"
 
-DIST_PLUGINS="$ALL_PLUGINS $DBUS_PLUGINS $LIBNOTIFY_PLUGINS $PYTHON_PLUGINS $PERL_PLUGINS $TCL_PLUGINS"
+DIST_PLUGINS="$ALL_PLUGINS $CANBERRA_PLUGINS $DBUS_PLUGINS $LIBNOTIFY_PLUGINS $PYTHON_PLUGINS $PERL_PLUGINS $TCL_PLUGINS"
+
+# canberra specific plugins
+if test "x$libcanberra" = "xyes"; then
+	ALL_PLUGINS="$ALL_PLUGINS $CANBERRA_PLUGINS"
+else
+	AC_MSG_WARN([xchat-gnome compiled without libcanberra support, plugins $CANBERRA_PLUGINS will not be available])
+fi
 
 # dbus-specific plugins
 if test "x$dbus" = "xyes"; then

Modified: trunk/plugins/sound-notification/Makefile.am
==============================================================================
--- trunk/plugins/sound-notification/Makefile.am	(original)
+++ trunk/plugins/sound-notification/Makefile.am	Fri Sep  5 13:28:38 2008
@@ -12,9 +12,12 @@
 
 soundnotification_la_CFLAGS = \
 	$(DEPENDENCIES_CFLAGS)			\
+	$(LIBCANBERRAGTK_CFLAGS)		\
 	$(AM_CFLAGS)
 
 soundnotification_la_LDFLAGS = \
 	-avoid-version 	\
 	-module		\
 	$(AM_LDFLAGS)
+
+soundnotification_la_LIBADD = $(LIBCANBERRAGTK_LIBS)

Modified: trunk/plugins/sound-notification/sound-notification.c
==============================================================================
--- trunk/plugins/sound-notification/sound-notification.c	(original)
+++ trunk/plugins/sound-notification/sound-notification.c	Fri Sep  5 13:28:38 2008
@@ -21,13 +21,13 @@
 
 #include <config.h>
 #include <gtk/gtk.h>
-#include <libgnome/libgnome.h>
+#include <canberra-gtk.h>
 
 #include "plugins.h"
 #include "xchat-plugin.h"
 #include "xg-plugin.h"
 
-#define SOUND_NOTIFICATION_VERSION "0.1"
+#define SOUND_NOTIFICATION_VERSION "0.2"
 
 void xchat_plugin_get_info   (char **plugin_name, char **plugin_desc, char **plugin_version, void **reserved);
 int  xchat_plugin_init       (xchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg);
@@ -41,10 +41,11 @@
 static int
 new_msg_cb (char **word, void *msg_lvl)
 {
-	if (g_file_test ("../../data/message.wav", G_FILE_TEST_EXISTS))
-		gnome_sound_play ("../../data/message.wav");
-	else
-		gnome_sound_play (XCHATSHAREDIR "/message.wav");
+	ca_context_play (ca_gtk_context_get (), 0,
+			 CA_PROP_APPLICATION_NAME, _("XChat-GNOME IRC Chat"),
+			 CA_PROP_EVENT_ID, "message-new-instant",
+			 CA_PROP_EVENT_DESCRIPTION, _("New message received"),
+			 NULL);
 	return 0;
 }
 
@@ -74,8 +75,6 @@
 {
 	ph = plugin_handle;
 
-	gnome_sound_init ("localhost");
-
 	/* Set the plugin info. */
 	xchat_plugin_get_info (plugin_name, plugin_desc, plugin_version, NULL);
 
@@ -92,7 +91,6 @@
 int
 xchat_plugin_deinit (void)
 {
-	gnome_sound_shutdown ();
 	xchat_print (ph, _("Sound-notification plugin unloaded.\n"));
 
 	return 1;



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