CVS: sylpheedclaws/sylpheed-claws/src/gtk logwindow.c,1.1.4.22,1.1.4.23

[email protected] Sun, 17 Dec 2006 11:54:02 +0000
Newsgroups gmane.mail.sylpheed.claws.cvs
Message-ID <[email protected]>
Update of /pack/anoncvs/sylpheedclaws/sylpheed-claws/src/gtk
In directory sunsite.dk:/tmp/cvs-serv2474/src/gtk

Modified Files:
      Tag: gtk2
	logwindow.c 
Log Message:
2006-12-17 [colin]	2.6.1cvs45

	* src/gtk/logwindow.c
		Fix bug 1067, 'Claws-Mail uses 100% CPU on an 
		IMAP folder and is blocked on main thread': 
		make sure we put utf8 in the log.

Index: logwindow.c
===================================================================
RCS file: /pack/anoncvs/sylpheedclaws/sylpheed-claws/src/gtk/logwindow.c,v
retrieving revision 1.1.4.22
retrieving revision 1.1.4.23
diff -u -d -r1.1.4.22 -r1.1.4.23
--- logwindow.c	2006/11/07 10:40:25	1.1.4.22
+++ logwindow.c	2006/12/17 11:53:57	1.1.4.23
@@ -291,9 +291,17 @@
 	if (head)
 		gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, head, -1,
 							 tag, NULL);
-	gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, logtext->text, -1,
-						 tag, NULL);
 
+	if (!g_utf8_validate(logtext->text, -1, NULL)) {
+		gchar * mybuf = g_malloc(strlen(logtext->text)*2 +1);
+		conv_localetodisp(mybuf, strlen(logtext->text)*2 +1, logtext->text);
+		gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, mybuf, -1,
+							 tag, NULL);
+		g_free(mybuf);
+	} else {
+		gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, logtext->text, -1,
+							 tag, NULL);
+	}
 	gtk_text_buffer_get_start_iter(buffer, &iter);
 
 	if (logwindow->clip)