gaim/gaim

Play sounds in non-ASCII paths (win32)
oldstatus
2005-05-15, Daniel Atallah
4d99f8de26ba
Parents 3770305c569c
Children 225748167155
Play sounds in non-ASCII paths (win32)
--- a/src/gtksound.c Sun May 15 14:53:53 2005 -0400
+++ b/src/gtksound.c Sun May 15 20:17:37 2005 -0400
@@ -279,8 +279,19 @@
#else /* _WIN32 */
gaim_debug(GAIM_DEBUG_INFO, "sound", "Playing %s\n", filename);
- if (!PlaySound(filename, 0, SND_ASYNC | SND_FILENAME))
- gaim_debug(GAIM_DEBUG_ERROR, "sound", "Error playing sound.\n");
+ if (G_WIN32_HAVE_WIDECHAR_API ()) {
+ wchar_t *wc_filename = g_utf8_to_utf16(filename,
+ -1, NULL, NULL, NULL);
+ if (!PlaySoundW(wc_filename, NULL, SND_ASYNC | SND_FILENAME))
+ gaim_debug(GAIM_DEBUG_ERROR, "sound", "Error playing sound.\n");
+ g_free(wc_filename);
+ } else {
+ char *l_filename = g_locale_from_utf8(filename,
+ -1, NULL, NULL, NULL);
+ if (!PlaySoundA(l_filename, NULL, SND_ASYNC | SND_FILENAME))
+ gaim_debug(GAIM_DEBUG_ERROR, "sound", "Error playing sound.\n");
+ g_free(l_filename);
+ }
#endif /* _WIN32 */
}