clean up canberra code

This commit is contained in:
TingPing 2013-04-27 20:29:28 -03:00
parent bc1169e979
commit 78f9f3f87c
1 changed files with 11 additions and 14 deletions

View File

@ -2205,7 +2205,7 @@ sound_beep (session *sess)
void void
sound_play (const char *file, gboolean quiet) sound_play (const char *file, gboolean quiet)
{ {
char *buf; char *buf;
char *wavfile; char *wavfile;
#ifndef WIN32 #ifndef WIN32
char *cmd; char *cmd;
@ -2243,21 +2243,18 @@ sound_play (const char *file, gboolean quiet)
#ifdef USE_LIBCANBERRA #ifdef USE_LIBCANBERRA
ca_context_create (&con); ca_context_create (&con);
/* TODO: Volume setting? */ /* TODO: Volume setting? */
if (ca_context_play (con, 0, if (ca_context_play (con, 0, CA_PROP_MEDIA_FILENAME, wavfile, NULL) != 0)
CA_PROP_MEDIA_FILENAME, wavfile, NULL) == 0)
{
g_free (wavfile);
return;
}
#endif #endif
cmd = g_find_program_in_path ("play");
if (cmd)
{ {
buf = g_strdup_printf ("%s \"%s\"", cmd, wavfile); cmd = g_find_program_in_path ("play");
hexchat_exec (buf);
g_free (buf); if (cmd)
g_free (cmd); {
buf = g_strdup_printf ("%s \"%s\"", cmd, wavfile);
hexchat_exec (buf);
g_free (buf);
g_free (cmd);
}
} }
#endif #endif
} }