comparison src/gtkimhtml.c @ 8519:f8ab826e11ad

[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: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Mon, 29 Mar 2004 16:20:30 +0000
parents 5b25f72c4723
children 2f81f6478bae
comparison
equal deleted inserted replaced
8518:833dd756dcc3 8519:f8ab826e11ad
608 g_list_free(imhtml->scalables); 608 g_list_free(imhtml->scalables);
609 G_OBJECT_CLASS(parent_class)->finalize (object); 609 G_OBJECT_CLASS(parent_class)->finalize (object);
610 } 610 }
611 611
612 /* Boring GTK stuff */ 612 /* Boring GTK stuff */
613 static void gtk_imhtml_class_init (GtkIMHtmlClass *class) 613 static void gtk_imhtml_class_init (GtkIMHtmlClass *klass)
614 { 614 {
615 GtkObjectClass *object_class; 615 GtkObjectClass *object_class;
616 GObjectClass *gobject_class; 616 GObjectClass *gobject_class;
617 object_class = (GtkObjectClass*) class; 617 object_class = (GtkObjectClass*) klass;
618 gobject_class = (GObjectClass*) class; 618 gobject_class = (GObjectClass*) klass;
619 parent_class = gtk_type_class(GTK_TYPE_TEXT_VIEW); 619 parent_class = gtk_type_class(GTK_TYPE_TEXT_VIEW);
620 signals[URL_CLICKED] = g_signal_new("url_clicked", 620 signals[URL_CLICKED] = g_signal_new("url_clicked",
621 G_TYPE_FROM_CLASS(gobject_class), 621 G_TYPE_FROM_CLASS(gobject_class),
622 G_SIGNAL_RUN_FIRST, 622 G_SIGNAL_RUN_FIRST,
623 G_STRUCT_OFFSET(GtkIMHtmlClass, url_clicked), 623 G_STRUCT_OFFSET(GtkIMHtmlClass, url_clicked),
3164 return gtk_imhtml_get_markup_range(imhtml, &start, &end); 3164 return gtk_imhtml_get_markup_range(imhtml, &start, &end);
3165 } 3165 }
3166 3166
3167 char *gtk_imhtml_get_text(GtkIMHtml *imhtml) 3167 char *gtk_imhtml_get_text(GtkIMHtml *imhtml)
3168 { 3168 {
3169 GtkTextIter start_iter, end_iter; 3169 GString *str = g_string_new("");
3170 gtk_text_buffer_get_start_iter(imhtml->text_buffer, &start_iter); 3170 GtkTextIter iter, end;
3171 gtk_text_buffer_get_end_iter(imhtml->text_buffer, &end_iter); 3171 gunichar c;
3172 return gtk_text_buffer_get_text(imhtml->text_buffer, &start_iter, &end_iter, FALSE); 3172
3173 3173 gtk_text_buffer_get_start_iter(imhtml->text_buffer, &iter);
3174 } 3174 gtk_text_buffer_get_end_iter(imhtml->text_buffer, &end);
3175
3176 while ((c = gtk_text_iter_get_char(&iter)) != 0 && !gtk_text_iter_equal(&iter, &end)) {
3177 if (c == 0xFFFC) {
3178 GtkTextChildAnchor* anchor = gtk_text_iter_get_child_anchor(&iter);
3179 char *text = g_object_get_data(G_OBJECT(anchor), "text_tag");
3180 str = g_string_append(str, text);
3181 } else {
3182 g_string_append_unichar(str, c);
3183 }
3184 gtk_text_iter_forward_char(&iter);
3185 }
3186
3187 return g_string_free(str, FALSE);
3188 }