Mercurial > pidgin.yaz
comparison src/gtkimhtml.c @ 10797:5335eb2b8b95
[gaim-migrate @ 12440]
lets change how scrolling to end works.
for the most part, you shouldn't notice any changes.
However, there were some cases, especially with the history plugin, where
we should have scrolled to the bottom but didn't. We should now. Let me know
if we don't.
committer: Tailor Script <tailor@pidgin.im>
author | Tim Ringenbach <marv@pidgin.im> |
---|---|
date | Fri, 08 Apr 2005 20:47:19 +0000 |
parents | 096c8a65d3fc |
children | 08981462ebbb |
comparison
equal
deleted
inserted
replaced
10796:a8e84a45db3e | 10797:5335eb2b8b95 |
---|---|
1186 static void gtk_imhtml_init (GtkIMHtml *imhtml) | 1186 static void gtk_imhtml_init (GtkIMHtml *imhtml) |
1187 { | 1187 { |
1188 GtkTextIter iter; | 1188 GtkTextIter iter; |
1189 imhtml->text_buffer = gtk_text_buffer_new(NULL); | 1189 imhtml->text_buffer = gtk_text_buffer_new(NULL); |
1190 gtk_text_buffer_get_end_iter (imhtml->text_buffer, &iter); | 1190 gtk_text_buffer_get_end_iter (imhtml->text_buffer, &iter); |
1191 imhtml->scrollpoint = gtk_text_buffer_create_mark(imhtml->text_buffer, NULL, &iter, FALSE); | |
1192 gtk_text_view_set_buffer(GTK_TEXT_VIEW(imhtml), imhtml->text_buffer); | 1191 gtk_text_view_set_buffer(GTK_TEXT_VIEW(imhtml), imhtml->text_buffer); |
1193 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(imhtml), GTK_WRAP_WORD_CHAR); | 1192 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(imhtml), GTK_WRAP_WORD_CHAR); |
1194 gtk_text_view_set_pixels_below_lines(GTK_TEXT_VIEW(imhtml), 5); | 1193 gtk_text_view_set_pixels_below_lines(GTK_TEXT_VIEW(imhtml), 5); |
1195 gtk_text_view_set_left_margin(GTK_TEXT_VIEW(imhtml), 2); | 1194 gtk_text_view_set_left_margin(GTK_TEXT_VIEW(imhtml), 2); |
1196 gtk_text_view_set_right_margin(GTK_TEXT_VIEW(imhtml), 2); | 1195 gtk_text_view_set_right_margin(GTK_TEXT_VIEW(imhtml), 2); |
2164 if (!(options & GTK_IMHTML_NO_SCROLL)) { | 2163 if (!(options & GTK_IMHTML_NO_SCROLL)) { |
2165 gtk_imhtml_scroll_to_end(imhtml); | 2164 gtk_imhtml_scroll_to_end(imhtml); |
2166 } | 2165 } |
2167 } | 2166 } |
2168 | 2167 |
2168 gboolean scroll_idle_cb(gpointer data) | |
2169 { | |
2170 GtkTextView *imhtml = data; | |
2171 GtkAdjustment *adj; | |
2172 | |
2173 gaim_debug_info("gtkimhtml", "in scroll_idle_cb\n"); | |
2174 adj = GTK_TEXT_VIEW(imhtml)->vadjustment; | |
2175 gtk_adjustment_set_value(adj, adj->upper - adj->page_size); | |
2176 | |
2177 return FALSE; | |
2178 } | |
2179 | |
2169 void gtk_imhtml_scroll_to_end(GtkIMHtml *imhtml) | 2180 void gtk_imhtml_scroll_to_end(GtkIMHtml *imhtml) |
2170 { | 2181 { |
2171 GtkTextIter iter; | 2182 g_idle_add_full(GTK_TEXT_VIEW_PRIORITY_VALIDATE + 10, scroll_idle_cb, imhtml, NULL); |
2172 /* If this seems backwards at first glance, well it's not. | |
2173 * It means scroll such that the mark is closest to the top, | |
2174 * and closest to the right as possible. Remember kids, you have | |
2175 * to scroll left to move a given spot closest to the right, | |
2176 * and scroll down to move a spot closest to the top. | |
2177 */ | |
2178 gtk_text_buffer_get_end_iter(imhtml->text_buffer, &iter); | |
2179 gtk_text_iter_set_line_offset(&iter, 0); | |
2180 gtk_text_buffer_move_mark(imhtml->text_buffer, imhtml->scrollpoint, &iter); | |
2181 gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(imhtml), imhtml->scrollpoint, | |
2182 0, TRUE, 1.0, 0.0); | |
2183 } | 2183 } |
2184 | 2184 |
2185 void gtk_imhtml_insert_html_at_iter(GtkIMHtml *imhtml, | 2185 void gtk_imhtml_insert_html_at_iter(GtkIMHtml *imhtml, |
2186 const gchar *text, | 2186 const gchar *text, |
2187 GtkIMHtmlOptions options, | 2187 GtkIMHtmlOptions options, |