# HG changeset patch # User Luke Schierer # Date 1082493071 0 # Node ID 7024b91453579099b7c42ab55af113c9ec7c9224 # Parent 268461757fd6c10f50f52488ffa7ee05303247e5 [gaim-migrate @ 9484] (16:29:26) marv: The patch adds a gtk_imhtml_scroll_to_bottom, and makes the history plugin use it. gtk_text_view_scroll_to_iter bad, gtk_text_view_scroll_to_mark good committer: Tailor Script diff -r 268461757fd6 -r 7024b9145357 plugins/history.c --- a/plugins/history.c Tue Apr 20 20:28:55 2004 +0000 +++ b/plugins/history.c Tue Apr 20 20:31:11 2004 +0000 @@ -24,7 +24,6 @@ char *history = NULL; guint flags; GtkIMHtmlOptions options = GTK_IMHTML_NO_COLOURS; - GtkTextIter end; GList *logs = gaim_log_get_logs(gaim_conversation_get_name(c), gaim_conversation_get_account(c)); @@ -36,10 +35,7 @@ options |= GTK_IMHTML_NO_NEWLINE; gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), history, options); gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "
", options); - gtk_text_buffer_get_end_iter(GTK_IMHTML(gtkconv->imhtml)->text_buffer, - &end); - gtk_text_view_scroll_to_iter(GTK_TEXT_VIEW(gtkconv->imhtml), &end, 0, - TRUE, 0, 0); + gtk_imhtml_scroll_to_end(GTK_IMHTML(gtkconv->imhtml)); g_free(history); while (logs) { GaimLog *log = logs->data; diff -r 268461757fd6 -r 7024b9145357 src/gtkimhtml.c --- a/src/gtkimhtml.c Tue Apr 20 20:28:55 2004 +0000 +++ b/src/gtkimhtml.c Tue Apr 20 20:31:11 2004 +0000 @@ -1747,19 +1747,26 @@ } if (!(options & GTK_IMHTML_NO_SCROLL)) { - /* If this seems backwards at first glance, well it's not. - * It means scroll such that the mark is closest to the top, - * and closest to the right as possible. Remember kids, you have - * to scroll left to move a given spot closest to the right, - * and scroll down to move a spot closest to the top. - */ - gtk_text_iter_set_line_offset(&iter, 0); - gtk_text_buffer_move_mark(imhtml->text_buffer, imhtml->scrollpoint, &iter); - gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(imhtml), imhtml->scrollpoint, - 0, TRUE, 1.0, 0.0); + gtk_imhtml_scroll_to_end(imhtml); } } +void gtk_imhtml_scroll_to_end(GtkIMHtml *imhtml) +{ + GtkTextIter iter; + /* If this seems backwards at first glance, well it's not. + * It means scroll such that the mark is closest to the top, + * and closest to the right as possible. Remember kids, you have + * to scroll left to move a given spot closest to the right, + * and scroll down to move a spot closest to the top. + */ + gtk_text_buffer_get_end_iter(imhtml->text_buffer, &iter); + gtk_text_iter_set_line_offset(&iter, 0); + gtk_text_buffer_move_mark(imhtml->text_buffer, imhtml->scrollpoint, &iter); + gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(imhtml), imhtml->scrollpoint, + 0, TRUE, 1.0, 0.0); +} + void gtk_imhtml_insert_html_at_iter(GtkIMHtml *imhtml, const gchar *text, GtkIMHtmlOptions options, diff -r 268461757fd6 -r 7024b9145357 src/gtkimhtml.h --- a/src/gtkimhtml.h Tue Apr 20 20:28:55 2004 +0000 +++ b/src/gtkimhtml.h Tue Apr 20 20:31:11 2004 +0000 @@ -209,6 +209,7 @@ const gchar *text, GtkIMHtmlOptions options, GtkTextIter *iter); +void gtk_imhtml_scroll_to_end(GtkIMHtml *imhtml); void gtk_imhtml_clear (GtkIMHtml *imhtml); void gtk_imhtml_page_up (GtkIMHtml *imhtml); void gtk_imhtml_page_down (GtkIMHtml *imhtml);