Remove the automatic scroll-to-end when appending HTML to a webview.

Thu, 23 Feb 2012 04:41:29 +0000

author
Elliott Sales de Andrade <qulogic@pidgin.im>
date
Thu, 23 Feb 2012 04:41:29 +0000
changeset 32872
31e6808f3dc4
parent 32871
4c919e57abca
child 32873
02dcd29a87b9

Remove the automatic scroll-to-end when appending HTML to a webview.
Conversations already do this using JS in the theme, and this only
messes with the Help dialogs.

pidgin/gtkconv.c file | annotate | diff | comparison | revisions
pidgin/gtkdialogs.c file | annotate | diff | comparison | revisions
pidgin/gtkwebview.c file | annotate | diff | comparison | revisions
--- a/pidgin/gtkconv.c	Thu Feb 23 04:07:32 2012 +0000
+++ b/pidgin/gtkconv.c	Thu Feb 23 04:41:29 2012 +0000
@@ -8212,6 +8212,7 @@
 add_message_history_to_gtkconv(gpointer data)
 {
 	PidginConversation *gtkconv = data;
+	GtkWebView *webview = GTK_WEBVIEW(gtkconv->webview);
 	int count = 0;
 	int timer = gtkconv->attach.timer;
 	time_t when = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(gtkconv->entry), "attach-start-time"));
@@ -8221,7 +8222,8 @@
 	while (gtkconv->attach.current && count < 100) {  /* XXX: 100 is a random value here */
 		PurpleConvMessage *msg = gtkconv->attach.current->data;
 		if (!im && when && when < purple_conversation_message_get_timestamp(msg)) {
-			gtk_webview_append_html(GTK_WEBVIEW(gtkconv->webview), "<BR><HR>");
+			gtk_webview_append_html(webview, "<BR><HR>");
+			gtk_webview_scroll_to_end(webview, TRUE);
 			g_object_set_data(G_OBJECT(gtkconv->entry), "attach-start-time", NULL);
 		}
 		pidgin_conv_write_conv(
@@ -8268,7 +8270,8 @@
 					purple_conversation_message_get_flags(msg),
 					purple_conversation_message_get_timestamp(msg));
 		}
-		gtk_webview_append_html(GTK_WEBVIEW(gtkconv->webview), "<BR><HR>");
+		gtk_webview_append_html(webview, "<BR><HR>");
+		gtk_webview_scroll_to_end(webview, TRUE);
 		g_object_set_data(G_OBJECT(gtkconv->entry), "attach-start-time", NULL);
 	}
 
--- a/pidgin/gtkdialogs.c	Thu Feb 23 04:07:32 2012 +0000
+++ b/pidgin/gtkdialogs.c	Thu Feb 23 04:41:29 2012 +0000
@@ -456,8 +456,6 @@
 	gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0);
 
 	gtk_webview_append_html(GTK_WEBVIEW(webview), string->str);
-	/* TODO WEBKIT: This doesn't seem to stay at the top. */
-	webkit_web_view_move_cursor(WEBKIT_WEB_VIEW(webview), GTK_MOVEMENT_BUFFER_ENDS, -1);
 
 	button = pidgin_dialog_add_button(GTK_DIALOG(win), GTK_STOCK_CLOSE,
 	                G_CALLBACK(destroy_win), win);
--- a/pidgin/gtkwebview.c	Thu Feb 23 04:07:32 2012 +0000
+++ b/pidgin/gtkwebview.c	Thu Feb 23 04:41:29 2012 +0000
@@ -579,7 +579,6 @@
 	char *script = g_strdup_printf("document.write(%s)", escaped);
 	webkit_web_view_execute_script(WEBKIT_WEB_VIEW(webview), script);
 	priv->empty = FALSE;
-	gtk_webview_scroll_to_end(webview, TRUE);
 	g_free(script);
 	g_free(escaped);
 }

mercurial