changeset 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 01aeab85636c
children 668eadc46990
files ChangeLog src/gtkimhtml.c src/gtkimhtml.h
diffstat 3 files changed, 12 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Jul 06 21:44:58 2003 +0000
+++ b/ChangeLog	Sun Jul 06 22:03:40 2003 +0000
@@ -28,6 +28,8 @@
 	* Ability to view iChat "Available" messages for AIM
 	* Stores your buddy icon on the server for AIM
 	* Support for non-ascii characters with Yahoo! Messenger
+	* F2 toggles the display of timestamps retroactively once again 
+	  (Thanks Ka-Hing Cheung)
 
 version 0.64 (05/29/2003):
 	* Buddy list sorting in buddy list preferences.
--- 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
--- a/src/gtkimhtml.h	Sun Jul 06 21:44:58 2003 +0000
+++ b/src/gtkimhtml.h	Sun Jul 06 22:03:40 2003 +0000
@@ -37,6 +37,7 @@
 #define GTK_IS_IMHTML(obj)         (GTK_CHECK_TYPE ((obj), GTK_TYPE_IMHTML))
 #define GTK_IS_IMHTML_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_IMHTML))
 #define GTK_IMHTML_SCALABLE(obj)   ((GtkIMHtmlScalable *)obj)
+#define GTK_IMHTML_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_IMHTML, GtkIMHtmlClass))
 
 typedef struct _GtkIMHtml			GtkIMHtml;
 typedef struct _GtkIMHtmlClass		GtkIMHtmlClass;
@@ -58,7 +59,6 @@
 	GtkSmileyTree *default_smilies;
 
 	gboolean show_smileys;
-	gboolean show_comments;
 
 	GtkWidget *tip_window;
 	char *tip;