pidgin: e5c1f4c8: Remove the automatic scroll-to-end when ...

qulogic at pidgin.im qulogic at pidgin.im
Thu Feb 23 04:06:33 EST 2012


----------------------------------------------------------------------
Revision: e5c1f4c8f64f73d03da91b5614384c1f5d61cc31
Parent:   b7b0b5290c456196861e81202998c136a1f2f27e
Author:   qulogic at pidgin.im
Date:     02/22/12 23:41:29
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/e5c1f4c8f64f73d03da91b5614384c1f5d61cc31

Changelog: 

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.

Changes against parent b7b0b5290c456196861e81202998c136a1f2f27e

  patched  pidgin/gtkconv.c
  patched  pidgin/gtkdialogs.c
  patched  pidgin/gtkwebview.c

-------------- next part --------------
============================================================
--- pidgin/gtkconv.c	8de2d253c77dcc9b205d4c0ed3a464ebeb9f4442
+++ pidgin/gtkconv.c	a601a8ef0a7aaf45872587da0729ae3813557e6a
@@ -8212,6 +8212,7 @@ add_message_history_to_gtkconv(gpointer 
 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 @@ add_message_history_to_gtkconv(gpointer 
 	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 @@ add_message_history_to_gtkconv(gpointer 
 					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);
 	}
 
============================================================
--- pidgin/gtkdialogs.c	e182c424c57d49c9e191292bfda499c6815a84db
+++ pidgin/gtkdialogs.c	83cfdc8abe96357742dccea9b07daffcb64a61c5
@@ -456,8 +456,6 @@ pidgin_build_help_dialog(const char *tit
 	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);
============================================================
--- pidgin/gtkwebview.c	45ddb830a7c0788fb76a009a5c3405c1e1b117d4
+++ pidgin/gtkwebview.c	f955014ec594310352623fae0d77ac02a390d89d
@@ -579,7 +579,6 @@ gtk_webview_append_html(GtkWebView *webv
 	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);
 }


More information about the Commits mailing list