Use bundled beep file for beep alerts

This commit is contained in:
Berke Viktor 2013-04-14 11:56:50 +02:00
parent 9272eb4325
commit ea0479998a
7 changed files with 21 additions and 11 deletions

View File

@ -843,7 +843,7 @@ load_config (void)
g_free (buf);
buf = g_build_filename (get_xdir (), "sounds", "beep.wav", NULL);
#ifdef WIN32
#ifdef WIN32 /* keep this in sync with fe-gtk.c! */
beepsrc = g_file_new_for_path (HEXCHATSHAREDIR G_DIR_SEPARATOR_S "share" G_DIR_SEPARATOR_S "beep.wav");
#else
beepsrc = g_file_new_for_path (HEXCHATSHAREDIR G_DIR_SEPARATOR_S "hexchat" G_DIR_SEPARATOR_S "beep.wav");

View File

@ -175,7 +175,7 @@ ctcp_handle (session *sess, char *to, char *nick, char *ip,
#else
if (strchr (word[5], '/') == NULL)
#endif
sound_play (word[5], TRUE);
sound_play (word[5], TRUE, FALSE);
return;
}
}

View File

@ -3161,7 +3161,7 @@ cmd_splay (struct session *sess, char *tbuf, char *word[], char *word_eol[])
{
if (*word[2])
{
sound_play (word[2], FALSE);
sound_play (word[2], FALSE, FALSE);
return TRUE;
}

View File

@ -2218,7 +2218,7 @@ sound_find_command (void)
}
void
sound_play (const char *file, gboolean quiet)
sound_play (const char *file, gboolean quiet, gboolean hexchat_beep)
{
char *buf;
char *wavfile;
@ -2233,10 +2233,10 @@ sound_play (const char *file, gboolean quiet)
return;
#ifdef WIN32
/* check for fullpath */
if (file[0] == '\\' || (((file[0] >= 'A' && file[0] <= 'Z') || (file[0] >= 'a' && file[0] <= 'z')) && file[1] == ':'))
/* check for fullpath; also use full path if hexchat_beep is TRUE, which should *only* happen when invoked by fe_beep() */
if (hexchat_beep || file[0] == '\\' || (((file[0] >= 'A' && file[0] <= 'Z') || (file[0] >= 'a' && file[0] <= 'z')) && file[1] == ':'))
#else
if (file[0] == '/')
if (hexchat_beep || file[0] == '/')
#endif
{
wavfile = g_strdup (file);
@ -2308,7 +2308,7 @@ void
sound_play_event (int i)
{
if (sound_files[i])
sound_play (sound_files[i], FALSE);
sound_play (sound_files[i], FALSE, FALSE);
}
static void

View File

@ -53,7 +53,7 @@ int get_stamp_str (char *fmt, time_t tim, char **ret);
void format_event (session *sess, int index, char **args, char *o, int sizeofo, unsigned int stripcolor_args);
char *text_find_format_string (char *name);
void sound_play (const char *file, gboolean quiet);
void sound_play (const char *file, gboolean quiet, gboolean hexchat_beep);
void sound_play_event (int i);
void sound_beep (session *);
void sound_load ();

View File

@ -669,8 +669,18 @@ fe_print_text (struct session *sess, char *text, time_t stamp)
void
fe_beep (session *sess)
{
char *beepfile;
if (!prefs.hex_gui_focus_omitalerts || !fe_gui_info (sess, 0) == 1)
gdk_beep ();
{
#ifdef WIN32 /* keep this in sync with cfgfiles.c! */
beepfile = g_build_filename (HEXCHATSHAREDIR, "share", "beep.wav", NULL);
#else
beepfile = g_build_filename (HEXCHATSHAREDIR, "hexchat", "beep.wav", NULL);
#endif
sound_play (beepfile, FALSE, TRUE);
g_free (beepfile);
}
}
void

View File

@ -1654,7 +1654,7 @@ setup_snd_browse_cb (GtkWidget *button, GtkEntry *entry)
static void
setup_snd_play_cb (GtkWidget *button, GtkEntry *entry)
{
sound_play (entry->text, FALSE);
sound_play (entry->text, FALSE, FALSE);
}
static void