comparison 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
comparison
equal deleted inserted replaced
6198:fcc28f5dd0c8 6199:eb0fedc1ac09
52 52
53 53
54 54
55 static gboolean mute_login_sounds = FALSE; 55 static gboolean mute_login_sounds = FALSE;
56 static gboolean mute_sounds = FALSE; 56 static gboolean mute_sounds = FALSE;
57 static gboolean sound_initialized = FALSE;
57 static char *sound_cmd = NULL; 58 static char *sound_cmd = NULL;
58 59
59 static struct gaim_sound_event sounds[GAIM_NUM_SOUNDS] = { 60 static struct gaim_sound_event sounds[GAIM_NUM_SOUNDS] = {
60 {N_("Buddy logs in"), "login", "arrive.wav"}, 61 {N_("Buddy logs in"), "login", "arrive.wav"},
61 {N_("Buddy logs out"), "logout", "leave.wav"}, 62 {N_("Buddy logs out"), "logout", "leave.wav"},
113 ao_initialize(); 114 ao_initialize();
114 #endif /* USE_AO */ 115 #endif /* USE_AO */
115 116
116 gaim_prefs_connect_callback("/gaim/gtk/sound/method", 117 gaim_prefs_connect_callback("/gaim/gtk/sound/method",
117 _pref_sound_method_changed, NULL); 118 _pref_sound_method_changed, NULL);
118 gaim_prefs_trigger_callback("/gaim/gtk/sound/method");
119 } 119 }
120 120
121 121
122 static void gaim_gtk_sound_shutdown(void) 122 static void gaim_gtk_sound_shutdown(void)
123 { 123 {
124 #ifdef USE_AO 124 #ifdef USE_AO
125 ao_shutdown(); 125 ao_shutdown();
126 #endif 126 #endif
127 sound_initialized = FALSE;
127 } 128 }
128 129
129 static void gaim_gtk_sound_play_file(const char *filename) 130 static void gaim_gtk_sound_play_file(const char *filename)
130 { 131 {
131 const char *method; 132 const char *method;
133 pid_t pid; 134 pid_t pid;
134 #ifdef USE_AO 135 #ifdef USE_AO
135 AFfilehandle file; 136 AFfilehandle file;
136 #endif 137 #endif
137 #endif 138 #endif
139
140 if (!sound_initialized)
141 gaim_prefs_trigger_callback("/gaim/gtk/sound/method");
138 142
139 if (mute_sounds) 143 if (mute_sounds)
140 return; 144 return;
141 145
142 method = gaim_prefs_get_string("/gaim/gtk/sound/method"); 146 method = gaim_prefs_get_string("/gaim/gtk/sound/method");
306 } 310 }
307 311
308 312
309 static void _pref_sound_method_changed(const char *name, GaimPrefType type, 313 static void _pref_sound_method_changed(const char *name, GaimPrefType type,
310 gpointer val, gpointer data) { 314 gpointer val, gpointer data) {
315 sound_initialized = TRUE;
316
311 if(type != GAIM_PREF_STRING || strcmp(name, "/gaim/gtk/sound/method")) 317 if(type != GAIM_PREF_STRING || strcmp(name, "/gaim/gtk/sound/method"))
312 return; 318 return;
313 #ifdef USE_AO 319 #ifdef USE_AO
314 ao_driver = -1; 320 ao_driver = -1;
315 321