diff pidgin/gtkimhtml.c @ 18167:b8b475f31008

Fix setting the sensitivity of the toolbar items in a number of places
author Stu Tomlinson <stu@nosnilmot.com>
date Sun, 17 Jun 2007 18:10:47 +0000
parents 97b735ca9d7a
children b8572b937c09 90d558470507
line wrap: on
line diff
--- a/pidgin/gtkimhtml.c	Sun Jun 17 16:55:45 2007 +0000
+++ b/pidgin/gtkimhtml.c	Sun Jun 17 18:10:47 2007 +0000
@@ -5036,10 +5036,24 @@
 
 void gtk_imhtml_setup_entry(GtkIMHtml *imhtml, PurpleConnectionFlags flags)
 {
+	GtkIMHtmlButtons buttons;
+
 	if (flags & PURPLE_CONNECTION_HTML) {
 		char color[8];
 		GdkColor fg_color, bg_color;
 
+		buttons = GTK_IMHTML_ALL;
+
+		if (flags & PURPLE_CONNECTION_NO_BGCOLOR)
+			buttons &= ~GTK_IMHTML_BACKCOLOR;
+		if (flags & PURPLE_CONNECTION_NO_FONTSIZE)
+		{
+			buttons &= ~GTK_IMHTML_GROW;
+			buttons &= ~GTK_IMHTML_SHRINK;
+		}
+		if (flags & PURPLE_CONNECTION_NO_URLDESC)
+			buttons &= ~GTK_IMHTML_LINKDESC;
+
 		gtk_imhtml_set_format_functions(imhtml, GTK_IMHTML_ALL);
 		if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/send_bold") != imhtml->edit.bold)
 			gtk_imhtml_toggle_bold(imhtml);
@@ -5094,9 +5108,14 @@
 		else
 			gtk_imhtml_set_whole_buffer_formatting_only(imhtml, FALSE);
 	} else {
+		buttons = GTK_IMHTML_SMILEY | GTK_IMHTML_IMAGE;
 		imhtml_clear_formatting(imhtml);
-		gtk_imhtml_set_format_functions(imhtml, 0);
 	}
+
+	if (flags & PURPLE_CONNECTION_NO_IMAGES)
+		buttons &= ~GTK_IMHTML_IMAGE;
+
+	gtk_imhtml_set_format_functions(imhtml, buttons);
 }