diff src/gtkprefs.c @ 10074:2e225cd35615

[gaim-migrate @ 11054] This is some sound related stuff. Add a "No Sounds" sound method for those who like their Gaim to be really really quiet, switched to using the prefs API for mute_sounds, added a Mute Sounds entry to the buddy list tools menu so those without a system tray icon can use this, and kill off old child sound processes (any older than 15 seconds) which should fix bug #1034209. committer: Tailor Script <tailor@pidgin.im>
author Stu Tomlinson <stu@nosnilmot.com>
date Sat, 02 Oct 2004 18:53:19 +0000
parents 83eb12b1f1a1
children 4670b7fd1a89
line wrap: on
line diff
--- a/src/gtkprefs.c	Sat Oct 02 15:28:03 2004 +0000
+++ b/src/gtkprefs.c	Sat Oct 02 18:53:19 2004 +0000
@@ -80,7 +80,9 @@
 static guint browser_pref1_id = 0;
 static guint browser_pref2_id = 0;
 static guint proxy_pref_id = 0;
-static guint sound_pref_id = 0;
+static guint sound_pref1_id = 0;
+static guint sound_pref2_id = 0;
+static guint sound_pref3_id = 0;
 static guint auto_resp_pref_id = 0;
 static guint placement_pref_id = 0;
 
@@ -383,7 +385,9 @@
 	gaim_prefs_disconnect_callback(browser_pref1_id);
 	gaim_prefs_disconnect_callback(browser_pref2_id);
 	gaim_prefs_disconnect_callback(proxy_pref_id);
-	gaim_prefs_disconnect_callback(sound_pref_id);
+	gaim_prefs_disconnect_callback(sound_pref1_id);
+	gaim_prefs_disconnect_callback(sound_pref2_id);
+	gaim_prefs_disconnect_callback(sound_pref3_id);
 	gaim_prefs_disconnect_callback(auto_resp_pref_id);
 	gaim_prefs_disconnect_callback(placement_pref_id);
 
@@ -1487,7 +1491,7 @@
 }
 
 static void
-sound_changed_cb(const char *name, GaimPrefType type, gpointer value,
+sound_changed1_cb(const char *name, GaimPrefType type, gpointer value,
 				   gpointer data)
 {
 	GtkWidget *hbox = data;
@@ -1495,6 +1499,16 @@
 
 	gtk_widget_set_sensitive(hbox, !strcmp(method, "custom"));
 }
+
+static void
+sound_changed2_cb(const char *name, GaimPrefType type, gpointer value,
+				   gpointer data)
+{
+	GtkWidget *vbox = data;
+	const char *method = value;
+
+	gtk_widget_set_sensitive(vbox, strcmp(method, "none"));
+}
 #endif
 
 
@@ -1645,12 +1659,6 @@
 
 	sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
 
-	vbox = gaim_gtk_make_frame (ret, _("Sound Options"));
-	gaim_gtk_prefs_checkbox(_("Sounds when conversation has _focus"),
-				   "/gaim/gtk/sound/conv_focus", vbox);
-	gaim_gtk_prefs_checkbox(_("_Sounds while away"),
-				   "/core/sound/while_away", vbox);
-
 #ifndef _WIN32
 	vbox = gaim_gtk_make_frame (ret, _("Sound Method"));
 	dd = gaim_gtk_prefs_dropdown(vbox, _("_Method:"), GAIM_PREF_STRING,
@@ -1665,6 +1673,7 @@
 			"NAS", "nas",
 #endif
 			_("Command"), "custom",
+			_("No sounds"), "none",
 			NULL);
 	gtk_size_group_add_widget(sg, dd);
 	gtk_misc_set_alignment(GTK_MISC(dd), 0, 0);
@@ -1693,12 +1702,23 @@
 	gtk_widget_set_sensitive(hbox,
 			!strcmp(gaim_prefs_get_string("/gaim/gtk/sound/method"),
 					"custom"));
-	sound_pref_id = gaim_prefs_connect_callback("/gaim/gtk/sound/method",
-												  sound_changed_cb, hbox);
+	sound_pref1_id = gaim_prefs_connect_callback("/gaim/gtk/sound/method",
+												  sound_changed1_cb, hbox);
 
 	gaim_set_accessible_label (entry, label);
 #endif /* _WIN32 */
 
+	vbox = gaim_gtk_make_frame (ret, _("Sound Options"));
+	gaim_gtk_prefs_checkbox(_("Sounds when conversation has _focus"),
+				   "/gaim/gtk/sound/conv_focus", vbox);
+	gaim_gtk_prefs_checkbox(_("_Sounds while away"),
+				   "/core/sound/while_away", vbox);
+
+	gtk_widget_set_sensitive(vbox,
+			strcmp(gaim_prefs_get_string("/gaim/gtk/sound/method"), "none"));
+	sound_pref2_id = gaim_prefs_connect_callback("/gaim/gtk/sound/method",
+												  sound_changed2_cb, vbox);
+
 	vbox = gaim_gtk_make_frame(ret, _("Sound Events"));
 
 	/* The following is an ugly hack to make the frame expand so the
@@ -1789,6 +1809,11 @@
 	gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1);
 	gtk_widget_show_all(ret);
 
+	gtk_widget_set_sensitive(vbox,
+			strcmp(gaim_prefs_get_string("/gaim/gtk/sound/method"), "none"));
+	sound_pref3_id = gaim_prefs_connect_callback("/gaim/gtk/sound/method",
+												  sound_changed2_cb, vbox);
+
 	return ret;
 }