changeset 13280:3de53fe8345f

[gaim-migrate @ 15646] Always show a vertical scrollbar on conversations imhtmls. This will solve the shrinking conversation window bug. I chose this approach instead of saving the size of the window (as I had previous talked about), as this prevents the contents of the scrollback from rewrapping when the scrollbars appear or disappear. It also just seems to feel like the right thing to do, but maybe that's me being lazy. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Tue, 14 Feb 2006 05:43:43 +0000
parents 0c50401679d3
children e629076386f1
files plugins/ChangeLog.API src/gtkconv.c src/gtkdebug.c src/gtkdialogs.c src/gtklog.c src/gtknotify.c src/gtkpluginpref.c src/gtkprefs.c src/gtkrequest.c src/gtksavedstatuses.c src/gtkstatusbox.c src/gtkutils.c src/gtkutils.h
diffstat 13 files changed, 37 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/ChangeLog.API	Mon Feb 13 22:03:20 2006 +0000
+++ b/plugins/ChangeLog.API	Tue Feb 14 05:43:43 2006 +0000
@@ -112,6 +112,7 @@
 	* All network activity has been updated to use non-blocking sockets.
 	  This means that plugins must be updated to expect such a socket from
 	  gaim_proxy_connect() and gaim_network_listen*().
+	* gaim_gtk_create_imhtml(): Added sw_ret() parameter
 
 	Removed:
 	* gaim_gtk_sound_{get,set}_mute() (replaced by the /gaim/gtk/sound/mute
--- a/src/gtkconv.c	Mon Feb 13 22:03:20 2006 +0000
+++ b/src/gtkconv.c	Tue Feb 14 05:43:43 2006 +0000
@@ -3789,6 +3789,8 @@
 	GaimConnection *gc;
 	GtkWidget *vpaned, *hpaned;
 	GtkWidget *vbox, *hbox, *frame;
+	GtkWidget *imhtml_sw;
+	GtkPolicyType imhtml_sw_hscroll;
 	GtkWidget *lbox, *bbox;
 	GtkWidget *label;
 	GtkWidget *list;
@@ -3844,11 +3846,15 @@
 	gtk_widget_show(hpaned);
 
 	/* Setup gtkihmtml. */
-	frame = gaim_gtk_create_imhtml(FALSE, &gtkconv->imhtml, NULL);
+	frame = gaim_gtk_create_imhtml(FALSE, &gtkconv->imhtml, NULL, &imhtml_sw);
 	gtk_widget_set_name(gtkconv->imhtml, "gaim_gtkconv_imhtml");
 	gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), TRUE);
 	gtk_paned_pack1(GTK_PANED(hpaned), frame, TRUE, TRUE);
 	gtk_widget_show(frame);
+	gtk_scrolled_window_get_policy(GTK_SCROLLED_WINDOW(imhtml_sw),
+	                               &imhtml_sw_hscroll, NULL);
+	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(imhtml_sw),
+	                               imhtml_sw_hscroll, GTK_POLICY_ALWAYS);
 
 	gtk_widget_set_size_request(gtkconv->imhtml,
 			gaim_prefs_get_int("/gaim/gtk/conversations/chat/default_width"),
@@ -3993,7 +3999,7 @@
 	gtk_widget_show(vbox);
 
 	/* Setup the toolbar, entry widget and all signals */
-	frame = gaim_gtk_create_imhtml(TRUE, &gtkconv->entry, &gtkconv->toolbar);
+	frame = gaim_gtk_create_imhtml(TRUE, &gtkconv->entry, &gtkconv->toolbar, NULL);
 	gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0);
 	gtk_widget_show(frame);
 
@@ -4036,6 +4042,8 @@
 {
 	GaimConversation *conv = gtkconv->active_conv;
 	GtkWidget *frame;
+	GtkWidget *imhtml_sw;
+	GtkPolicyType imhtml_sw_hscroll;
 	GtkWidget *paned;
 	GtkWidget *vbox;
 	GtkWidget *vbox2;
@@ -4051,11 +4059,15 @@
 	gtk_widget_show(vbox);
 
 	/* Setup the gtkimhtml widget */
-	frame = gaim_gtk_create_imhtml(FALSE, &gtkconv->imhtml, NULL);
+	frame = gaim_gtk_create_imhtml(FALSE, &gtkconv->imhtml, NULL, &imhtml_sw);
 	gtk_widget_set_name(gtkconv->imhtml, "gaim_gtkconv_imhtml");
 	gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml),TRUE);
 	gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0);
 	gtk_widget_show(frame);
+	gtk_scrolled_window_get_policy(GTK_SCROLLED_WINDOW(imhtml_sw),
+	                               &imhtml_sw_hscroll, NULL);
+	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(imhtml_sw),
+	                               imhtml_sw_hscroll, GTK_POLICY_ALWAYS);
 
 	gtk_widget_set_size_request(gtkconv->imhtml,
 			gaim_prefs_get_int("/gaim/gtk/conversations/im/default_width"),
@@ -4084,7 +4096,7 @@
 	gtk_widget_show(vbox2);
 
 	/* Setup the toolbar, entry widget and all signals */
-	frame = gaim_gtk_create_imhtml(TRUE, &gtkconv->entry, &gtkconv->toolbar);
+	frame = gaim_gtk_create_imhtml(TRUE, &gtkconv->entry, &gtkconv->toolbar, NULL);
 	gtk_box_pack_start(GTK_BOX(vbox2), frame, TRUE, TRUE, 0);
 	gtk_widget_show(frame);
 
--- a/src/gtkdebug.c	Mon Feb 13 22:03:20 2006 +0000
+++ b/src/gtkdebug.c	Tue Feb 14 05:43:43 2006 +0000
@@ -769,7 +769,7 @@
 	}
 
 	/* Add the gtkimhtml */
-	frame = gaim_gtk_create_imhtml(FALSE, &win->text, NULL);
+	frame = gaim_gtk_create_imhtml(FALSE, &win->text, NULL, NULL);
 	gtk_imhtml_set_format_functions(GTK_IMHTML(win->text),
 									GTK_IMHTML_ALL ^ GTK_IMHTML_SMILEY ^ GTK_IMHTML_IMAGE);
 	gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0);
--- a/src/gtkdialogs.c	Mon Feb 13 22:03:20 2006 +0000
+++ b/src/gtkdialogs.c	Tue Feb 14 05:43:43 2006 +0000
@@ -241,7 +241,7 @@
 	atk_object_set_description(obj, "Gaim " VERSION);
 	gtk_box_pack_start(GTK_BOX(vbox), logo, FALSE, FALSE, 0);
 
-	frame = gaim_gtk_create_imhtml(FALSE, &text, NULL);
+	frame = gaim_gtk_create_imhtml(FALSE, &text, NULL, NULL);
 	gtk_imhtml_set_format_functions(GTK_IMHTML(text), GTK_IMHTML_ALL ^ GTK_IMHTML_SMILEY);
 	gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0);
 
--- a/src/gtklog.c	Mon Feb 13 22:03:20 2006 +0000
+++ b/src/gtklog.c	Tue Feb 14 05:43:43 2006 +0000
@@ -410,7 +410,7 @@
 	gtk_paned_add2(GTK_PANED(pane), vbox);
 
 	/* Viewer ************/
-	frame = gaim_gtk_create_imhtml(FALSE, &lv->imhtml, NULL);
+	frame = gaim_gtk_create_imhtml(FALSE, &lv->imhtml, NULL, NULL);
 	gtk_widget_set_name(lv->imhtml, "gaim_gtklog_imhtml");
 	gtk_widget_set_size_request(lv->imhtml, 320, 200);
 	gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0);
--- a/src/gtknotify.c	Mon Feb 13 22:03:20 2006 +0000
+++ b/src/gtknotify.c	Tue Feb 14 05:43:43 2006 +0000
@@ -532,7 +532,7 @@
 	gtk_widget_show(label);
 
 	/* Add the imhtml */
-	frame = gaim_gtk_create_imhtml(FALSE, &imhtml, NULL);
+	frame = gaim_gtk_create_imhtml(FALSE, &imhtml, NULL, NULL);
 	gtk_widget_set_name(imhtml, "gaim_gtknotify_imhtml");
 	gtk_imhtml_set_format_functions(GTK_IMHTML(imhtml),
 			gtk_imhtml_get_format_functions(GTK_IMHTML(imhtml)) | GTK_IMHTML_IMAGE);
--- a/src/gtkpluginpref.c	Mon Feb 13 22:03:20 2006 +0000
+++ b/src/gtkpluginpref.c	Tue Feb 14 05:43:43 2006 +0000
@@ -144,7 +144,7 @@
 				gtk_box_pack_start(GTK_BOX(hbox), spacer, FALSE, FALSE, 0);
 				gtk_widget_show(spacer);
 
-				frame = gaim_gtk_create_imhtml(TRUE, &imhtml, &toolbar);
+				frame = gaim_gtk_create_imhtml(TRUE, &imhtml, &toolbar, NULL);
 				if (!(format & GAIM_STRING_FORMAT_TYPE_HTML))
 					gtk_widget_destroy(toolbar);
 
--- a/src/gtkprefs.c	Mon Feb 13 22:03:20 2006 +0000
+++ b/src/gtkprefs.c	Tue Feb 14 05:43:43 2006 +0000
@@ -848,7 +848,7 @@
 
 	gaim_gtk_prefs_checkbox(_("Use smooth-scrolling"), "/gaim/gtk/conversations/use_smooth_scrolling", vbox);
 
-	frame = gaim_gtk_create_imhtml(TRUE, &imhtml, &toolbar);
+	frame = gaim_gtk_create_imhtml(TRUE, &imhtml, &toolbar, NULL);
 	gtk_widget_set_name(imhtml, "gaim_gtkprefs_font_imhtml");
 	gtk_imhtml_set_whole_buffer_formatting_only(GTK_IMHTML(imhtml), TRUE);
 	gtk_imhtml_set_format_functions(GTK_IMHTML(imhtml),
--- a/src/gtkrequest.c	Mon Feb 13 22:03:20 2006 +0000
+++ b/src/gtkrequest.c	Tue Feb 14 05:43:43 2006 +0000
@@ -388,7 +388,7 @@
 		GtkWidget *frame;
 
 		/* imhtml */
-		frame = gaim_gtk_create_imhtml(TRUE, &entry, &toolbar);
+		frame = gaim_gtk_create_imhtml(TRUE, &entry, &toolbar, NULL);
 		gtk_widget_set_size_request(entry, 320, 130);
 		gtk_widget_set_name(entry, "gaim_gtkrequest_imhtml");
 		if (default_value != NULL)
--- a/src/gtksavedstatuses.c	Mon Feb 13 22:03:20 2006 +0000
+++ b/src/gtksavedstatuses.c	Tue Feb 14 05:43:43 2006 +0000
@@ -1110,7 +1110,7 @@
 	gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
 	gtk_size_group_add_widget(sg, label);
 
-	frame = gaim_gtk_create_imhtml(TRUE, &text, &toolbar);
+	frame = gaim_gtk_create_imhtml(TRUE, &text, &toolbar, NULL);
 	dialog->message = GTK_IMHTML(text);
 	gtk_box_pack_start(GTK_BOX(hbox), frame, TRUE, TRUE, 0);
 	focus_chain = g_list_prepend(focus_chain, dialog->message);
@@ -1446,7 +1446,7 @@
 	gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
 	gtk_size_group_add_widget(sg, label);
 
-	frame = gaim_gtk_create_imhtml(TRUE, &text, &toolbar);
+	frame = gaim_gtk_create_imhtml(TRUE, &text, &toolbar, NULL);
 	dialog->message = GTK_IMHTML(text);
 	dialog->toolbar = GTK_IMHTMLTOOLBAR(toolbar);
 	gtk_box_pack_start(GTK_BOX(hbox), frame, TRUE, TRUE, 0);
--- a/src/gtkstatusbox.c	Mon Feb 13 22:03:20 2006 +0000
+++ b/src/gtkstatusbox.c	Tue Feb 14 05:43:43 2006 +0000
@@ -936,7 +936,7 @@
 #endif
 
 	status_box->vbox = gtk_vbox_new(0, FALSE);
-	status_box->sw = gaim_gtk_create_imhtml(FALSE, &status_box->imhtml, NULL);
+	status_box->sw = gaim_gtk_create_imhtml(FALSE, &status_box->imhtml, NULL, NULL);
 	gtk_imhtml_set_editable(GTK_IMHTML(status_box->imhtml), TRUE);
 
 	buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(status_box->imhtml));
--- a/src/gtkutils.c	Mon Feb 13 22:03:20 2006 +0000
+++ b/src/gtkutils.c	Tue Feb 14 05:43:43 2006 +0000
@@ -101,7 +101,7 @@
 }
 
 GtkWidget *
-gaim_gtk_create_imhtml(gboolean editable, GtkWidget **imhtml_ret, GtkWidget **toolbar_ret)
+gaim_gtk_create_imhtml(gboolean editable, GtkWidget **imhtml_ret, GtkWidget **toolbar_ret, GtkWidget **sw_ret)
 {
 	GtkWidget *frame;
 	GtkWidget *imhtml;
@@ -157,6 +157,9 @@
 	if (editable && (toolbar_ret != NULL))
 		*toolbar_ret = toolbar;
 
+	if (sw_ret != NULL)
+		*sw_ret = sw;
+
 	return frame;
 }
 
--- a/src/gtkutils.h	Mon Feb 13 22:03:20 2006 +0000
+++ b/src/gtkutils.h	Tue Feb 14 05:43:43 2006 +0000
@@ -70,18 +70,20 @@
  * functions puts both widgets in a nice GtkFrame.  They're separate by an
  * attractive GtkSeparator.
  *
- * @param editable TRUE if this imhtml should be editable.  If this is FALSE,
+ * @param editable @c TRUE if this imhtml should be editable.  If this is @c FALSE,
  *        then the toolbar will NOT be created.  If this imthml should be
  *        read-only at first, but may become editable later, then pass in
- *        TRUE here and then manually call gtk_imhtml_set_editable() later.
+ *        @c TRUE here and then manually call gtk_imhtml_set_editable() later.
  * @param imhtml_ret A pointer to a pointer to a GtkWidget.  This pointer
  *        will be set to the imhtml when this function exits.
  * @param toolbar_ret A pointer to a pointer to a GtkWidget.  If editable is
  *        TRUE then this will be set to the toolbar when this function exits.
- *        Otherwise this will be set to NULL.
+ *        Otherwise this will be set to @c NULL.
+ * @param sw_ret This will be filled with a pointer to the scrolled window
+ *        widget which contains the imhtml.
  * @return The GtkFrame containing the toolbar and imhtml.
  */
-GtkWidget *gaim_gtk_create_imhtml(gboolean editable, GtkWidget **imhtml_ret, GtkWidget **toolbar_ret);
+GtkWidget *gaim_gtk_create_imhtml(gboolean editable, GtkWidget **imhtml_ret, GtkWidget **toolbar_ret, GtkWidget **sw_ret);
 
 /**
  * Toggles the sensitivity of a widget.