Mercurial > pidgin
changeset 10922:68083504217c
[gaim-migrate @ 12691]
Play sounds in non-ASCII paths (win32)
committer: Tailor Script <tailor@pidgin.im>
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Mon, 16 May 2005 00:20:26 +0000 |
parents | 9f75886e4f1f |
children | accfd1f1f80d |
files | src/gtksound.c |
diffstat | 1 files changed, 13 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/gtksound.c Sun May 15 18:55:28 2005 +0000 +++ b/src/gtksound.c Mon May 16 00:20:26 2005 +0000 @@ -390,8 +390,19 @@ #else /* _WIN32 */ gaim_debug_info("sound", "Playing %s\n", filename); - if (!PlaySound(filename, 0, SND_ASYNC | SND_FILENAME)) - 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 */ }