changeset 64:b1d7336cba85

[gaim-migrate @ 74] Changed how the sounds work for the applet - it's configurable now! :) committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Mon, 27 Mar 2000 03:52:12 +0000
parents 12894b62d206
children 26bb564367a5
files Makefile.am gaim_applet.soundlist sounds/Makefile.am src/sound.c
diffstat 4 files changed, 65 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile.am	Mon Mar 27 03:16:21 2000 +0000
+++ b/Makefile.am	Mon Mar 27 03:52:12 2000 +0000
@@ -1,5 +1,6 @@
 
-EXTRA_DIST = gaim_applet.gnorba gaim_applet.desktop buddytrans
+EXTRA_DIST = gaim_applet.gnorba gaim_applet.desktop gaim_applet.soundlist \
+	buddytrans
 
 if GNOMEAPPLET
 
@@ -11,6 +12,10 @@
 gaimdesktopdir = $(datadir)/applets/Network
 gaimdesktop_DATA = $(gaim_DESKTOP)
 
+gaim_SOUND = gaim_applet.soundlist
+gaimsounddir = $(sysconfdir)/sound/events
+gaimsound_DATA = $(gaim_SOUND)
+
 endif
 
 SUBDIRS = m4 libfaim sounds pixmaps doc src
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gaim_applet.soundlist	Mon Mar 27 03:52:12 2000 +0000
@@ -0,0 +1,18 @@
+[__section_info__]
+description=Gaim soundlist
+
+[login]
+file=gaim/BuddyArrive.au
+description=User signed on
+
+[leave]
+file=gaim/BuddyLeave.au
+description=User signed off
+
+[send]
+file=gaim/Send.au
+description=Send a message
+
+[recv]
+file=gaim/Receive.au
+description=Receive a message
--- a/sounds/Makefile.am	Mon Mar 27 03:16:21 2000 +0000
+++ b/sounds/Makefile.am	Mon Mar 27 03:52:12 2000 +0000
@@ -18,4 +18,7 @@
 Receive.h: au2h Receive.au                              
 	./au2h Receive.au Receive.h                  
 
-
+if GNOMEAPPLET
+gaimsoundsdir = $(datadir)/sounds/gaim
+gaimsounds_DATA = $(EXTRA_DIST)
+endif
--- a/src/sound.c	Mon Mar 27 03:16:21 2000 +0000
+++ b/src/sound.c	Mon Mar 27 03:52:12 2000 +0000
@@ -19,6 +19,7 @@
  *
  */
 
+#ifndef USE_APPLET
 #include <stdio.h>
 #include <string.h>
 #include <sys/time.h>
@@ -288,6 +289,41 @@
 			play(Receive, sizeof(Receive));
 		break;
        }
+}
 
-			
+#else /* USE_APPLET */
+
+#include "gaim.h"
+#include <libgnome/gnome-triggers.h>
+void play_sound(int sound)
+{
+
+	switch(sound) {
+	case BUDDY_ARRIVE:
+		if (sound_options & OPT_SOUND_LOGIN)
+			gnome_triggers_do("", "program", "gaim_applet", "login", NULL);
+		break;
+	case BUDDY_LEAVE:
+		if (sound_options & OPT_SOUND_LOGOUT)
+			gnome_triggers_do("", "program", "gaim_applet", "leave", NULL);
+		break;
+	case SEND:
+		if (sound_options & OPT_SOUND_SEND)
+			gnome_triggers_do("", "program", "gaim_applet", "send", NULL);
+		break;
+        case FIRST_RECEIVE:
+		if (sound_options & OPT_SOUND_FIRST_RCV)
+			gnome_triggers_do("", "program", "gaim_applet", "recv", NULL);
+		break;
+        case RECEIVE:
+		if (sound_options & OPT_SOUND_RECV)
+			gnome_triggers_do("", "program", "gaim_applet", "recv", NULL);
+		break;
+	case AWAY:
+		if (sound_options & OPT_SOUND_WHEN_AWAY)
+			gnome_triggers_do("", "program", "gaim_applet", "recv", NULL);
+		break;
+       }
 }
+
+#endif /* USE_APPLET */