diff src/gtksound.c @ 6199:eb0fedc1ac09

[gaim-migrate @ 6685] music to my ears committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Fri, 18 Jul 2003 01:36:53 +0000
parents 059d95c67cda
children 8f94cce8faa5
line wrap: on
line diff
--- a/src/gtksound.c	Fri Jul 18 01:34:45 2003 +0000
+++ b/src/gtksound.c	Fri Jul 18 01:36:53 2003 +0000
@@ -54,6 +54,7 @@
 
 static gboolean mute_login_sounds = FALSE;
 static gboolean mute_sounds = FALSE;
+static gboolean sound_initialized = FALSE;
 static char *sound_cmd = NULL;
 
 static struct gaim_sound_event sounds[GAIM_NUM_SOUNDS] = {
@@ -115,7 +116,6 @@
 
 	gaim_prefs_connect_callback("/gaim/gtk/sound/method",
 			_pref_sound_method_changed, NULL);
-	gaim_prefs_trigger_callback("/gaim/gtk/sound/method");
 }
 
 
@@ -124,6 +124,7 @@
 #ifdef USE_AO
 	ao_shutdown();
 #endif
+	sound_initialized = FALSE;
 }
 
 static void gaim_gtk_sound_play_file(const char *filename)
@@ -136,6 +137,9 @@
 #endif
 #endif
 
+	if (!sound_initialized)
+		gaim_prefs_trigger_callback("/gaim/gtk/sound/method");
+
 	if (mute_sounds)
 		return;
 
@@ -308,6 +312,8 @@
 
 static void _pref_sound_method_changed(const char *name, GaimPrefType type,
 		gpointer val, gpointer data) {
+	sound_initialized = TRUE;
+
 	if(type != GAIM_PREF_STRING || strcmp(name, "/gaim/gtk/sound/method"))
 		return;
 #ifdef USE_AO