diff src/gtkimhtml.c @ 6046:19cb60247a6c

[gaim-migrate @ 6496] F2 toggles timestamps retroactively again. Very nice patch Ka-Hing. Thanks, thanks. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sun, 06 Jul 2003 22:03:40 +0000
parents 460b4ba2d452
children 395116fdd270
line wrap: on
line diff
--- a/src/gtkimhtml.c	Sun Jul 06 21:44:58 2003 +0000
+++ b/src/gtkimhtml.c	Sun Jul 06 22:03:40 2003 +0000
@@ -385,7 +385,6 @@
 	imhtml->arrow_cursor = gdk_cursor_new (GDK_LEFT_PTR);
 
 	imhtml->show_smileys = TRUE;
-	imhtml->show_comments = TRUE;
 
 	imhtml->smiley_data = g_hash_table_new_full(g_str_hash, g_str_equal,
 			g_free, (GDestroyNotify)gtk_smiley_tree_destroy);
@@ -401,6 +400,8 @@
 	imhtml->tip_window = NULL;
 
 	imhtml->scalables = NULL;
+
+	gtk_text_buffer_create_tag(imhtml->text_buffer, "comment", "invisible", FALSE, NULL);
 }
 
 GtkWidget *gtk_imhtml_new(void *a, void *b)
@@ -961,6 +962,9 @@
 								imhtml->scalables = g_list_append(imhtml->scalables, scalable); \
 								gtk_text_buffer_get_end_iter(imhtml->text_buffer, &iter); \
                         } \
+						if (x == NEW_COMMENT_BIT) { \
+							gtk_text_buffer_apply_tag_by_name(imhtml->text_buffer, "comment", &siter, &iter); \
+						} \
 
 
 
@@ -1317,8 +1321,7 @@
 					break;
 				case 59:	/* comment */
 					NEW_BIT (NEW_TEXT_BIT);
-					if (imhtml->show_comments)
-						wpos = g_snprintf (ws, len, "%s", tag);
+					wpos = g_snprintf (ws, len, "%s", tag);
 					NEW_BIT (NEW_COMMENT_BIT);
 					break;
 				default:
@@ -1446,7 +1449,9 @@
 void       gtk_imhtml_show_comments    (GtkIMHtml        *imhtml,
 					gboolean          show)
 {
-	imhtml->show_comments = show;
+	GtkTextTagTable *table = gtk_text_buffer_get_tag_table(imhtml->text_buffer);
+	GtkTextTag *tag = gtk_text_tag_table_lookup(table, "comment");
+	g_object_set(G_OBJECT(tag), "invisible", !show, NULL);
 }
 
 void