[gaim-migrate @ 9258]

Mon, 29 Mar 2004 16:20:30 +0000

author
Gary Kramlich <grim@pidgin.im>
date
Mon, 29 Mar 2004 16:20:30 +0000
changeset 8519
13be07662047
parent 8518
694a8ad60edd
child 8520
0a0fe6abc212

[gaim-migrate @ 9258]
" this patch will return the text for the smileys instead
of skipping them. This patch also gets rid of two
members in the gtkimhtml stuct that weren't being used
anywhere. They were gboolean smileys, comments; which
got replace with show_smileys, and show_comments. Also
an fixes the gtk_imhtml_class_init so that if it's
being compiled in c++, it will compile..." --Gary Kramlich

committer: Luke Schierer <lschiere@pidgin.im>

src/gtkimhtml.c file | annotate | diff | comparison | revisions
src/gtkimhtml.h file | annotate | diff | comparison | revisions
--- a/src/gtkimhtml.c	Sun Mar 28 21:38:22 2004 +0000
+++ b/src/gtkimhtml.c	Mon Mar 29 16:20:30 2004 +0000
@@ -610,12 +610,12 @@
 }
 
 /* Boring GTK stuff */
-static void gtk_imhtml_class_init (GtkIMHtmlClass *class)
+static void gtk_imhtml_class_init (GtkIMHtmlClass *klass)
 {
 	GtkObjectClass *object_class;
 	GObjectClass   *gobject_class;
-	object_class = (GtkObjectClass*) class;
-	gobject_class = (GObjectClass*) class;
+	object_class = (GtkObjectClass*) klass;
+	gobject_class = (GObjectClass*) klass;
 	parent_class = gtk_type_class(GTK_TYPE_TEXT_VIEW);
 	signals[URL_CLICKED] = g_signal_new("url_clicked",
 						G_TYPE_FROM_CLASS(gobject_class),
@@ -3166,9 +3166,23 @@
 
 char *gtk_imhtml_get_text(GtkIMHtml *imhtml)
 {
-	GtkTextIter start_iter, end_iter;
-	gtk_text_buffer_get_start_iter(imhtml->text_buffer, &start_iter);
-	gtk_text_buffer_get_end_iter(imhtml->text_buffer, &end_iter);
-	return gtk_text_buffer_get_text(imhtml->text_buffer, &start_iter, &end_iter, FALSE);
-
+	GString *str = g_string_new("");
+	GtkTextIter iter, end;
+	gunichar c;
+
+	gtk_text_buffer_get_start_iter(imhtml->text_buffer, &iter);
+	gtk_text_buffer_get_end_iter(imhtml->text_buffer, &end);
+
+	while ((c = gtk_text_iter_get_char(&iter)) != 0 && !gtk_text_iter_equal(&iter, &end)) {
+		if (c == 0xFFFC) {
+			GtkTextChildAnchor* anchor = gtk_text_iter_get_child_anchor(&iter);
+			char *text = g_object_get_data(G_OBJECT(anchor), "text_tag");
+			str = g_string_append(str, text);
+		} else {
+			g_string_append_unichar(str, c);
+		}
+		gtk_text_iter_forward_char(&iter);
+	}
+
+	return g_string_free(str, FALSE);
 }
--- a/src/gtkimhtml.h	Sun Mar 28 21:38:22 2004 +0000
+++ b/src/gtkimhtml.h	Mon Mar 29 16:20:30 2004 +0000
@@ -76,7 +76,6 @@
 	GtkTextView text_view;
 	GtkTextBuffer *text_buffer;
 	GtkTextMark *end;
-	gboolean comments, smileys;
 	GdkCursor *hand_cursor;
 	GdkCursor *arrow_cursor;
 	GdkCursor *text_cursor;

mercurial