summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorBerke Viktor <bviktor@hexchat.org>2013-04-27 23:00:18 +0200
committerBerke Viktor <bviktor@hexchat.org>2013-04-27 23:00:18 +0200
commit6001ceff9f9383c4c3f04e056cd09b118d11b044 (patch)
tree5002d853e10113de30184c943c66984588765581 /src
parent8e3db00daccbad5c0c87c6f6d118a9db44238ab3 (diff)
Get rid of bundled beep
Diffstat (limited to 'src')
-rw-r--r--src/common/cfgfiles.c22
-rw-r--r--src/common/ctcp.c2
-rw-r--r--src/common/outbound.c2
-rw-r--r--src/common/text.c12
-rw-r--r--src/common/text.h2
-rw-r--r--src/fe-gtk/fe-gtk.c13
-rw-r--r--src/fe-gtk/setup.c2
7 files changed, 16 insertions, 39 deletions
diff --git a/src/common/cfgfiles.c b/src/common/cfgfiles.c
index 525e6acd..811733c2 100644
--- a/src/common/cfgfiles.c
+++ b/src/common/cfgfiles.c
@@ -23,8 +23,6 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 
-#include <gio/gio.h>
-
 #include "hexchat.h"
 #include "cfgfiles.h"
 #include "util.h"
@@ -628,8 +626,6 @@ load_config (void)
 #ifdef WIN32
 	char out[256];
 #endif
-	GFile *beepsrc;
-	GFile *beepdest;
 
 	check_prefs_dir ();
 	username = g_get_user_name ();
@@ -847,23 +843,7 @@ load_config (void)
 		g_free (buf);
 
 		buf = g_build_filename (get_xdir (), "sounds", NULL);
-		if (g_mkdir (buf, 0700) == 0)
-		{
-			g_free (buf);
-
-			buf = g_build_filename (get_xdir (), "sounds", "beep.wav", NULL);
-#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 "sounds" G_DIR_SEPARATOR_S "beep.wav");
-#else
-			beepsrc = g_file_new_for_path (HEXCHATSHAREDIR G_DIR_SEPARATOR_S "sounds" G_DIR_SEPARATOR_S "freedesktop" G_DIR_SEPARATOR_S "stereo" G_DIR_SEPARATOR_S "hexchat_beep.wav");
-#endif
-			beepdest = g_file_new_for_path (buf);
-
-			g_file_copy (beepsrc, beepdest, G_FILE_COPY_TARGET_DEFAULT_PERMS, NULL, NULL, NULL, NULL);
-
-			g_object_unref (beepsrc);
-			g_object_unref (beepdest);
-		}
+		g_mkdir (buf, 0700);
 		g_free (buf);
 	}
 	if (prefs.hex_gui_win_height < 138)
diff --git a/src/common/ctcp.c b/src/common/ctcp.c
index 487003a8..ebfb604d 100644
--- a/src/common/ctcp.c
+++ b/src/common/ctcp.c
@@ -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, FALSE);
+				sound_play (word[5], TRUE);
 			return;
 		}
 	}
diff --git a/src/common/outbound.c b/src/common/outbound.c
index 17c7b331..c8d0397d 100644
--- a/src/common/outbound.c
+++ b/src/common/outbound.c
@@ -3161,7 +3161,7 @@ cmd_splay (struct session *sess, char *tbuf, char *word[], char *word_eol[])
 {
 	if (*word[2])
 	{
-		sound_play (word[2], FALSE, FALSE);
+		sound_play (word[2], FALSE);
 		return TRUE;
 	}
 
diff --git a/src/common/text.c b/src/common/text.c
index da677c88..905a3ce9 100644
--- a/src/common/text.c
+++ b/src/common/text.c
@@ -2221,7 +2221,7 @@ sound_find_command (void)
 }
 
 void
-sound_play (const char *file, gboolean quiet, gboolean hexchat_beep)
+sound_play (const char *file, gboolean quiet)
 {
 	char *buf;
 	char *wavfile;
@@ -2234,10 +2234,10 @@ sound_play (const char *file, gboolean quiet, gboolean hexchat_beep)
 	}
 
 #ifdef WIN32
-	/* 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] == ':'))
+	/* check for fullpath */
+	if (file[0] == '\\' || (((file[0] >= 'A' && file[0] <= 'Z') || (file[0] >= 'a' && file[0] <= 'z')) && file[1] == ':'))
 #else
-	if (hexchat_beep || file[0] == '/')
+	if (file[0] == '/')
 #endif
 	{
 		wavfile = g_strdup (file);
@@ -2280,7 +2280,9 @@ void
 sound_play_event (int i)
 {
 	if (sound_files[i])
-		sound_play (sound_files[i], FALSE, FALSE);
+	{
+		sound_play (sound_files[i], FALSE);
+	}
 }
 
 static void
diff --git a/src/common/text.h b/src/common/text.h
index 4d7bbb38..52cc8ea9 100644
--- a/src/common/text.h
+++ b/src/common/text.h
@@ -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, gboolean hexchat_beep);
+void sound_play (const char *file, gboolean quiet);
 void sound_play_event (int i);
 void sound_beep (session *);
 void sound_load ();
diff --git a/src/fe-gtk/fe-gtk.c b/src/fe-gtk/fe-gtk.c
index 603025d1..e11eeaf6 100644
--- a/src/fe-gtk/fe-gtk.c
+++ b/src/fe-gtk/fe-gtk.c
@@ -660,15 +660,10 @@ fe_print_text (struct session *sess, char *text, time_t stamp)
 void
 fe_beep (session *sess)
 {
-	char *beepfile;
-
-#ifdef WIN32	/* keep this in sync with cfgfiles.c! */
-	beepfile = g_build_filename (HEXCHATSHAREDIR, "share", "sounds", "beep.wav", NULL);
-#else
-	beepfile = g_build_filename (HEXCHATSHAREDIR, "sounds", "freedesktop", "stereo", "hexchat_beep.wav", NULL);
-#endif
-	sound_play (beepfile, TRUE, TRUE);
-	g_free (beepfile);
+	if (!prefs.hex_gui_focus_omitalerts || !fe_gui_info (sess, 0) == 1)
+	{
+		gdk_beep ();
+	}
 }
 
 void
diff --git a/src/fe-gtk/setup.c b/src/fe-gtk/setup.c
index 02e8605d..fd239c9d 100644
--- a/src/fe-gtk/setup.c
+++ b/src/fe-gtk/setup.c
@@ -1660,7 +1660,7 @@ setup_snd_browse_cb (GtkWidget *button, GtkEntry *entry)
 static void
 setup_snd_play_cb (GtkWidget *button, GtkEntry *entry)
 {
-	sound_play (entry->text, FALSE, FALSE);
+	sound_play (entry->text, FALSE);
 }
 
 static void