changeset 3025:0486d3d00d0e

[gaim-migrate @ 3038] Reworked sound preference by Robert McQueen. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Sat, 09 Mar 2002 18:39:46 +0000
parents d17e7255c3cb
children 14b7262739e2
files src/gaim.h src/plugins.c src/prefs.c src/sound.c
diffstat 4 files changed, 29 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/gaim.h	Sat Mar 09 03:11:02 2002 +0000
+++ b/src/gaim.h	Sat Mar 09 18:39:46 2002 +0000
@@ -276,6 +276,7 @@
 #define OPT_SOUND_NAS			0x00004000
 #define OPT_SOUND_ARTSC			0x00008000
 #define OPT_SOUND_ESD			0x00010000
+#define OPT_SOUND_CMD			0x00020000
 
 #define BUDDY_ARRIVE 0
 #define BUDDY_LEAVE 1
--- a/src/plugins.c	Sat Mar 09 03:11:02 2002 +0000
+++ b/src/plugins.c	Sat Mar 09 18:39:46 2002 +0000
@@ -189,7 +189,7 @@
 	gtk_widget_show(tophbox);
 
 	/* Left side: frame with list of plugin file names */
-	frame = gtk_frame_new(_("Plugins"));
+	frame = gtk_frame_new(_("Loaded Plugins"));
 	gtk_box_pack_start(GTK_BOX(tophbox), frame, FALSE, FALSE, 0);
 	gtk_widget_set_usize(frame, 140, -1);
 	gtk_container_set_border_width(GTK_CONTAINER(frame), 6);
--- a/src/prefs.c	Sat Mar 09 03:11:02 2002 +0000
+++ b/src/prefs.c	Sat Mar 09 18:39:46 2002 +0000
@@ -1519,7 +1519,7 @@
 
 	gaim_button(label, &sound_options, opt, hbox);
 
-	button = gtk_button_new_with_label(_("Play"));
+	button = gtk_button_new_with_label(_("Test"));
 	gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 3);
 	gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(test_sound), (void *)snd);
 	gtk_widget_show(button);
@@ -1556,8 +1556,14 @@
 
 static void set_sound_driver(GtkWidget *w, int option)
 {
+	if (option == OPT_SOUND_CMD)
+		gtk_widget_set_sensitive(sndcmd, TRUE);
+	else
+		gtk_widget_set_sensitive(sndcmd, FALSE);
+
 	sound_options &= ~(OPT_SOUND_NORMAL | OPT_SOUND_BEEP |
-			   OPT_SOUND_NAS | OPT_SOUND_ARTSC | OPT_SOUND_ESD);
+			   OPT_SOUND_NAS | OPT_SOUND_ARTSC |
+			   OPT_SOUND_ESD | OPT_SOUND_CMD);
 	sound_options |= option;
 	save_prefs();
 }
@@ -1671,7 +1677,7 @@
 	i++;
 #endif
 
-	opt = gtk_menu_item_new_with_label("Native");
+	opt = gtk_menu_item_new_with_label("Internal");
 	gtk_signal_connect(GTK_OBJECT(opt), "activate",
 			   GTK_SIGNAL_FUNC(set_sound_driver), 
 			   (gpointer)OPT_SOUND_NORMAL);
@@ -1680,6 +1686,15 @@
 	if ((sound_options & OPT_SOUND_NORMAL) && !driver) driver = i;
 	i++;
 
+	opt = gtk_menu_item_new_with_label("Command");
+	gtk_signal_connect(GTK_OBJECT(opt), "activate",
+			   GTK_SIGNAL_FUNC(set_sound_driver), 
+			   (gpointer)OPT_SOUND_CMD);
+	gtk_widget_show(opt);
+	gtk_menu_append(GTK_MENU(menu), opt);
+	if ((sound_options & OPT_SOUND_CMD) && !driver) driver = i;
+	i++;
+
 	gtk_option_menu_set_menu(GTK_OPTION_MENU(omenu), menu);
 	gtk_option_menu_set_history(GTK_OPTION_MENU(omenu), driver - 1);
 	gtk_box_pack_start(GTK_BOX(hbox), omenu, FALSE, FALSE, 5);
@@ -1693,7 +1708,7 @@
 	gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5);
 	gtk_widget_show(hbox);
 
-	label = gtk_label_new(_("Command to play sound files\n(%s for filename; internal if empty)"));
+	label = gtk_label_new(_("Command to play sound files\n(%s for filename)"));
 	gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
 	gtk_widget_show(label);
 
@@ -1702,6 +1717,7 @@
 	gtk_entry_set_text(GTK_ENTRY(sndcmd), sound_cmd);
 	gtk_box_pack_end(GTK_BOX(hbox), sndcmd, FALSE, FALSE, 5);
 	gtk_signal_connect(GTK_OBJECT(sndcmd), "focus_out_event", GTK_SIGNAL_FUNC(sound_cmd_yeah), NULL);
+	gtk_widget_set_sensitive(sndcmd, (OPT_SOUND_CMD & sound_options));
 	gtk_widget_show(sndcmd);
 
 	frame = gtk_frame_new(_("Events"));
--- a/src/sound.c	Sat Mar 09 03:11:02 2002 +0000
+++ b/src/sound.c	Sat Mar 09 18:39:46 2002 +0000
@@ -403,7 +403,7 @@
 	else if (pid == 0) {
 		alarm(30);
 		
-		if (sound_cmd[0]) {
+		if ((sound_options & OPT_SOUND_CMD) && sound_cmd[0]) {
 			char *args[4];
 			char command[4096];
 
@@ -460,6 +460,12 @@
 		gdk_beep();
 		return;
 	}
+
+	else if ((sound_options & OPT_SOUND_CMD) && sound_cmd[0]) {
+		debug_printf("can't play internal sound with external command -- skipping\n");
+		return;
+	}
+
 	pid = fork();
 	
 	if (pid < 0)