changeset 6066:c99959f1bb73

[gaim-migrate @ 6516] Re-add javabsp's F2 patch. I didn't feel like taking it out of my CVS again, and I think he'll be able to get it working without the weird highlight behavior. Also fixed the ctlr+a/ctrl+pgup/ctrl+pgdown thing in gtkimhtml rather than gtkconv.c. So now it applies to info windows and other stuff. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Wed, 09 Jul 2003 00:33:06 +0000
parents 3a40666c08b4
children 6a3b676eb36a
files ChangeLog src/gtkconv.c src/gtkimhtml.c src/gtkimhtml.h src/protocols/oscar/oscar.c
diffstat 5 files changed, 49 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Jul 08 23:48:10 2003 +0000
+++ b/ChangeLog	Wed Jul 09 00:33:06 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/gtkconv.c	Tue Jul 08 23:48:10 2003 +0000
+++ b/src/gtkconv.c	Wed Jul 09 00:33:06 2003 +0000
@@ -1402,35 +1402,6 @@
 }
 
 /*
- * This function exists to work around some gross bugs in GtkTextView.  
- * Basically, we short circuit ctrl+a and ctrl+end because they make 
- * Gaim go boom.
- *
- * It's supposed to be fixed in gtk2.2.  You can view the bug report at 
- * http://bugzilla.gnome.org/show_bug.cgi?id=107939
- */
-static gboolean
-textview_key_pressed_cb(GtkWidget *entry, GdkEventKey *event, gpointer data)
-{
-	if (event->state & GDK_CONTROL_MASK)
-		switch (event->keyval) {
-			case 'a':
-				return TRUE;
-				break;
-
-			case GDK_Home:
-				return TRUE;
-				break;
-
-			case GDK_End:
-				return TRUE;
-				break;
-		}
-
-	return FALSE;
-}
-
-/*
  * NOTE:
  *   This guy just kills a single right click from being propagated any 
  *   further.  I  have no idea *why* we need this, but we do ...  It 
@@ -3586,11 +3557,6 @@
 			MAX(gaim_prefs_get_int("/gaim/gtk/conversations/im/entry_height"),
 				25));
 
-	/* Connect the signal handlers. */
-	/* XXX - This first one should be removed eventually.  It exists to 
-	 * work around a gtk bug.  See the callback comments for more info. */
-	g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_press_event",
-					 G_CALLBACK(textview_key_pressed_cb), conv);
 	g_signal_connect_swapped(G_OBJECT(gtkconv->entry), "key_press_event",
 							 G_CALLBACK(entry_key_pressed_cb_1),
 							 gtkconv->entry_buffer);
--- a/src/gtkimhtml.c	Tue Jul 08 23:48:10 2003 +0000
+++ b/src/gtkimhtml.c	Wed Jul 09 00:33:06 2003 +0000
@@ -301,6 +301,36 @@
 	return FALSE;
 }
 
+/*
+ * XXX - This should be removed eventually.
+ *
+ * This function exists to work around a gross bug in GtkTextView.  
+ * Basically, we short circuit ctrl+a and ctrl+end because they make 
+ * el program go boom.
+ *
+ * It's supposed to be fixed in gtk2.2.  You can view the bug report at 
+ * http://bugzilla.gnome.org/show_bug.cgi?id=107939
+ */
+gboolean gtk_key_pressed_cb(GtkWidget *imhtml, GdkEventKey *event, gpointer data)
+{
+	if (event->state & GDK_CONTROL_MASK)
+		switch (event->keyval) {
+			case 'a':
+				return TRUE;
+				break;
+
+			case GDK_Home:
+				return TRUE;
+				break;
+
+			case GDK_End:
+				return TRUE;
+				break;
+		}
+
+	return FALSE;
+}
+
 
 
 static GtkTextViewClass *parent_class = NULL;
@@ -385,7 +415,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);
@@ -394,6 +423,7 @@
 	g_signal_connect(G_OBJECT(imhtml), "size-allocate", G_CALLBACK(gtk_size_allocate_cb), NULL);
 	g_signal_connect(G_OBJECT(imhtml), "motion-notify-event", G_CALLBACK(gtk_motion_event_notify), NULL);
 	g_signal_connect(G_OBJECT(imhtml), "leave-notify-event", G_CALLBACK(gtk_leave_event_notify), NULL);
+	g_signal_connect(G_OBJECT(imhtml), "key_press_event", G_CALLBACK(gtk_key_pressed_cb), NULL);
 	gtk_widget_add_events(GTK_WIDGET(imhtml), GDK_LEAVE_NOTIFY_MASK);
 
 	imhtml->tip = NULL;
@@ -401,6 +431,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 +993,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 +1352,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 +1480,14 @@
 void       gtk_imhtml_show_comments    (GtkIMHtml        *imhtml,
 					gboolean          show)
 {
-	imhtml->show_comments = show;
+	GtkTextIter iter;
+	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);
+	gtk_text_buffer_get_end_iter(imhtml->text_buffer, &iter);
+	gtk_text_buffer_move_mark_by_name(imhtml->text_buffer, "insert", &iter);
+	gtk_text_buffer_move_mark_by_name(imhtml->text_buffer, "selection_bound", &iter);
+
 }
 
 void
--- a/src/gtkimhtml.h	Tue Jul 08 23:48:10 2003 +0000
+++ b/src/gtkimhtml.h	Wed Jul 09 00:33:06 2003 +0000
@@ -58,7 +58,6 @@
 	GtkSmileyTree *default_smilies;
 
 	gboolean show_smileys;
-	gboolean show_comments;
 
 	GtkWidget *tip_window;
 	char *tip;
--- a/src/protocols/oscar/oscar.c	Tue Jul 08 23:48:10 2003 +0000
+++ b/src/protocols/oscar/oscar.c	Wed Jul 09 00:33:06 2003 +0000
@@ -1,8 +1,9 @@
 /*
  * gaim
  *
+ * libfaim code copyright 1998, 1999 Adam Fritzler <afritz@auk.cx>
  * Some code copyright (C) 1998-1999, Mark Spencer <markster@marko.net>
- * libfaim code copyright 1998, 1999 Adam Fritzler <afritz@auk.cx>
+ * Some code copyright (C) 2001-2003, Mark Doliner <thekingant a users,sourceforge,net>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by