pidgin: 5ddfc81d: Add a "Mute sounds" tickybox in Prefs, m...

resiak at pidgin.im resiak at pidgin.im
Sat Sep 6 13:25:31 EDT 2008


-----------------------------------------------------------------
Revision: 5ddfc81dc0f91c4427706f288851c42a179ca608
Ancestor: cc588e79152601781e53c9386f48bb14154b063e
Author: resiak at pidgin.im
Date: 2008-09-06T17:13:13
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/5ddfc81dc0f91c4427706f288851c42a179ca608

Modified files:
        pidgin/gtkprefs.c

ChangeLog: 

Add a "Mute sounds" tickybox in Prefs, mirroring Tools/Mute Sounds.

-------------- next part --------------
============================================================
--- pidgin/gtkprefs.c	8c2ed56087f9959d97b13d6ad5242001cb5256ac
+++ pidgin/gtkprefs.c	7dd6593f3e77a3c1d4774f200bbb5d1bcef20391
@@ -1828,6 +1828,25 @@ static void prefs_sound_sel(GtkTreeSelec
 	g_value_unset (&val);
 }
 
+
+static void
+mute_changed_cb(const char *pref_name,
+                PurplePrefType pref_type,
+                gconstpointer val,
+                gpointer data)
+{
+	GtkToggleButton *button = data;
+	gboolean muted = val;
+
+	g_return_if_fail(!strcmp (pref_name, PIDGIN_PREFS_ROOT "/sound/mute"));
+
+	/* Block the handler that re-sets the preference. */
+	g_signal_handlers_block_matched(button, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, pref_name);
+	gtk_toggle_button_set_active (button, muted);
+	g_signal_handlers_unblock_matched(button, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, pref_name);
+}
+
+
 static GtkWidget *
 sound_page(void)
 {
@@ -1889,6 +1908,10 @@ sound_page(void)
 #endif /* _WIN32 */
 
 	vbox = pidgin_make_frame (ret, _("Sound Options"));
+
+	button = pidgin_prefs_checkbox(_("M_ute sounds"), PIDGIN_PREFS_ROOT "/sound/mute", vbox);
+	purple_prefs_connect_callback(prefs, PIDGIN_PREFS_ROOT "/sound/mute", mute_changed_cb, button);
+
 	pidgin_prefs_checkbox(_("Sounds when conversation has _focus"),
 				   PIDGIN_PREFS_ROOT "/sound/conv_focus", vbox);
 	pidgin_prefs_dropdown(vbox, _("Enable sounds:"),


More information about the Commits mailing list