Re-enable entry resizing in XMPP console plugin.

Mon, 02 Sep 2019 18:50:08 -0400

author
Elliott Sales de Andrade <qulogic@pidgin.im>
date
Mon, 02 Sep 2019 18:50:08 -0400
changeset 39808
a029cf99bfe2
parent 39807
3af264d5b0f6
child 39809
f823ce5450b1

Re-enable entry resizing in XMPP console plugin.

It was disabled for WebKit, but we don't use that any more, so it can be
uncommented again.

pidgin/plugins/xmppconsole/xmppconsole.c file | annotate | diff | comparison | revisions
--- a/pidgin/plugins/xmppconsole/xmppconsole.c	Fri Aug 30 02:20:14 2019 -0400
+++ b/pidgin/plugins/xmppconsole/xmppconsole.c	Mon Sep 02 18:50:08 2019 -0400
@@ -268,23 +268,22 @@
 {
 	GtkTextIter start, end;
 	char *xmlstr, *str;
-#if 0
+	GtkTextIter iter;
 	int wrapped_lines;
 	int lines;
 	GdkRectangle oneline;
 	int height;
 	int pad_top, pad_inside, pad_bottom;
-#endif
 	PurpleXmlNode *node;
 	GtkStyleContext *style;
 
-#if 0
-	/* TODO WebKit: Do entry auto-sizing... */
 	wrapped_lines = 1;
 	gtk_text_buffer_get_start_iter(buffer, &iter);
 	gtk_text_view_get_iter_location(GTK_TEXT_VIEW(console->entry), &iter, &oneline);
-	while (gtk_text_view_forward_display_line(GTK_TEXT_VIEW(console->entry), &iter))
+	while (gtk_text_view_forward_display_line(GTK_TEXT_VIEW(console->entry),
+	                                          &iter)) {
 		wrapped_lines++;
+	}
 
 	lines = gtk_text_buffer_get_line_count(buffer);
 
@@ -300,12 +299,13 @@
 	height += (oneline.height + pad_inside) * (wrapped_lines - lines);
 
 	gtk_widget_set_size_request(console->sw, -1, height + 6);
-#endif
 
 	gtk_text_buffer_get_bounds(buffer, &start, &end);
 	str = gtk_text_buffer_get_text(buffer, &start, &end, FALSE);
-	if (!str)
+	if (!str) {
 		return;
+	}
+
 	xmlstr = g_strdup_printf("<xml>%s</xml>", str);
 	node = purple_xmlnode_from_str(xmlstr, -1);
 	style = gtk_widget_get_style_context(console->entry);

mercurial