changeset 9550:de83d2cb87a4

[gaim-migrate @ 10379] " When unqueuing messages and "sounds while away" is set, Gaim will play a message receieved for every message unqueued. If there are a large number of messages, my SB Audigy tries playing them all and ends up creating a crackly ugly sound. Friends of mine have complained about this as well. This patch fixes that by making sure sounds are disabled when unqueuing messages. Sounds will be re-enabled afterwards if necessary. Something to note is that playing the sounds when unqueuing messages crashes Gaim on occasion, with about 50% success. After applying this patch, the crashes stopped. The backtrace isn't particularly helpful...it's all question marks and valgrind doesn't say much either. Crash or no crash though, this eliminates annoying behavior so that is probably more important. I originally fixed this for my plugin AutoProfile, but since they use similar code for queuing messages, it would be nice if Gaim has it as well :)" --Casey Ho committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Fri, 16 Jul 2004 14:56:47 +0000
parents d80ed3ba45a4
children 3b43d817ea24
files src/away.c
diffstat 1 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/away.c	Fri Jul 16 14:52:52 2004 +0000
+++ b/src/away.c	Fri Jul 16 14:56:47 2004 +0000
@@ -57,6 +57,11 @@
 	gchar *name;
 	GSList *templist;
 	GaimConversation *cnv;
+	gboolean orig_while_away;
+
+	orig_while_away = gaim_prefs_get_bool("/core/sound/while_away");
+	if (orig_while_away)
+		gaim_prefs_set_bool("/core/sound/while_away", FALSE);
 
 	gtk_tree_model_get(GTK_TREE_MODEL(awayqueuestore), iter, 0, &name, -1);
 
@@ -97,6 +102,9 @@
 	/* In GTK 2.2, _store_remove actually returns whether iter is valid or not
 	 * after the remove, but in GTK 2.0 it is a void function. */
 	gtk_list_store_remove(awayqueuestore, iter);
+
+	if (orig_while_away)
+		gaim_prefs_set_bool("/core/sound/while_away", orig_while_away);
 }
 
 void purge_away_queue(GSList **queue)
@@ -105,6 +113,11 @@
 	struct queued_message *qm;
 	GaimConversation *cnv;
 	GaimAccount *account;
+	gboolean orig_while_away;
+
+	orig_while_away = gaim_prefs_get_bool("/core/sound/while_away");
+	if (orig_while_away)
+		gaim_prefs_set_bool("/core/sound/while_away", FALSE);
 
 	while (q) {
 		qm = q->data;
@@ -132,6 +145,9 @@
 
 	g_slist_free(*queue);
 	*queue = NULL;
+
+	if (orig_while_away)
+		gaim_prefs_set_bool("/core/sound/while_away", orig_while_away);
 }
 
 gint dequeue_cb(GtkWidget *treeview, GdkEventButton *event, gpointer data) {