changeset 8317:6f549c1d0829

[gaim-migrate @ 9041] Because I won't be able to work on this until late this week at the earliest, here's GtkIMHtmlToolbar. It's a composite widget that attaches to an editable gtkimhtml and controls all the formatting with ease. All one has to do to get a formattable, editable, gtkimhtml now is to replace a gtktextview with a gtkimhtml (you can even leave all the other calls that control it as gtkimhtml descends from gtktextview) throw one of these toolbars in there and gtk_imhtml_toolbar_attach it to the gtkimhtml. That's what I did in the New Away Message dialog. This would also be nice in gtkrequest.c and gtkpounce.c. Of course, this isn't done and there's a ton of hacky commented out old code in there. Things like keyboard shortcut preferences don't currently work and there's a lot of things I want to move around yet. However, if anyone feels inspired to work on it before I get back to it feel free. Maybe you can IM me beforehand or something. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Mon, 23 Feb 2004 21:18:27 +0000
parents cf84056fed27
children e45e19951e55
files src/Makefile.am src/dialogs.c src/gtkconv.c src/gtkconv.h src/gtkimhtml.c src/gtkimhtmltoolbar.c src/gtkimhtmltoolbar.h src/ui.h
diffstat 8 files changed, 1124 insertions(+), 1032 deletions(-) [+]
line wrap: on
line diff
--- a/src/Makefile.am	Sun Feb 22 22:10:47 2004 +0000
+++ b/src/Makefile.am	Mon Feb 23 21:18:27 2004 +0000
@@ -152,6 +152,8 @@
 	gtkft.h \
 	gtkimhtml.c \
 	gtkimhtml.h \
+	gtkimhtmltoolbar.c \
+	gtkimhtmltoolbar.h \
 	gtkinternal.h \
 	gtklog.c \
 	gtklog.h \
--- a/src/dialogs.c	Sun Feb 22 22:10:47 2004 +0000
+++ b/src/dialogs.c	Mon Feb 23 21:18:27 2004 +0000
@@ -34,6 +34,7 @@
 #include "gtkblist.h"
 #include "gtkconv.h"
 #include "gtkimhtml.h"
+#include "gtkimhtmltoolbar.h"
 #include "gtkprefs.h"
 #include "gtkutils.h"
 #include "stock.h"
@@ -57,6 +58,7 @@
 
 struct create_away {
 	GtkWidget *window;
+	GtkWidget *toolbar;
 	GtkWidget *entry;
 	GtkWidget *text;
 	struct away_message *mess;
@@ -112,7 +114,7 @@
 
 	gtkconv = GAIM_GTK_CONVERSATION(c);
 
-	if (GTK_IS_COLOR_SELECTION_DIALOG(w)) {
+	/*if (GTK_IS_COLOR_SELECTION_DIALOG(w)) {
 		if (w == gtkconv->dialogs.fg_color) {
 			gtk_toggle_button_set_active(
 				GTK_TOGGLE_BUTTON(gtkconv->toolbar.fgcolor), FALSE);
@@ -134,7 +136,7 @@
 		gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkconv->toolbar.log),
 									   FALSE);
 		gtkconv->dialogs.log = NULL;
-	}
+		}*/
 
 	dialogwindows = g_list_remove(dialogwindows, w);
 	gtk_widget_destroy(w);
@@ -574,92 +576,6 @@
 GtkWidget *fgcseld = NULL;
 GtkWidget *bgcseld = NULL;
 
-void cancel_fgcolor(GtkWidget *widget, GaimConversation *c)
-{
-	GaimGtkConversation *gtkconv;
-
-	gtkconv = GAIM_GTK_CONVERSATION(c);
-
-	if (gtkconv->toolbar.fgcolor && widget) {
-		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.fgcolor),
-									FALSE);
-	}
-
-	dialogwindows = g_list_remove(dialogwindows, gtkconv->dialogs.fg_color);
-	gtk_widget_destroy(gtkconv->dialogs.fg_color);
-	gtkconv->dialogs.fg_color = NULL;
-}
-
-void cancel_bgcolor(GtkWidget *widget, GaimConversation *c)
-{
-	GaimGtkConversation *gtkconv;
-
-	gtkconv = GAIM_GTK_CONVERSATION(c);
-
-	if (gtkconv->toolbar.bgcolor && widget) {
-		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.bgcolor),
-									FALSE);
-	}
-
-	dialogwindows = g_list_remove(dialogwindows, gtkconv->dialogs.bg_color);
-	gtk_widget_destroy(gtkconv->dialogs.bg_color);
-	gtkconv->dialogs.bg_color = NULL;
-}
-
-void do_fgcolor(GtkWidget *widget, GtkColorSelection *colorsel)
-{
-	GdkColor text_color;
-	GaimConversation *c;
-	GaimGtkConversation *gtkconv;
-	char *open_tag;
-
-	open_tag = g_malloc(30);
-
-	gtk_color_selection_get_current_color(colorsel, &text_color);
-
-	c = g_object_get_data(G_OBJECT(colorsel), "gaim_conversation");
-	/* GTK_IS_EDITABLE(c->entry); huh? */
-
-	gtkconv = GAIM_GTK_CONVERSATION(c);
-
-	gtkconv->fg_color = text_color;
-	g_snprintf(open_tag, 23, "#%02X%02X%02X",
-			   text_color.red / 256,
-			   text_color.green / 256,
-			   text_color.blue / 256);
-	gtk_imhtml_toggle_forecolor(GTK_IMHTML(gtkconv->entry), open_tag);
-
-	g_free(open_tag);
-	cancel_fgcolor(NULL, c);
-}
-
-void do_bgcolor(GtkWidget *widget, GtkColorSelection *colorsel)
-{
-	GdkColor text_color;
-	GaimConversation *c;
-	GaimGtkConversation *gtkconv;
-	char *open_tag;
-
-	open_tag = g_malloc(30);
-
-	gtk_color_selection_get_current_color(colorsel, &text_color);
-
-	c = g_object_get_data(G_OBJECT(colorsel), "gaim_conversation");
-	/* GTK_IS_EDITABLE(c->entry); huh? */
-
-	gtkconv = GAIM_GTK_CONVERSATION(c);
-
-	gtkconv->bg_color = text_color;
-	g_snprintf(open_tag, 25, "#%02X%02X%02X",
-			   text_color.red / 256,
-			   text_color.green / 256,
-			   text_color.blue / 256);
-	gtk_imhtml_toggle_backcolor(GTK_IMHTML(gtkconv->entry), open_tag);
-	
-	g_free(open_tag);
-	cancel_bgcolor(NULL, c);
-}
-
 void show_fgcolor_dialog(GaimConversation *c, GtkWidget *color)
 {
 	GaimGtkConversation *gtkconv;
@@ -671,45 +587,22 @@
 	gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"),
 					&fgcolor);
 
-	if (color == NULL) {	/* we came from the prefs */
-		if (fgcseld)
-			return;
-
-		fgcseld = gtk_color_selection_dialog_new(_("Select Text Color"));
-		gtk_color_selection_set_current_color(GTK_COLOR_SELECTION
-					      (GTK_COLOR_SELECTION_DIALOG(fgcseld)->colorsel), &fgcolor);
-		g_signal_connect(G_OBJECT(fgcseld), "delete_event",
-				   G_CALLBACK(destroy_colorsel), (void *)1);
-		g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(fgcseld)->cancel_button),
-				   "clicked", G_CALLBACK(destroy_colorsel), (void *)1);
-		g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(fgcseld)->ok_button), "clicked",
-				   G_CALLBACK(apply_color_dlg), (void *)1);
-		gtk_widget_realize(fgcseld);
-		gtk_widget_show(fgcseld);
-		gdk_window_raise(fgcseld->window);
+	if (fgcseld)
 		return;
-	}
-
-	if (!gtkconv->dialogs.fg_color) {
-
-		gtkconv->dialogs.fg_color = gtk_color_selection_dialog_new(_("Select Text Color"));
-		colorsel = GTK_COLOR_SELECTION_DIALOG(gtkconv->dialogs.fg_color)->colorsel;
-		gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(colorsel), &fgcolor);
-		g_object_set_data(G_OBJECT(colorsel), "gaim_conversation", c);
-
-		g_signal_connect(G_OBJECT(gtkconv->dialogs.fg_color), "delete_event",
-				   G_CALLBACK(delete_event_dialog), c);
-		g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(gtkconv->dialogs.fg_color)->ok_button),
-				   "clicked", G_CALLBACK(do_fgcolor), colorsel);
-		g_signal_connect(G_OBJECT
-				   (GTK_COLOR_SELECTION_DIALOG(gtkconv->dialogs.fg_color)->cancel_button),
-				   "clicked", G_CALLBACK(cancel_fgcolor), c);
-
-		gtk_widget_realize(gtkconv->dialogs.fg_color);
-	}
-
-	gtk_widget_show(gtkconv->dialogs.fg_color);
-	gdk_window_raise(gtkconv->dialogs.fg_color->window);
+	
+	fgcseld = gtk_color_selection_dialog_new(_("Select Text Color"));
+	gtk_color_selection_set_current_color(GTK_COLOR_SELECTION
+					      (GTK_COLOR_SELECTION_DIALOG(fgcseld)->colorsel), &fgcolor);
+	g_signal_connect(G_OBJECT(fgcseld), "delete_event",
+			 G_CALLBACK(destroy_colorsel), (void *)1);
+	g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(fgcseld)->cancel_button),
+			 "clicked", G_CALLBACK(destroy_colorsel), (void *)1);
+	g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(fgcseld)->ok_button), "clicked",
+			 G_CALLBACK(apply_color_dlg), (void *)1);
+	gtk_widget_realize(fgcseld);
+	gtk_widget_show(fgcseld);
+	gdk_window_raise(fgcseld->window);
+	return;
 }
 
 void show_bgcolor_dialog(GaimConversation *c, GtkWidget *color)
@@ -723,93 +616,29 @@
 	gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"),
 					&bgcolor);
 
-	if (color == NULL) {	/* we came from the prefs */
-		if (bgcseld)
-			return;
-
-		bgcseld = gtk_color_selection_dialog_new(_("Select Background Color"));
-		gtk_color_selection_set_current_color(GTK_COLOR_SELECTION
-					      (GTK_COLOR_SELECTION_DIALOG(bgcseld)->colorsel), &bgcolor);
-		g_signal_connect(G_OBJECT(bgcseld), "delete_event",
-				   G_CALLBACK(destroy_colorsel), NULL);
-		g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(bgcseld)->cancel_button),
-				   "clicked", G_CALLBACK(destroy_colorsel), NULL);
-		g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(bgcseld)->ok_button), "clicked",
-				   G_CALLBACK(apply_color_dlg), (void *)2);
-		gtk_widget_realize(bgcseld);
-		gtk_widget_show(bgcseld);
-		gdk_window_raise(bgcseld->window);
+	if (bgcseld)
 		return;
-	}
-
-	if (!gtkconv->dialogs.bg_color) {
-
-		gtkconv->dialogs.bg_color = gtk_color_selection_dialog_new(_("Select Background Color"));
-		colorsel = GTK_COLOR_SELECTION_DIALOG(gtkconv->dialogs.bg_color)->colorsel;
-		gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(colorsel), &bgcolor);
-		g_object_set_data(G_OBJECT(colorsel), "gaim_conversation", c);
-
-		g_signal_connect(G_OBJECT(gtkconv->dialogs.bg_color), "delete_event",
-				   G_CALLBACK(delete_event_dialog), c);
-		g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(gtkconv->dialogs.bg_color)->ok_button),
-				   "clicked", G_CALLBACK(do_bgcolor), colorsel);
-		g_signal_connect(G_OBJECT
-				   (GTK_COLOR_SELECTION_DIALOG(gtkconv->dialogs.bg_color)->cancel_button),
-				   "clicked", G_CALLBACK(cancel_bgcolor), c);
-
-		gtk_widget_realize(gtkconv->dialogs.bg_color);
-	}
-
-	gtk_widget_show(gtkconv->dialogs.bg_color);
-	gdk_window_raise(gtkconv->dialogs.bg_color->window);
+	
+	bgcseld = gtk_color_selection_dialog_new(_("Select Background Color"));
+	gtk_color_selection_set_current_color(GTK_COLOR_SELECTION
+					      (GTK_COLOR_SELECTION_DIALOG(bgcseld)->colorsel), &bgcolor);
+	g_signal_connect(G_OBJECT(bgcseld), "delete_event",
+			 G_CALLBACK(destroy_colorsel), NULL);
+	g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(bgcseld)->cancel_button),
+			 "clicked", G_CALLBACK(destroy_colorsel), NULL);
+	g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(bgcseld)->ok_button), "clicked",
+			 G_CALLBACK(apply_color_dlg), (void *)2);
+	gtk_widget_realize(bgcseld);
+	gtk_widget_show(bgcseld);
+	gdk_window_raise(bgcseld->window);
+	return;
 }
 
-/*------------------------------------------------------------------------*/
+
+/*------------------------  ----------------------------------------------*/
 /*  Font Selection Dialog                                                 */
 /*------------------------------------------------------------------------*/
 
-void cancel_font(GtkWidget *widget, GaimConversation *c)
-{
-	GaimGtkConversation *gtkconv;
-
-	gtkconv = GAIM_GTK_CONVERSATION(c);
-
-	if (gtkconv->toolbar.font && widget) {
-		gtk_toggle_button_set_active(
-			GTK_TOGGLE_BUTTON(gtkconv->toolbar.font), FALSE);
-	}
-
-	if (gtkconv->dialogs.font) {
-		dialogwindows = g_list_remove(dialogwindows, gtkconv->dialogs.font);
-		gtk_widget_destroy(gtkconv->dialogs.font);
-		gtkconv->dialogs.font = NULL;
-	}
-}
-
-void apply_font(GtkWidget *widget, GtkFontSelection *fontsel)
-{
-	/* this could be expanded to include font size, weight, etc.
-	   but for now only works with font face */
-	char *fontname;
-	char *space;
-	GaimConversation *c = g_object_get_data(G_OBJECT(fontsel),
-			"gaim_conversation");
-
-	if(!c)
-		return;
-
-	fontname = gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(fontsel));
-
-	space = strrchr(fontname, ' ');
-	if(space && isdigit(*(space+1)))
-		*space = '\0';
-
-	gaim_gtk_set_font_face(GAIM_GTK_CONVERSATION(c), fontname);
-
-	g_free(fontname);
-
-	cancel_font(NULL, c);
-}
 
 void destroy_fontsel(GtkWidget *w, gpointer d)
 {
@@ -825,62 +654,34 @@
 
 	gtkconv = GAIM_GTK_CONVERSATION(c);
 
-	if (!font) {		/* we came from the prefs dialog */
-		if (fontseld)
-			return;
 
-		fontseld = gtk_font_selection_dialog_new(_("Select Font"));
-
-		fontface = gaim_prefs_get_string("/gaim/gtk/conversations/font_face");
-
-		if (fontface != NULL && *fontface != '\0') {
-			g_snprintf(fonttif, sizeof(fonttif), "%s 12", fontface);
-			gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(fontseld),
-								fonttif);
-		} else {
-			gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(fontseld),
-								DEFAULT_FONT_FACE " 12");
-		}
-
-		g_signal_connect(G_OBJECT(fontseld), "delete_event",
-				   G_CALLBACK(destroy_fontsel), NULL);
-		g_signal_connect(G_OBJECT(GTK_FONT_SELECTION_DIALOG(fontseld)->cancel_button),
-				   "clicked", G_CALLBACK(destroy_fontsel), NULL);
-		g_signal_connect(G_OBJECT(GTK_FONT_SELECTION_DIALOG(fontseld)->ok_button), "clicked",
-				   G_CALLBACK(apply_font_dlg), fontseld);
-		gtk_widget_realize(fontseld);
-		gtk_widget_show(fontseld);
-		gdk_window_raise(fontseld->window);
+	if (fontseld)
 		return;
+	
+	fontseld = gtk_font_selection_dialog_new(_("Select Font"));
+	
+	fontface = gaim_prefs_get_string("/gaim/gtk/conversations/font_face");
+	
+	if (fontface != NULL && *fontface != '\0') {
+		g_snprintf(fonttif, sizeof(fonttif), "%s 12", fontface);
+		gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(fontseld),
+							fonttif);
+	} else {
+		gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(fontseld),
+							DEFAULT_FONT_FACE " 12");
 	}
-
-	if (!gtkconv->dialogs.font) {
-		gtkconv->dialogs.font = gtk_font_selection_dialog_new(_("Select Font"));
-
-		g_object_set_data(G_OBJECT(gtkconv->dialogs.font), "gaim_conversation", c);
+	
+	g_signal_connect(G_OBJECT(fontseld), "delete_event",
+			 G_CALLBACK(destroy_fontsel), NULL);
+	g_signal_connect(G_OBJECT(GTK_FONT_SELECTION_DIALOG(fontseld)->cancel_button),
+			 "clicked", G_CALLBACK(destroy_fontsel), NULL);
+	g_signal_connect(G_OBJECT(GTK_FONT_SELECTION_DIALOG(fontseld)->ok_button), "clicked",
+			 G_CALLBACK(apply_font_dlg), fontseld);
+	gtk_widget_realize(fontseld);
+	gtk_widget_show(fontseld);
+	gdk_window_raise(fontseld->window);
+	return;
 
-		if (gtkconv->fontface[0]) {
-			g_snprintf(fonttif, sizeof(fonttif), "%s 12", gtkconv->fontface);
-			gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(gtkconv->dialogs.font),
-							       fonttif);
-		} else {
-			gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(gtkconv->dialogs.font),
-								DEFAULT_FONT_FACE);
-		}
-
-		g_signal_connect(G_OBJECT(gtkconv->dialogs.font), "delete_event",
-				   G_CALLBACK(delete_event_dialog), c);
-		g_signal_connect(G_OBJECT(GTK_FONT_SELECTION_DIALOG(gtkconv->dialogs.font)->ok_button),
-				   "clicked", G_CALLBACK(apply_font), gtkconv->dialogs.font);
-		g_signal_connect(G_OBJECT(GTK_FONT_SELECTION_DIALOG(gtkconv->dialogs.font)->cancel_button),
-				   "clicked", G_CALLBACK(cancel_font), c);
-
-		gtk_widget_realize(gtkconv->dialogs.font);
-
-	}
-
-	gtk_widget_show(gtkconv->dialogs.font);
-	gdk_window_raise(gtkconv->dialogs.font->window);
 }
 
 /*------------------------------------------------------------------------*/
@@ -899,7 +700,7 @@
 	}
 
 	g_snprintf(am->name, sizeof(am->name), "%s", gtk_entry_get_text(GTK_ENTRY(ca->entry)));
-	away_message = gtk_text_view_get_text(GTK_TEXT_VIEW(ca->text), FALSE);
+	away_message = gtk_imhtml_get_markup(GTK_IMHTML(ca->text));
 
 	g_snprintf(am->message, sizeof(am->message), "%s", away_message);
 	g_free(away_message);
@@ -926,7 +727,7 @@
 		return 0;
 	}
 
-	msg = gtk_text_view_get_text(GTK_TEXT_VIEW(ca->text), FALSE);
+	msg = gtk_imhtml_get_markup(GTK_IMHTML(ca->text));
 
 	if (!msg && (type <= 1)) {
 		/* We shouldn't allow a blank message */
@@ -959,7 +760,7 @@
 		return;
 
 	g_snprintf(am.name, sizeof(am.name), "%s", gtk_entry_get_text(GTK_ENTRY(ca->entry)));
-	away_message = gtk_text_view_get_text(GTK_TEXT_VIEW(ca->text), FALSE);
+	away_message = gtk_imhtml_get_markup(GTK_IMHTML(ca->text));
 
 	g_snprintf(am.message, sizeof(am.message), "%s", away_message);
 	g_free(away_message);
@@ -1022,6 +823,10 @@
 	gaim_set_accessible_label (ca->entry, label);
 	gtk_widget_grab_focus(ca->entry);
 
+	/* Toolbar */
+	ca->toolbar = gtk_imhtmltoolbar_new();
+	gtk_box_pack_start(GTK_BOX(vbox), ca->toolbar, FALSE, FALSE, 0);
+
 	/* Away message text */
 	sw = gtk_scrolled_window_new(NULL, NULL);
 	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
@@ -1029,11 +834,13 @@
 	gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN);
 	gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0);
 
-	ca->text = gtk_text_view_new();
+	ca->text = gtk_imhtml_new(NULL, NULL);
+	gtk_imhtml_set_editable(ca->text, TRUE);
 	gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(ca->text), GTK_WRAP_WORD_CHAR);
 
 	if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck"))
 		gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(ca->text));
+	gtk_imhtmltoolbar_attach(GTK_IMHTMLTOOLBAR(ca->toolbar), ca->text);
 
 	gtk_container_add(GTK_CONTAINER(sw), ca->text);
 
@@ -1052,10 +859,7 @@
 		gtk_tree_model_get_value (GTK_TREE_MODEL(ls), &iter, 1, &val);
 		amt = g_value_get_pointer (&val);
 		gtk_entry_set_text(GTK_ENTRY(ca->entry), amt->name);
-		buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(ca->text));
-		gtk_text_buffer_get_iter_at_offset(buffer, &start, pos);
-		gtk_text_buffer_insert(buffer, &start, amt->message, strlen(amt->message));
-
+		gtk_imhtml_append_text_with_images(GTK_IMHTML(ca->text), amt->message, 0, NULL);
 		ca->mess = amt;
 	}
 
@@ -1081,143 +885,6 @@
 	gtk_widget_show_all(ca->window);
 }
 
-/* smiley dialog */
-
-void close_smiley_dialog(GtkWidget *widget, GaimConversation *c)
-{
-	GaimGtkConversation *gtkconv;
-
-	gtkconv = GAIM_GTK_CONVERSATION(c);
-
-	if (gtkconv->toolbar.smiley) {
-		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.smiley),
-									FALSE);
-	}
-	if(gtkconv->dialogs.smiley) {
-		dialogwindows = g_list_remove(dialogwindows, gtkconv->dialogs.smiley);
-		gtk_widget_destroy(gtkconv->dialogs.smiley);
-		gtkconv->dialogs.smiley = NULL;
-	}
-}
-
-void insert_smiley_text(GtkWidget *widget, GaimConversation *c)
-{
-	GaimGtkConversation *gtkconv;
-	char *smiley_text = g_object_get_data(G_OBJECT(widget), "smiley_text");
-	GaimPlugin *proto = gaim_find_prpl(gaim_account_get_protocol_id(gaim_conversation_get_account(c)));
-
-	gtkconv = GAIM_GTK_CONVERSATION(c);
-
-	gtk_imhtml_insert_smiley(GTK_IMHTML(gtkconv->entry), proto->info->name, smiley_text);
-
-	close_smiley_dialog(NULL, c);
-}
-
-static void add_smiley(GaimConversation *c, GtkWidget *table, int row, int col, char *filename, char *face)
-{
-	GtkWidget *image;
-	GtkWidget *button;
-	GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(c);
-
-	image = gtk_image_new_from_file(filename);
-	button = gtk_button_new();
-	gtk_container_add(GTK_CONTAINER(button), image);
-	g_object_set_data(G_OBJECT(button), "smiley_text", face);
-	g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(insert_smiley_text), c);
-
-	gtk_tooltips_set_tip(gtkconv->tooltips, button, face, NULL);
-
-	gtk_table_attach_defaults(GTK_TABLE(table), button, col, col+1, row, row+1);
-
-	/* these look really weird with borders */
-	gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
-
-	gtk_widget_show(button);
-}
-
-static gboolean smiley_is_unique(GSList *list, GtkIMHtmlSmiley *smiley) {
-	while(list) {
-		GtkIMHtmlSmiley *cur = list->data;
-		if(!strcmp(cur->file, smiley->file))
-			return FALSE;
-		list = list->next;
-	}
-	return TRUE;
-}
-
-void show_smiley_dialog(GaimConversation *c, GtkWidget *widget)
-{
-	GaimGtkConversation *gtkconv;
-	GtkWidget *dialog;
-	GtkWidget *smiley_table = NULL;
-	GSList *smileys, *unique_smileys = NULL;
-	int width;
-	int row = 0, col = 0;
-
-	gtkconv = GAIM_GTK_CONVERSATION(c);
-
-	if (gtkconv->dialogs.smiley)
-		return;
-
-	if(c->account)
-		smileys = get_proto_smileys(
-			gaim_account_get_protocol_id(gaim_conversation_get_account(c)));
-	else
-		smileys = get_proto_smileys(GAIM_PROTO_DEFAULT);
-
-	while(smileys) {
-		GtkIMHtmlSmiley *smiley = smileys->data;
-		if(!smiley->hidden) {
-			if(smiley_is_unique(unique_smileys, smiley))
-					unique_smileys = g_slist_append(unique_smileys, smiley);
-		}
-		smileys = smileys->next;
-	}
-
-
-	width = floor(sqrt(g_slist_length(unique_smileys)));
-
-	GAIM_DIALOG(dialog);
-	gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE);
-	gtk_window_set_role(GTK_WINDOW(dialog), "smiley_dialog");
-	gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_MOUSE);
-
-	smiley_table = gtk_table_new(width, width, TRUE);
-
-	/* pack buttons */
-
-	while(unique_smileys) {
-		GtkIMHtmlSmiley *smiley = unique_smileys->data;
-		if(!smiley->hidden) {
-			add_smiley(c, smiley_table, row, col, smiley->file, smiley->smile);
-			if(++col >= width) {
-				col = 0;
-				row++;
-			}
-		}
-		unique_smileys = unique_smileys->next;
-	}
-
-	gtk_container_add(GTK_CONTAINER(dialog), smiley_table);
-
-	gtk_widget_show(smiley_table);
-
-	gtk_container_set_border_width(GTK_CONTAINER(dialog), 5);
-
-	/* connect signals */
-	g_object_set_data(G_OBJECT(dialog), "dialog_type", "smiley dialog");
-	g_signal_connect(G_OBJECT(dialog), "delete_event",
-					 G_CALLBACK(delete_event_dialog), c);
-
-	/* show everything */
-	gtk_window_set_title(GTK_WINDOW(dialog), _("Smile!"));
-	gtk_widget_show_all(dialog);
-
-	gtkconv->dialogs.smiley = dialog;
-
-	return;
-}
-
 static void
 alias_chat_cb(GaimChat *chat, const char *new_alias)
 {
--- a/src/gtkconv.c	Sun Feb 22 22:10:47 2004 +0000
+++ b/src/gtkconv.c	Mon Feb 23 21:18:27 2004 +0000
@@ -52,6 +52,7 @@
 #include "gtkblist.h"
 #include "gtkconv.h"
 #include "gtkimhtml.h"
+#include "gtkimhtmltoolbar.h"
 #include "gtklog.h"
 #include "gtkpounce.h"
 #include "gtkprivacy.h"
@@ -123,15 +124,6 @@
 static GtkWidget *invite_dialog = NULL;
 
 /* Prototypes. <-- because Paco-Paco hates this comment. */
-static void set_toggle(GtkWidget *tb, gboolean active);
-static void do_bold(GtkWidget *bold, GaimGtkConversation *gtkconv);
-static void do_italic(GtkWidget *italic, GaimGtkConversation *gtkconv);
-static void do_underline(GtkWidget *underline, GaimGtkConversation *gtkconv);
-static void do_small(GtkWidget *smalltb, GaimGtkConversation *gtkconv);
-static void do_big(GtkWidget *large, GaimGtkConversation *gtkconv);
-static void toggle_font(GtkWidget *font, GaimConversation *conv);
-static void toggle_fg_color(GtkWidget *color, GaimConversation *conv);
-static void toggle_bg_color(GtkWidget *color, GaimConversation *conv);
 static void got_typing_keypress(GaimConversation *conv, gboolean first);
 static GList *generate_invite_user_names(GaimConnection *gc);
 static void add_chat_buddy_common(GaimConversation *conv,
@@ -191,72 +183,6 @@
 		do_save_convo(wid);
 }
 
-static void
-do_insert_image_cb(GtkWidget *widget, int resp, gpointer data)
-{
-	GaimConversation *conv = data;
-	GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv);
-	GaimConvIm *im = GAIM_CONV_IM(conv);
-	char *name, *filename;
-	char *buf, *filedata;
-	size_t size;
-	GError *error = NULL;
-	int id;
-
-	if (resp != GTK_RESPONSE_OK) {
-		set_toggle(gtkconv->toolbar.image, FALSE);
-		return;
-	}
-
-	name = g_strdup(gtk_file_selection_get_filename(GTK_FILE_SELECTION(widget)));
-
-	if (!name) {
-		set_toggle(gtkconv->toolbar.image, FALSE);
-		return;
-	}
-
-	if (gaim_gtk_check_if_dir(name, GTK_FILE_SELECTION(widget))) {
-		g_free(name);
-		set_toggle(gtkconv->toolbar.image, FALSE);
-		return;
-	}
-
-	set_toggle(gtkconv->toolbar.image, FALSE);
-
-	if (!g_file_get_contents(name, &filedata, &size, &error)) {
-		gaim_notify_error(NULL, NULL, error->message, NULL);
-
-		g_error_free(error);
-		g_free(name);
-
-		return;
-	}
-
-	filename = name;
-	while (strchr(filename, '/'))
-		filename = strchr(filename, '/') + 1;
-
-	id = gaim_imgstore_add(filedata, size, filename);
-	g_free(filedata);
-
-	if (!id) {
-		buf = g_strdup_printf(_("Failed to store image: %s\n"), name);
-		gaim_notify_error(NULL, NULL, buf, NULL);
-
-		g_free(buf);
-		g_free(name);
-
-		return;
-	}
-
-	im->images = g_slist_append(im->images, GINT_TO_POINTER(id));
-
-	buf = g_strdup_printf("<IMG ID=\"%d\" SRC=\"file://%s\">", id, filename);
-	gtk_text_buffer_insert_at_cursor(GTK_TEXT_BUFFER(gtkconv->entry_buffer), buf, -1);
-	g_free(buf);
-
-	g_free(name);
-}
 
 static gint
 close_win_cb(GtkWidget *w, GdkEventAny *e, gpointer d)
@@ -286,139 +212,6 @@
 		gtk_widget_set_state(widget, GTK_STATE_NORMAL);
 }
 
-static void
-insert_image_cb(GtkWidget *save, GaimConversation *conv)
-{
-	GaimGtkConversation *gtkconv;
-	char buf[BUF_LONG];
-	GtkWidget *window;
-
-	gtkconv = GAIM_GTK_CONVERSATION(conv);
-
-	if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.image))) {
-		window = gtk_file_selection_new(_("Insert Image"));
-		g_snprintf(buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S, gaim_home_dir());
-		gtk_file_selection_set_filename(GTK_FILE_SELECTION(window), buf);
-
-		gtk_dialog_set_default_response(GTK_DIALOG(window), GTK_RESPONSE_OK);
-		g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(window)),
-				"response", G_CALLBACK(do_insert_image_cb), conv);
-
-		gtk_widget_show(window);
-		gtkconv->dialogs.image = window;
-	} else {
-		gtk_widget_destroy(gtkconv->dialogs.image);
-		gtkconv->dialogs.image = NULL;
-	}
-}
-
-static void
-do_insert_link_cb(GaimConversation *conv, GaimRequestFields *fields)
-{
-	GaimGtkConversation *gtkconv;
-	const char *url, *description;
-
-	gtkconv = GAIM_GTK_CONVERSATION(conv);
-
-	url         = gaim_request_fields_get_string(fields, "url");
-	description = gaim_request_fields_get_string(fields, "description");
-
-	if (description == NULL)
-		description = url;
-
-	gtk_imhtml_insert_link(GTK_IMHTML(gtkconv->entry), url, description);
-	gaim_gtk_advance_past(gtkconv, "<A HREF>", "</A>");
-
-	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.link),
-								 FALSE);
-
-	gtkconv->dialogs.link = NULL;
-}
-
-static void
-cancel_link_cb(GaimConversation *conv, GaimRequestFields *fields)
-{
-	GAIM_GTK_CONVERSATION(conv)->dialogs.link = NULL;
-}
-
-static void
-show_link_dialog(GaimConversation *conv)
-{
-	GaimGtkConversation *gtkconv;
-	GaimRequestFields *fields;
-	GaimRequestFieldGroup *group;
-	GaimRequestField *field;
-
-	gtkconv = GAIM_GTK_CONVERSATION(conv);
-
-	fields = gaim_request_fields_new();
-
-	group = gaim_request_field_group_new(NULL);
-	gaim_request_fields_add_group(fields, group);
-
-	field = gaim_request_field_string_new("url", _("_URL"), NULL, FALSE);
-	gaim_request_field_set_required(field, TRUE);
-	gaim_request_field_group_add_field(group, field);
-
-	field = gaim_request_field_string_new("description", _("_Description"),
-										  NULL, FALSE);
-	gaim_request_field_group_add_field(group, field);
-
-	gtkconv->dialogs.link =
-		gaim_request_fields(conv, _("Insert Link"),
-							NULL,
-							_("Please enter the URL and description of the "
-							  "link that you want to insert. The description "
-							  "is optional."),
-							fields,
-							_("_Insert"), G_CALLBACK(do_insert_link_cb),
-							_("Cancel"), G_CALLBACK(cancel_link_cb),
-							conv);
-}
-
-static void
-close_link_dialog(GaimConversation *conv)
-{
-	GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv);
-
-	if (gtkconv->dialogs.link != NULL)
-	{
-		gaim_request_close(GAIM_REQUEST_FIELDS, gtkconv->dialogs.link);
-
-		gtkconv->dialogs.link = NULL;
-	}
-}
-
-static void
-insert_link_cb(GtkWidget *w, GaimConversation *conv)
-{
-	GaimGtkConversation *gtkconv;
-
-	gtkconv = GAIM_GTK_CONVERSATION(conv);
-
-	if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.link)))
-		show_link_dialog(conv);
-	else
-		close_link_dialog(conv);
-
-	gtk_widget_grab_focus(gtkconv->entry);
-}
-
-static void
-insert_smiley_cb(GtkWidget *smiley, GaimConversation *conv)
-{
-	GaimGtkConversation *gtkconv;
-
-	gtkconv = GAIM_GTK_CONVERSATION(conv);
-
-	if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(smiley)))
-		show_smiley_dialog(conv, smiley);
-	else if (gtkconv->dialogs.smiley)
-		close_smiley_dialog(smiley, conv);
-
-	gtk_widget_grab_focus(gtkconv->entry);
-}
-
 static void default_formatize(GaimConversation *conv) {
 	GaimGtkConversation *c = GAIM_GTK_CONVERSATION(conv);
 	GaimConnection *gc = gaim_conversation_get_gc(conv);
@@ -885,7 +678,7 @@
 	gaim_gtkpounce_dialog_show(gaim_conversation_get_account(conv),
 							   gaim_conversation_get_name(conv), NULL);
 }
-
+/*
 static void
 menu_insert_link_cb(gpointer data, guint action, GtkWidget *widget)
 {
@@ -911,7 +704,7 @@
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.image),
 		!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.image)));
 }
-
+*/
 static void
 menu_alias_cb(gpointer data, guint action, GtkWidget *widget)
 {
@@ -1035,9 +828,9 @@
 		gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget));
 
 	if (gtkconv->show_formatting_toolbar)
-		gtk_widget_show(gtkconv->toolbar.toolbar);
+		gtk_widget_show(gtkconv->toolbar);
 	else
-		gtk_widget_hide(gtkconv->toolbar.toolbar);
+		gtk_widget_hide(gtkconv->toolbar);
 }
 
 static void
@@ -1532,102 +1325,24 @@
 
 		} /* End of switch */
 
-		if (gaim_prefs_get_bool("/gaim/gtk/conversations/html_shortcuts")) {
+		/*	if (gaim_prefs_get_bool("/gaim/gtk/conversations/html_shortcuts")) {
 			switch (event->keyval) {
-				case 'b':  /* ctrl-b is GDK_Left, which moves backwards. */
-				case 'B':
-					set_toggle(gtkconv->toolbar.bold,
-						!gtk_toggle_button_get_active(
-							GTK_TOGGLE_BUTTON(gtkconv->toolbar.bold)));
-
-					return TRUE;
-					break;
-
-				case 'f':
-				case 'F':
-					set_toggle(gtkconv->toolbar.font,
-						!gtk_toggle_button_get_active(
-							GTK_TOGGLE_BUTTON(gtkconv->toolbar.font)));
-
-					return TRUE;
-					break;
-
-				case 'i':
-				case 'I':
-					set_toggle(gtkconv->toolbar.italic,
-						!gtk_toggle_button_get_active(
-							GTK_TOGGLE_BUTTON(gtkconv->toolbar.italic)));
-
-					return TRUE;
-					break;
-
-				case 'u':  /* ctrl-u is GDK_Clear, which clears the line. */
-				case 'U':
-					set_toggle(gtkconv->toolbar.underline,
-						!gtk_toggle_button_get_active(
-							GTK_TOGGLE_BUTTON(gtkconv->toolbar.underline)));
-
-					return TRUE;
-					break;
-
-				case '-':
-					set_toggle(gtkconv->toolbar.smaller_size,
-							!gtk_toggle_button_get_active(
-								GTK_TOGGLE_BUTTON(gtkconv->toolbar.smaller_size)));
-
-					return TRUE;
-					break;
-
-				case '=':
-				case '+':
-					set_toggle(gtkconv->toolbar.larger_size,
-							!gtk_toggle_button_get_active(
-								GTK_TOGGLE_BUTTON(gtkconv->toolbar.larger_size)));
-
-					return TRUE;
-					break;
-
-#if 0
-				case '0':
-					set_toggle(gtkconv->toolbar.normal_size,
-						!gtk_toggle_button_get_active(
-							GTK_TOGGLE_BUTTON(gtkconv->toolbar.normal_size)));
-
-					return TRUE;
-					break;
-#endif
+			
+
 			}
-		} /* End of switch */
-
-		if (gaim_prefs_get_bool("/gaim/gtk/conversations/smiley_shortcuts")) {
+			} */ /* End of switch */
+
+		/*		if (gaim_prefs_get_bool("/gaim/gtk/conversations/smiley_shortcuts")) {
 			char buf[7];
 
 			*buf = '\0';
 
 			switch (event->keyval) {
-				case '1': strcpy(buf, ":-)");  break;
-				case '2': strcpy(buf, ":-(");  break;
-				case '3': strcpy(buf, ";-)");  break;
-				case '4': strcpy(buf, ":-P");  break;
-				case '5': strcpy(buf, "=-O");  break;
-				case '6': strcpy(buf, ":-*");  break;
-				case '7': strcpy(buf, ">:o");  break;
-				case '8': strcpy(buf, "8-)");  break;
-				case '!': strcpy(buf, ":-$");  break;
-				case '@': strcpy(buf, ":-!");  break;
-				case '#': strcpy(buf, ":-[");  break;
-				case '$': strcpy(buf, "O:-)"); break;
-				case '%': strcpy(buf, ":-/");  break;
-				case '^': strcpy(buf, ":'(");  break;
-				case '&': strcpy(buf, ":-X");  break;
-				case '*': strcpy(buf, ":-D");  break;
+				
 			}
 
-			if (*buf) {
-				gtk_imhtml_insert_smiley(GTK_IMHTML(gtkconv->entry), conv->account->protocol_id, buf);
-				return TRUE;
-			}
-		}
+			
+			}*/
 
 	} else
 
@@ -2476,7 +2191,7 @@
 		gtk_widget_show(gtkconv->u.im->block);
 
 		/* Deal with the toolbar */
-		gtk_widget_show(gtkconv->toolbar.image);
+		//gtk_widget_show(gtkconv->toolbar.image);
 
 		/* Deal with menu items */
 		gtk_widget_show(gtkwin->menu.view_log);
@@ -2511,7 +2226,7 @@
 		gtk_widget_show(gtkconv->u.chat->invite);
 
 		/* Deal with the toolbar */
-		gtk_widget_hide(gtkconv->toolbar.image);
+		//		gtk_widget_hide(gtkconv->toolbar.image);
 
 		/* Deal with menu items */
 		gtk_widget_hide(gtkwin->menu.view_log);
@@ -2566,20 +2281,20 @@
 		}
 
 		/* Deal with the toolbar */
-		gtk_widget_set_sensitive(gtkconv->toolbar.link, TRUE);
+		/*gtk_widget_set_sensitive(gtkconv->toolbar.link, TRUE);
 		gtk_widget_set_sensitive(gtkconv->toolbar.image,
 								 (prpl_info->options & OPT_PROTO_IM_IMAGE));
 		gtk_widget_set_sensitive(gtkconv->toolbar.bgcolor,
 								 !(gc->flags & GAIM_CONNECTION_NO_BGCOLOR));
 
-		/* Deal with menu items */
+		/* Deal with menu items 
 		gtk_widget_set_sensitive(gtkwin->menu.view_log, TRUE);
 		gtk_widget_set_sensitive(gtkwin->menu.add_pounce, TRUE);
 		gtk_widget_set_sensitive(gtkwin->menu.get_info, (prpl_info->get_info != NULL));
 		gtk_widget_set_sensitive(gtkwin->menu.warn, (prpl_info->warn != NULL));
 		gtk_widget_set_sensitive(gtkwin->menu.invite,
 								 (prpl_info->chat_invite != NULL));
-
+*/
 		if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) {
 			if (gaim_find_buddy(gaim_conversation_get_account(conv),
 					    gaim_conversation_get_name(conv)) == NULL)
@@ -2617,8 +2332,8 @@
 		}
 
 		/* Deal with the toolbar */
-		gtk_widget_set_sensitive(gtkconv->toolbar.link, TRUE);
-		gtk_widget_set_sensitive(gtkconv->toolbar.image, FALSE);
+		//gtk_widget_set_sensitive(gtkconv->toolbar.link, TRUE);
+		//gtk_widget_set_sensitive(gtkconv->toolbar.image, FALSE);
 
 		/* Then deal with menu items */
 		gtk_widget_set_sensitive(gtkwin->menu.view_log, TRUE);
@@ -2719,86 +2434,6 @@
 /**************************************************************************
  * Utility functions
  **************************************************************************/
-static void
-do_bold(GtkWidget *bold, GaimGtkConversation *gtkconv)
-{
-	gtk_imhtml_toggle_bold(GTK_IMHTML(gtkconv->entry));
-	gtk_widget_grab_focus(gtkconv->entry);
-}
-
-static void
-do_italic(GtkWidget *italic, GaimGtkConversation *gtkconv)
-{
-	gtk_imhtml_toggle_italic(GTK_IMHTML(gtkconv->entry));
-	gtk_widget_grab_focus(gtkconv->entry);
-}
-
-static void
-do_underline(GtkWidget *underline, GaimGtkConversation *gtkconv)
-{
-	gtk_imhtml_toggle_underline(GTK_IMHTML(gtkconv->entry));
-	gtk_widget_grab_focus(gtkconv->entry);
-}
-
-static void
-do_small(GtkWidget *smalltb, GaimGtkConversation *gtkconv)
-{
-	gtk_imhtml_font_shrink(GTK_IMHTML(gtkconv->entry));
-	gtk_widget_grab_focus(gtkconv->entry);
-}
-
-static void
-do_big(GtkWidget *large, GaimGtkConversation *gtkconv)
-{
-	gtk_imhtml_font_grow(GTK_IMHTML(gtkconv->entry));
-	gtk_widget_grab_focus(gtkconv->entry);
-}
-
-static void
-toggle_font(GtkWidget *font, GaimConversation *conv)
-{
-	GaimGtkConversation *gtkconv;
-
-	gtkconv = GAIM_GTK_CONVERSATION(conv);
-
-	show_font_dialog(conv, font);
-}
-
-static void
-toggle_fg_color(GtkWidget *color, GaimConversation *conv)
-{
-	GaimGtkConversation *gtkconv;
-
-	gtkconv = GAIM_GTK_CONVERSATION(conv);
-
-	if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(color)))
-		show_fgcolor_dialog(conv, color);
-	else if (gtkconv->dialogs.fg_color != NULL)
-		cancel_fgcolor(color, conv);
-	else
-		gaim_gtk_advance_past(gtkconv, "<FONT COLOR>", "</FONT>");
-}
-
-static void
-toggle_bg_color(GtkWidget *color, GaimConversation *conv)
-{
-	GaimGtkConversation *gtkconv;
-
-	gtkconv = GAIM_GTK_CONVERSATION(conv);
-
-	if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(color)))
-		show_bgcolor_dialog(conv, color);
-	else if (gtkconv->dialogs.bg_color != NULL)
-		cancel_bgcolor(color, conv);
-	else
-		gaim_gtk_advance_past(gtkconv, "<BODY BGCOLOR>", "</BODY>");
-}
-
-static void
-set_toggle(GtkWidget *tb, gboolean active)
-{
-	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(tb), active);
-}
 
 static void
 got_typing_keypress(GaimConversation *conv, gboolean first)
@@ -3438,9 +3073,9 @@
 
 	{ "/Conversation/sep3", NULL, NULL, 0, "<Separator>" },
 
-	{ N_("/Conversation/Insert Lin_k..."), NULL, menu_insert_link_cb, 0,
+	{ N_("/Conversation/Insert Lin_k..."), NULL, NULL, 0, //menu_insert_link_cb, 0,
 	  "<StockItem>", GAIM_STOCK_LINK },
-	{ N_("/Conversation/Insert Imag_e..."), NULL, menu_insert_image_cb, 0,
+	{ N_("/Conversation/Insert Imag_e..."), NULL, NULL, 0, //menu_insert_image_cb, 0,
 	  "<StockItem>", GAIM_STOCK_IMAGE },
 
 	{ "/Conversation/sep4", NULL, NULL, 0, "<Separator>" },
@@ -3738,190 +3373,6 @@
 					 G_CALLBACK(send_cb), conv);
 }
 
-static GtkWidget *
-build_conv_toolbar(GaimConversation *conv)
-{
-	GaimGtkConversation *gtkconv;
-	GtkWidget *vbox;
-	GtkWidget *hbox;
-	GtkWidget *button;
-	GtkWidget *sep;
-	GtkSizeGroup *sg;
-
-	gtkconv = GAIM_GTK_CONVERSATION(conv);
-
-	sg = gtk_size_group_new(GTK_SIZE_GROUP_BOTH);
-
-	vbox = gtk_vbox_new(FALSE, 0);
-	sep = gtk_hseparator_new();
-	gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0);
-
-	hbox = gtk_hbox_new(FALSE, 6);
-	gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
-
-	/* Bold */
-	button = gaim_pixbuf_toolbar_button_from_stock(GTK_STOCK_BOLD);
-	gtk_size_group_add_widget(sg, button);
-	gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
-	gtk_tooltips_set_tip(gtkconv->tooltips, button, _("Bold"), NULL);
-
-	g_signal_connect(G_OBJECT(button), "clicked",
-					 G_CALLBACK(do_bold), gtkconv);
-
-	gtkconv->toolbar.bold = button;
-
-	/* Italic */
-	button = gaim_pixbuf_toolbar_button_from_stock(GTK_STOCK_ITALIC);
-	gtk_size_group_add_widget(sg, button);
-	gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
-	gtk_tooltips_set_tip(gtkconv->tooltips, button, _("Italic"), NULL);
-
-	g_signal_connect(G_OBJECT(button), "clicked",
-					 G_CALLBACK(do_italic), gtkconv);
-
-	gtkconv->toolbar.italic = button;
-
-	/* Underline */
-	button = gaim_pixbuf_toolbar_button_from_stock(GTK_STOCK_UNDERLINE);
-	gtk_size_group_add_widget(sg, button);
-	gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
-	gtk_tooltips_set_tip(gtkconv->tooltips, button, _("Underline"), NULL);
-
-	g_signal_connect(G_OBJECT(button), "clicked",
-					 G_CALLBACK(do_underline), gtkconv);
-
-	gtkconv->toolbar.underline = button;
-
-	/* Sep */
-	sep = gtk_vseparator_new();
-	gtk_box_pack_start(GTK_BOX(hbox), sep, FALSE, FALSE, 0);
-
-	/* Increase font size */
-	button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_TEXT_BIGGER);
-	gtk_size_group_add_widget(sg, button);
-	gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
-	gtk_tooltips_set_tip(gtkconv->tooltips, button,
-						 _("Larger font size"), NULL);
-
-	g_signal_connect(G_OBJECT(button), "clicked",
-					 G_CALLBACK(do_big), gtkconv);
-
-	gtkconv->toolbar.larger_size = button;
-
-	/* Normal font size 
-	button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_TEXT_NORMAL);
-	gtk_size_group_add_widget(sg, button);
-	gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
-	gtk_tooltips_set_tip(gtkconv->tooltips, button,
-						 _("Normal font size"), NULL);
-
-	g_signal_connect(G_OBJECT(button), "clicked",
-					 G_CALLBACK(do_normal), gtkconv);
-
-	gtkconv->toolbar.normal_size = button;
-	*/
-
-	/* Decrease font size */
-	button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_TEXT_SMALLER);
-	gtk_size_group_add_widget(sg, button);
-	gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
-	gtk_tooltips_set_tip(gtkconv->tooltips, button,
-						 _("Smaller font size"), NULL);
-
-	g_signal_connect(G_OBJECT(button), "clicked",
-					 G_CALLBACK(do_small), gtkconv);
-
-	gtkconv->toolbar.smaller_size = button;
-
-	/* Sep */
-	sep = gtk_vseparator_new();
-	gtk_box_pack_start(GTK_BOX(hbox), sep, FALSE, FALSE, 0);
-
-	/* Font Face */
-
-	button = gaim_pixbuf_toolbar_button_from_stock(GTK_STOCK_SELECT_FONT);
-	gtk_size_group_add_widget(sg, button);
-	gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
-	gtk_tooltips_set_tip(gtkconv->tooltips, button,
-			_("Font Face"), NULL);
-
-	g_signal_connect(G_OBJECT(button), "clicked",
-			G_CALLBACK(toggle_font), conv);
-
-	gtkconv->toolbar.font = button;
-
-	/* Foreground Color */
-	button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_FGCOLOR);
-	gtk_size_group_add_widget(sg, button);
-	gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
-	gtk_tooltips_set_tip(gtkconv->tooltips, button,
-						 _("Foreground font color"), NULL);
-
-	g_signal_connect(G_OBJECT(button), "clicked",
-					 G_CALLBACK(toggle_fg_color), conv);
-
-	gtkconv->toolbar.fgcolor = button;
-
-	/* Background Color */
-	button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_BGCOLOR);
-	gtk_size_group_add_widget(sg, button);
-	gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
-	gtk_tooltips_set_tip(gtkconv->tooltips, button,
-						 _("Background color"), NULL);
-
-	g_signal_connect(G_OBJECT(button), "clicked",
-					 G_CALLBACK(toggle_bg_color), conv);
-
-	gtkconv->toolbar.bgcolor = button;
-
-	/* Sep */
-	sep = gtk_vseparator_new();
-	gtk_box_pack_start(GTK_BOX(hbox), sep, FALSE, FALSE, 0);
-
-	/* Insert Link */
-	button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_LINK);
-	gtk_size_group_add_widget(sg, button);
-	gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
-	gtk_tooltips_set_tip(gtkconv->tooltips, button, _("Insert link"), NULL);
-
-	g_signal_connect(G_OBJECT(button), "clicked",
-					 G_CALLBACK(insert_link_cb), conv);
-
-	gtkconv->toolbar.link = button;
-
-	/* Insert IM Image */
-	button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_IMAGE);
-	gtk_size_group_add_widget(sg, button);
-	gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
-	gtk_tooltips_set_tip(gtkconv->tooltips, button, _("Insert image"), NULL);
-
-	g_signal_connect(G_OBJECT(button), "clicked",
-					 G_CALLBACK(insert_image_cb), conv);
-
-	gtkconv->toolbar.image = button;
-
-	/* Insert Smiley */
-	button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_SMILEY);
-	gtk_size_group_add_widget(sg, button);
-	gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
-	gtk_tooltips_set_tip(gtkconv->tooltips, button, _("Insert smiley"), NULL);
-
-	g_signal_connect(G_OBJECT(button), "clicked",
-					 G_CALLBACK(insert_smiley_cb), conv);
-
-	gtkconv->toolbar.smiley = button;
-
-
-	sep = gtk_hseparator_new();
-	gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0);
-
-	gtk_widget_show_all(vbox);
-
-	if (!gaim_prefs_get_bool("/gaim/gtk/conversations/show_formatting_toolbar"))
-		gtk_widget_hide(vbox);
-
-	return vbox;
-}
 
 static void topic_callback(GtkWidget *w, GaimConversation *conv)
 {
@@ -4141,9 +3592,8 @@
 	gtk_paned_pack2(GTK_PANED(vpaned), vbox, FALSE, FALSE);
 	gtk_widget_show(vbox);
 
-	gtkconv->toolbar.toolbar = build_conv_toolbar(conv);
-	gtk_box_pack_start(GTK_BOX(vbox), gtkconv->toolbar.toolbar,
-					   FALSE, FALSE, 0);
+	gtkconv->toolbar = gtk_imhtmltoolbar_new();
+	gtk_box_pack_start(GTK_BOX(vbox), gtkconv->toolbar, FALSE, FALSE, 0);
 
 	/* Setup the entry widget.
 	 * We never show the horizontal scrollbar because it was causing weird
@@ -4175,6 +3625,7 @@
 
 	if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck"))
 		gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry));
+	gtk_imhtmltoolbar_attach(GTK_IMHTMLTOOLBAR(gtkconv->toolbar), gtkconv->entry);
 
 	gtk_container_add(GTK_CONTAINER(sw), GTK_WIDGET(gtkconv->entry));
 	gtk_widget_show(gtkconv->entry);
@@ -4248,9 +3699,8 @@
 	gtk_widget_show(vbox2);
 
 	/* Build the toolbar. */
-	gtkconv->toolbar.toolbar = build_conv_toolbar(conv);
-	gtk_box_pack_start(GTK_BOX(vbox2), gtkconv->toolbar.toolbar,
-					   FALSE, FALSE, 0);
+	gtkconv->toolbar = gtk_imhtmltoolbar_new();
+	gtk_box_pack_start(GTK_BOX(vbox2), gtkconv->toolbar, FALSE, FALSE, 0);
 
 	/* Setup the entry widget.
 	 * We never show the horizontal scrollbar because it was causing weird
@@ -4290,6 +3740,7 @@
 
 	gtk_container_add(GTK_CONTAINER(sw), GTK_WIDGET(gtkconv->entry));
 	gtk_widget_show(gtkconv->entry);
+	gtk_imhtmltoolbar_attach(gtkconv->toolbar, gtkconv->entry);
 
 	gtkconv->bbox = gtk_hbox_new(FALSE, 6);
 	gtk_box_pack_start(GTK_BOX(vbox2), gtkconv->bbox, FALSE, FALSE, 0);
@@ -4803,7 +4254,7 @@
 {
 	GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv);
 
-	if (gtkconv->dialogs.fg_color != NULL)
+	/*	if (gtkconv->dialogs.fg_color != NULL)
 		gtk_widget_destroy(gtkconv->dialogs.fg_color);
 
 	if (gtkconv->dialogs.bg_color != NULL)
@@ -4817,9 +4268,9 @@
 
 	if (gtkconv->dialogs.smiley != NULL)
 		gtk_widget_destroy(gtkconv->dialogs.smiley);
-
-	if (gtkconv->dialogs.link != NULL)
-		close_link_dialog(conv);
+	*/
+	//if (gtkconv->dialogs.link != NULL)
+	//	close_link_dialog(conv);
 
 	if (gtkconv->dialogs.log != NULL)
 		gtk_widget_destroy(gtkconv->dialogs.log);
@@ -6047,9 +5498,9 @@
 				gtkconv->show_formatting_toolbar);
 
 		if (gtkconv->show_formatting_toolbar)
-			gtk_widget_show(gtkconv->toolbar.toolbar);
+			gtk_widget_show(gtkconv->toolbar);
 		else
-			gtk_widget_hide(gtkconv->toolbar.toolbar);
+			gtk_widget_hide(gtkconv->toolbar);
 	}
 }
 
--- a/src/gtkconv.h	Sun Feb 22 22:10:47 2004 +0000
+++ b/src/gtkconv.h	Mon Feb 23 21:18:27 2004 +0000
@@ -159,36 +159,10 @@
 	GtkWidget *bbox;
 	GtkWidget *sw;
 
-	struct
-	{
-		GtkWidget *toolbar;
-
-		GtkWidget *bold;
-		GtkWidget *italic;
-		GtkWidget *underline;
-
-		GtkWidget *larger_size;
-		GtkWidget *normal_size;
-		GtkWidget *smaller_size;
-
-		GtkWidget *font;
-		GtkWidget *fgcolor;
-		GtkWidget *bgcolor;
-
-		GtkWidget *image;
-		GtkWidget *link;
-		GtkWidget *smiley;
-		GtkWidget *log;
-
-	} toolbar;
+	GtkWidget *toolbar;
 
 	struct
 	{
-		GtkWidget *fg_color;
-		GtkWidget *bg_color;
-		GtkWidget *font;
-		GtkWidget *smiley;
-		void *link;
 		GtkWidget *image;
 		GtkWidget *log;
 		GtkWidget *search;
--- a/src/gtkimhtml.c	Sun Feb 22 22:10:47 2004 +0000
+++ b/src/gtkimhtml.c	Mon Feb 23 21:18:27 2004 +0000
@@ -351,23 +351,101 @@
  * It's supposed to be fixed in gtk2.2.  You can view the bug report at
  * http://bugzilla.gnome.org/show_bug.cgi?id=107939
  */
-gboolean gtk_key_pressed_cb(GtkWidget *imhtml, GdkEventKey *event, gpointer data)
-{
+
+/*
+ * I'm adding some keyboard shortcuts too.
+ */
+
+gboolean gtk_key_pressed_cb(GtkIMHtml *imhtml, GdkEventKey *event, gpointer data)
+{	
+	char buf[7];
+	buf[0] = '\0';
+
 	if (event->state & GDK_CONTROL_MASK)
 		switch (event->keyval) {
-			case 'a':
-				return TRUE;
-				break;
-
-			case GDK_Home:
-				return TRUE;
-				break;
-
-			case GDK_End:
-				return TRUE;
-				break;
+		case 'a':
+			return TRUE;
+			break;
+			
+		case GDK_Home:
+			return TRUE;
+			break;
+
+		case GDK_End:
+			return TRUE;
+			break;
+		
+		case 'b':  /* ctrl-b is GDK_Left, which moves backwards. */
+		case 'B':
+			gtk_imhtml_toggle_bold(imhtml);
+			return TRUE;
+			break;
+			
+		case 'f':
+		case 'F':
+			/*set_toggle(gtkconv->toolbar.font,
+			  !gtk_toggle_button_get_active(
+			  GTK_TOGGLE_BUTTON(gtkconv->toolbar.font)));*/
+			
+			return TRUE;
+			break;
+			
+		case 'i':
+		case 'I':
+			/*set_toggle(gtkconv->toolbar.italic,
+			  !gtk_toggle_button_get_active(
+			  GTK_TOGGLE_BUTTON(gtkconv->toolbar.italic)));*/
+			gtk_imhtml_toggle_italic(imhtml);
+			return TRUE;
+			break;
+			
+		case 'u':  /* ctrl-u is GDK_Clear, which clears the line. */
+		case 'U':
+			/*set_toggle(gtkconv->toolbar.underline,
+			  !gtk_toggle_button_get_active(
+			  GTK_TOGGLE_BUTTON(gtkconv->toolbar.underline)));*/
+			gtk_imhtml_toggle_underline(imhtml);
+			return TRUE;
+			break;
+			
+		case '-':
+			/*set_toggle(gtkconv->toolbar.smaller_size,
+			  !gtk_toggle_button_get_active(
+			  GTK_TOGGLE_BUTTON(gtkconv->toolbar.smaller_size)));*/
+			gtk_imhtml_font_shrink(imhtml);
+			return TRUE;
+			break;
+			
+		case '=':
+		case '+':
+			/*set_toggle(gtkconv->toolbar.larger_size,
+			  !gtk_toggle_button_get_active(
+			  GTK_TOGGLE_BUTTON(gtkconv->toolbar.larger_size)));*/
+			gtk_imhtml_font_grow(imhtml);
+			return TRUE;
+			break;
+			
+		case '1': strcpy(buf, ":-)");  break;
+		case '2': strcpy(buf, ":-(");  break;
+		case '3': strcpy(buf, ";-)");  break;
+		case '4': strcpy(buf, ":-P");  break;
+		case '5': strcpy(buf, "=-O");  break;
+		case '6': strcpy(buf, ":-*");  break;
+		case '7': strcpy(buf, ">:o");  break;
+		case '8': strcpy(buf, "8-)");  break;
+		case '!': strcpy(buf, ":-$");  break;
+		case '@': strcpy(buf, ":-!");  break;
+		case '#': strcpy(buf, ":-[");  break;
+		case '$': strcpy(buf, "O:-)"); break;
+		case '%': strcpy(buf, ":-/");  break;
+		case '^': strcpy(buf, ":'(");  break;
+		case '&': strcpy(buf, ":-X");  break;
+		case '*': strcpy(buf, ":-D");  break;
 		}
-
+	if (*buf) {
+		gtk_imhtml_insert_smiley(imhtml, NULL, buf);//->account->protocol_id, buf);
+		return TRUE;
+	}	
 	return FALSE;
 }
 
@@ -1757,6 +1835,11 @@
 					break;
 				case 62:	/* comment */
 					/* NEW_BIT (NEW_TEXT_BIT); */
+					ws[wpos] = '\0';
+					if (url)
+						gtk_imhtml_insert_link(imhtml, url, ws);
+					else
+						gtk_text_buffer_insert(imhtml->text_buffer, &iter, ws, wpos);
 					if (imhtml->show_comments)
 						wpos = g_snprintf (ws, len, "%s", tag);
 					/* NEW_BIT (NEW_COMMENT_BIT); */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/gtkimhtmltoolbar.c	Mon Feb 23 21:18:27 2004 +0000
@@ -0,0 +1,829 @@
+/*
+ * GtkIMHtmlToolbar
+ *
+ * Gaim is the legal property of its developers, whose names are too numerous
+ * to list here.  Please refer to the COPYRIGHT file distributed with this
+ * source distribution.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+#include <gtk/gtk.h>
+#include <gtk/gtkvbox.h>
+#include "gtkimhtmltoolbar.h"
+#include "gtkutils.h"
+#include "notify.h"
+#include "request.h"
+#include "stock.h"
+#include "internal.h"
+#include "ui.h"
+
+static GtkVBoxClass *parent_class = NULL;
+
+static void do_bold(GtkWidget *bold, GtkIMHtmlToolbar *toolbar)
+{
+	g_return_if_fail(toolbar);
+	gtk_imhtml_toggle_bold(GTK_IMHTML(toolbar->imhtml));
+	gtk_widget_grab_focus(toolbar->imhtml);
+}
+
+static void
+do_italic(GtkWidget *italic, GtkIMHtmlToolbar *toolbar)
+{
+	g_return_if_fail(toolbar);
+	gtk_imhtml_toggle_italic(GTK_IMHTML(toolbar->imhtml));
+	gtk_widget_grab_focus(toolbar->imhtml);
+}
+
+static void
+do_underline(GtkWidget *underline, GtkIMHtmlToolbar *toolbar)
+{
+	g_return_if_fail(toolbar);
+	gtk_imhtml_toggle_underline(GTK_IMHTML(toolbar->imhtml));
+	gtk_widget_grab_focus(toolbar->imhtml);
+}
+
+static void
+do_small(GtkWidget *smalltb, GtkIMHtmlToolbar *toolbar)
+{
+	g_return_if_fail(toolbar);
+	gtk_imhtml_font_shrink(GTK_IMHTML(toolbar->imhtml));
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->smaller_size), FALSE);
+	gtk_widget_grab_focus(toolbar->imhtml);
+}
+
+static void
+do_big(GtkWidget *large, GtkIMHtmlToolbar *toolbar)
+{
+	g_return_if_fail(toolbar);
+	gtk_imhtml_font_grow(GTK_IMHTML(toolbar->imhtml));
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->larger_size), FALSE);
+	gtk_widget_grab_focus(toolbar->imhtml);
+}
+
+
+
+static void toolbar_cancel_font(GtkWidget *widget, GtkIMHtmlToolbar *toolbar)
+{
+
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->font), FALSE);
+
+	if (toolbar->font_dialog) {
+		gtk_widget_destroy(toolbar->font_dialog);
+		toolbar->font_dialog = NULL;
+	}
+}
+
+static void apply_font(GtkWidget *widget, GtkFontSelection *fontsel)
+{
+	/* this could be expanded to include font size, weight, etc.
+	   but for now only works with font face */
+	char *fontname;
+	char *space;
+	GtkIMHtmlToolbar *toolbar =  g_object_get_data(G_OBJECT(fontsel), "gaim_toolbar");
+
+	fontname = gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(fontsel));
+
+	space = strrchr(fontname, ' ');
+	if(space && isdigit(*(space+1)))
+		*space = '\0';
+
+	gtk_imhtml_toggle_fontface(GTK_IMHTML(toolbar->imhtml), fontname);
+
+	g_free(fontname);
+
+	toolbar_cancel_font(NULL, toolbar);
+}
+
+static void
+toggle_font(GtkWidget *font, GtkIMHtmlToolbar *toolbar)
+{
+	char fonttif[128];
+	const char *fontface;
+	
+	g_return_if_fail(toolbar);
+	
+	if (!toolbar->font_dialog) {
+		toolbar->font_dialog = gtk_font_selection_dialog_new(_("Select Font"));
+
+		g_object_set_data(G_OBJECT(toolbar->font_dialog), "gaim_toolbar", toolbar);
+		
+		/*	if (gtkconv->fontface[0]) {
+		  g_snprintf(fonttif, sizeof(fonttif), "%s 12", gtkconv->fontface);
+		  gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(gtkconv->dialogs.font),
+		  fonttif);
+		  } else {
+		  gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(gtkconv->dialogs.font),
+		  DEFAULT_FONT_FACE);
+		  }
+		*/
+		
+		g_signal_connect(G_OBJECT(toolbar->font_dialog), "delete_event",
+				 G_CALLBACK(toolbar_cancel_font), toolbar);
+		g_signal_connect(G_OBJECT(GTK_FONT_SELECTION_DIALOG(toolbar->font_dialog)->ok_button),
+				 "clicked", G_CALLBACK(apply_font), toolbar->font_dialog);
+		g_signal_connect(G_OBJECT(GTK_FONT_SELECTION_DIALOG(toolbar->font_dialog)->cancel_button),
+				 "clicked", G_CALLBACK(toolbar_cancel_font), toolbar);
+		
+		
+		gtk_window_present(GTK_WINDOW(toolbar->font_dialog));
+	} else {
+		toolbar_cancel_font(NULL, toolbar);
+	}
+	gtk_widget_grab_focus(toolbar->imhtml);
+}
+
+static void cancel_toolbar_fgcolor(GtkWidget *widget, GtkIMHtmlToolbar *toolbar)
+{
+       	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->fgcolor), FALSE);
+	gtk_widget_destroy(toolbar->fgcolor_dialog);
+	toolbar->fgcolor_dialog = NULL;
+}
+
+static void do_fgcolor(GtkWidget *widget, GtkColorSelection *colorsel)
+{
+	GdkColor text_color;
+	GtkIMHtmlToolbar *toolbar = g_object_get_data(G_OBJECT(colorsel), "gaim_toolbar");
+	char *open_tag;
+
+	open_tag = g_malloc(30);
+	gtk_color_selection_get_current_color(colorsel, &text_color);
+	g_snprintf(open_tag, 23, "#%02X%02X%02X",
+			   text_color.red / 256,
+			   text_color.green / 256,
+			   text_color.blue / 256);
+	gtk_imhtml_toggle_forecolor(GTK_IMHTML(toolbar->imhtml), open_tag);
+
+	g_free(open_tag);
+	cancel_toolbar_fgcolor(NULL, toolbar);
+}
+
+static void
+toggle_fg_color(GtkWidget *color, GtkIMHtmlToolbar *toolbar)
+{
+	if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(color))) {
+		GtkWidget *colorsel;
+		GdkColor fgcolor;
+		
+		/*gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"),
+		  &fgcolor);*/
+		if (!toolbar->fgcolor_dialog) {
+			
+			toolbar->fgcolor_dialog = gtk_color_selection_dialog_new(_("Select Text Color"));
+			colorsel = GTK_COLOR_SELECTION_DIALOG(toolbar->fgcolor_dialog)->colorsel;
+			//gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(colorsel), &fgcolor);
+			g_object_set_data(G_OBJECT(colorsel), "gaim_toolbar", toolbar);
+			
+			g_signal_connect(G_OBJECT(toolbar->fgcolor_dialog), "delete_event",
+					 G_CALLBACK(cancel_toolbar_fgcolor), toolbar);
+			g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(toolbar->fgcolor_dialog)->ok_button),
+					 "clicked", G_CALLBACK(do_fgcolor), colorsel);
+			g_signal_connect(G_OBJECT
+					 (GTK_COLOR_SELECTION_DIALOG(toolbar->fgcolor_dialog)->cancel_button),
+					 "clicked", G_CALLBACK(cancel_toolbar_fgcolor), toolbar);
+			
+		}
+		gtk_window_present(toolbar->fgcolor_dialog);
+	} else if (toolbar->fgcolor_dialog != NULL) {
+		cancel_toolbar_fgcolor(color, toolbar);
+	} else {
+		//gaim_gtk_advance_past(gtkconv, "<FONT COLOR>", "</FONT>");
+	}
+	gtk_widget_grab_focus(toolbar->imhtml);
+}
+
+static void cancel_toolbar_bgcolor(GtkWidget *widget, GtkIMHtmlToolbar *toolbar)
+{
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->bgcolor), FALSE);
+	gtk_widget_destroy(toolbar->bgcolor_dialog);
+	toolbar->bgcolor_dialog = NULL;
+}
+
+static void do_bgcolor(GtkWidget *widget, GtkColorSelection *colorsel)
+{
+	GdkColor text_color;
+	GtkIMHtmlToolbar *toolbar = g_object_get_data(G_OBJECT(colorsel), "gaim_toolbar");
+	char *open_tag;
+
+	open_tag = g_malloc(30);
+	gtk_color_selection_get_current_color(colorsel, &text_color);
+	g_snprintf(open_tag, 23, "#%02X%02X%02X",
+			   text_color.red / 256,
+			   text_color.green / 256,
+			   text_color.blue / 256);
+	gtk_imhtml_toggle_backcolor(GTK_IMHTML(toolbar->imhtml), open_tag);
+
+	g_free(open_tag);
+	cancel_toolbar_bgcolor(NULL, toolbar);
+}
+
+static void
+toggle_bg_color(GtkWidget *color, GtkIMHtmlToolbar *toolbar)
+{
+	if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(color))) {
+		GtkWidget *colorsel;
+		GdkColor bgcolor;
+		
+		/*gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"),
+		  &bgcolor);*/
+		if (!toolbar->bgcolor_dialog) {
+			
+			toolbar->bgcolor_dialog = gtk_color_selection_dialog_new(_("Select Text Color"));
+			colorsel = GTK_COLOR_SELECTION_DIALOG(toolbar->bgcolor_dialog)->colorsel;
+			//gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(colorsel), &bgcolor);
+			g_object_set_data(G_OBJECT(colorsel), "gaim_toolbar", toolbar);
+			
+			g_signal_connect(G_OBJECT(toolbar->bgcolor_dialog), "delete_event",
+					 G_CALLBACK(cancel_toolbar_bgcolor), toolbar);
+			g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(toolbar->bgcolor_dialog)->ok_button),
+					 "clicked", G_CALLBACK(do_bgcolor), colorsel);
+			g_signal_connect(G_OBJECT
+					 (GTK_COLOR_SELECTION_DIALOG(toolbar->bgcolor_dialog)->cancel_button),
+					 "clicked", G_CALLBACK(cancel_toolbar_bgcolor), toolbar);
+			
+		}
+		gtk_window_present(toolbar->bgcolor_dialog);
+	} else if (toolbar->bgcolor_dialog != NULL) {
+		cancel_toolbar_bgcolor(color, toolbar);
+	} else {
+		//gaim_gtk_advance_past(gtkconv, "<FONT COLOR>", "</FONT>");
+	}
+	gtk_widget_grab_focus(toolbar->imhtml);
+}
+
+static void
+cancel_link_cb(GtkIMHtmlToolbar *toolbar, GaimRequestFields *fields)
+{
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->link), FALSE);	
+	toolbar->link_dialog = NULL;
+}
+
+static void
+close_link_dialog(GtkIMHtmlToolbar *toolbar)
+{
+	if (toolbar->link_dialog != NULL)
+	{
+		gaim_request_close(GAIM_REQUEST_FIELDS, toolbar->link_dialog);
+		toolbar->link_dialog = NULL;
+	}
+}
+
+static void
+do_insert_link_cb(GtkIMHtmlToolbar *toolbar, GaimRequestFields *fields)
+{
+	const char *url, *description;
+
+	url         = gaim_request_fields_get_string(fields, "url");
+	description = gaim_request_fields_get_string(fields, "description");
+
+	if (description == NULL)
+		description = url;
+
+	gtk_imhtml_insert_link(GTK_IMHTML(toolbar->imhtml), url, description);
+	
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->link), FALSE);
+
+	toolbar->link_dialog = NULL;
+}
+
+static void
+insert_link_cb(GtkWidget *w, GtkIMHtmlToolbar *toolbar)
+{
+	if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->link))) {
+		GaimRequestFields *fields;
+		GaimRequestFieldGroup *group;
+		GaimRequestField *field;
+		
+		fields = gaim_request_fields_new();
+		
+		group = gaim_request_field_group_new(NULL);
+		gaim_request_fields_add_group(fields, group);
+		
+		field = gaim_request_field_string_new("url", _("_URL"), NULL, FALSE);
+		gaim_request_field_set_required(field, TRUE);
+		gaim_request_field_group_add_field(group, field);
+		
+		field = gaim_request_field_string_new("description", _("_Description"),
+						      NULL, FALSE);
+		gaim_request_field_group_add_field(group, field);
+		
+		toolbar->link_dialog =
+			gaim_request_fields(toolbar, _("Insert Link"),
+					    NULL,
+					    _("Please enter the URL and description of the "
+					      "link that you want to insert. The description "
+					      "is optional."),
+					    fields,
+					    _("_Insert"), G_CALLBACK(do_insert_link_cb),
+					    _("Cancel"), G_CALLBACK(cancel_link_cb),
+					    toolbar);
+ 	} else {
+		close_link_dialog(toolbar);
+	}
+	gtk_widget_grab_focus(toolbar->imhtml);
+}
+
+
+static void
+do_insert_image_cb(GtkWidget *widget, int resp, GtkIMHtmlToolbar *toolbar)
+{
+	char *name, *filename;
+	char *buf, *filedata;
+	size_t size;
+	GError *error = NULL;
+	int id;
+
+	if (resp != GTK_RESPONSE_OK) {
+		//set_toggle(toolbar->image, FALSE);
+		gtk_widget_destroy(widget);
+		toolbar->image_dialog = NULL;
+		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->image), FALSE);
+		return;
+	}
+
+	name = g_strdup(gtk_file_selection_get_filename(GTK_FILE_SELECTION(widget)));
+
+	if (!name) {
+		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->image), FALSE);
+		return;
+	}
+
+	if (gaim_gtk_check_if_dir(name, GTK_FILE_SELECTION(widget))) {
+		g_free(name);
+		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->image), FALSE);
+		return;
+	}
+
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->image), FALSE);
+
+	if (!g_file_get_contents(name, &filedata, &size, &error)) {
+		gaim_notify_error(NULL, NULL, error->message, NULL);
+
+		g_error_free(error);
+		g_free(name);
+
+		return;
+	}
+
+	filename = name;
+	while (strchr(filename, '/'))
+		filename = strchr(filename, '/') + 1;
+
+	id = gaim_imgstore_add(filedata, size, filename);
+	g_free(filedata);
+
+	if (!id) {
+		buf = g_strdup_printf(_("Failed to store image: %s\n"), name);
+		gaim_notify_error(NULL, NULL, buf, NULL);
+
+		g_free(buf);
+		g_free(name);
+
+		return;
+	}
+
+	//im->images = g_slist_append(im->images, GINT_TO_POINTER(id));
+
+	/*buf = g_strdup_printf("<IMG ID=\"%d\" SRC=\"file://%s\">", id, filename);
+	gtk_text_buffer_insert_at_cursor(GTK_TEXT_BUFFER(gtkconv->entry_buffer), buf, -1);
+	g_free(buf);
+	*/
+	g_free(name);
+}
+
+
+static void
+insert_image_cb(GtkWidget *save, GtkIMHtmlToolbar *toolbar)
+{
+	char buf[BUF_LONG];
+	GtkWidget *window;
+
+	if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->image))) {
+		window = gtk_file_selection_new(_("Insert Image"));
+		g_snprintf(buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S, gaim_home_dir());
+		gtk_file_selection_set_filename(GTK_FILE_SELECTION(window), buf);
+
+		gtk_dialog_set_default_response(GTK_DIALOG(window), GTK_RESPONSE_OK);
+		g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(window)),
+				"response", G_CALLBACK(do_insert_image_cb), toolbar);
+
+		gtk_widget_show(window);
+		toolbar->image_dialog = window;
+	} else {
+		gtk_widget_destroy(toolbar->image_dialog);
+		toolbar->image_dialog = NULL;
+	}
+	gtk_widget_grab_focus(toolbar->imhtml);
+}
+
+
+void close_smiley_dialog(GtkWidget *widget, GtkIMHtmlToolbar *toolbar)
+{
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->smiley), FALSE);
+	
+	if (toolbar->smiley_dialog) {
+		gtk_widget_destroy(toolbar->smiley_dialog);
+		toolbar->smiley_dialog = NULL;
+	}
+}
+
+
+void insert_smiley_text(GtkWidget *widget, GtkIMHtmlToolbar *toolbar)
+{
+	char *smiley_text = g_object_get_data(G_OBJECT(widget), "smiley_text");
+	//GaimPlugin *proto = gaim_find_prpl(gaim_account_get_protocol_id(gaim_conversation_get_account(c)));
+
+	gtk_imhtml_insert_smiley(GTK_IMHTML(toolbar->imhtml), NULL, smiley_text); //proto->info->name, smiley_text);
+
+	close_smiley_dialog(NULL, toolbar);
+}
+
+
+static void add_smiley(GtkIMHtmlToolbar *toolbar, GtkWidget *table, int row, int col, char *filename, char *face)
+{
+	GtkWidget *image;
+	GtkWidget *button;
+
+	image = gtk_image_new_from_file(filename);
+	button = gtk_button_new();
+	gtk_container_add(GTK_CONTAINER(button), image);
+	g_object_set_data(G_OBJECT(button), "smiley_text", face);
+	g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(insert_smiley_text), toolbar);
+
+	gtk_tooltips_set_tip(toolbar->tooltips, button, face, NULL);
+
+	gtk_table_attach_defaults(GTK_TABLE(table), button, col, col+1, row, row+1);
+
+	/* these look really weird with borders */
+	gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
+
+	gtk_widget_show(button);
+}
+
+
+static gboolean smiley_is_unique(GSList *list, GtkIMHtmlSmiley *smiley) {
+	while(list) {
+		GtkIMHtmlSmiley *cur = list->data;
+		if(!strcmp(cur->file, smiley->file))
+			return FALSE;
+		list = list->next;
+	}
+	return TRUE;
+}
+
+
+static void
+insert_smiley_cb(GtkWidget *smiley, GtkIMHtmlToolbar *toolbar)
+{
+	if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(smiley))) {
+	
+		GtkWidget *dialog;
+		GtkWidget *smiley_table = NULL;
+		GSList *smileys, *unique_smileys = NULL;
+		int width;
+		int row = 0, col = 0;
+		
+		if (toolbar->smiley_dialog) {
+			gtk_widget_grab_focus(toolbar->imhtml);
+			return;
+		}
+		
+		/*
+		  if(c->account)
+		  smileys = get_proto_smileys(
+		  gaim_account_get_protocol_id(gaim_conversation_get_account(c)));
+		  else
+		*/
+		
+		smileys = get_proto_smileys(GAIM_PROTO_DEFAULT);
+		
+		while(smileys) {
+			GtkIMHtmlSmiley *smiley = smileys->data;
+			if(!smiley->hidden) {
+				if(smiley_is_unique(unique_smileys, smiley))
+					unique_smileys = g_slist_append(unique_smileys, smiley);
+			}
+			smileys = smileys->next;
+		}
+		
+		
+		width = floor(sqrt(g_slist_length(unique_smileys)));
+		
+		GAIM_DIALOG(dialog);
+		gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE);
+		gtk_window_set_role(GTK_WINDOW(dialog), "smiley_dialog");
+		gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_MOUSE);
+		
+		smiley_table = gtk_table_new(width, width, TRUE);
+		
+		/* pack buttons */
+		
+		while(unique_smileys) {
+			GtkIMHtmlSmiley *smiley = unique_smileys->data;
+			if(!smiley->hidden) {
+				add_smiley(toolbar, smiley_table, row, col, smiley->file, smiley->smile);
+				if(++col >= width) {
+					col = 0;
+					row++;
+				}
+			}
+			unique_smileys = unique_smileys->next;
+		}
+		
+		gtk_container_add(GTK_CONTAINER(dialog), smiley_table);
+		
+		gtk_widget_show(smiley_table);
+		
+		gtk_container_set_border_width(GTK_CONTAINER(dialog), 5);
+		
+		/* connect signals */
+		g_object_set_data(G_OBJECT(dialog), "dialog_type", "smiley dialog");
+		g_signal_connect(G_OBJECT(dialog), "delete_event",
+				 G_CALLBACK(close_smiley_dialog), toolbar);
+		
+		/* show everything */
+		gtk_window_set_title(GTK_WINDOW(dialog), _("Smile!"));
+		gtk_widget_show_all(dialog);
+		
+		toolbar->smiley_dialog = dialog;
+		
+	} else if (toolbar->smiley_dialog) {
+		close_smiley_dialog(smiley, toolbar);
+	}
+	gtk_widget_grab_focus(toolbar->imhtml);
+}
+
+enum {
+	LAST_SIGNAL
+};
+//static guint signals [LAST_SIGNAL] = { 0 };
+
+static void
+gtk_imhtmltoolbar_finalize (GObject *object)
+{
+	/*GtkIMHtml *imhtml = GTK_IMHTML(object);
+	GList *scalables;
+
+	g_hash_table_destroy(imhtml->smiley_data);
+	gtk_smiley_tree_destroy(imhtml->default_smilies);
+	gdk_cursor_unref(imhtml->hand_cursor);
+	gdk_cursor_unref(imhtml->arrow_cursor);
+	gdk_cursor_unref(imhtml->text_cursor);
+	if(imhtml->tip_window){
+		gtk_widget_destroy(imhtml->tip_window);
+	}
+	if(imhtml->tip_timer)
+		gtk_timeout_remove(imhtml->tip_timer);
+
+	for(scalables = imhtml->scalables; scalables; scalables = scalables->next) {
+		GtkIMHtmlScalable *scale = GTK_IMHTML_SCALABLE(scalables->data);
+		scale->free(scale);
+	}
+
+	g_list_free(imhtml->scalables);
+	G_OBJECT_CLASS(parent_class)->finalize (object);*/
+}
+
+/* Boring GTK stuff */
+static void gtk_imhtmltoolbar_class_init (GtkIMHtmlToolbarClass *class)
+{
+	GtkObjectClass *object_class;
+	GObjectClass   *gobject_class;
+	object_class = (GtkObjectClass*) class;
+	gobject_class = (GObjectClass*) class;
+	parent_class = gtk_type_class(GTK_TYPE_VBOX);
+	/*	signals[URL_CLICKED] = g_signal_new(url_clicked",
+						G_TYPE_FROM_CLASS(gobject_class),
+						G_SIGNAL_RUN_FIRST,
+						G_STRUCT_OFFSET(GtkIMHtmlClass, url_clicked),
+						NULL,
+						0,
+						g_cclosure_marshal_VOID__POINTER,
+						G_TYPE_NONE, 1,
+						G_TYPE_POINTER);*/
+	gobject_class->finalize = gtk_imhtmltoolbar_finalize;
+}
+
+static void gtk_imhtmltoolbar_init (GtkIMHtmlToolbar *toolbar)
+{
+	GtkWidget *hbox;
+	GtkWidget *button;
+	GtkWidget *sep;
+	GtkSizeGroup *sg;
+
+	toolbar->imhtml = NULL;
+	toolbar->font_dialog = NULL;
+	toolbar->fgcolor_dialog = NULL;
+	toolbar->bgcolor_dialog = NULL;
+	toolbar->link_dialog = NULL;
+	toolbar->smiley_dialog = NULL;
+	toolbar->image_dialog = NULL;
+
+	toolbar->tooltips = gtk_tooltips_new();
+
+	sg = gtk_size_group_new(GTK_SIZE_GROUP_BOTH);
+
+	sep = gtk_hseparator_new();
+	gtk_box_pack_start(GTK_BOX(toolbar), sep, FALSE, FALSE, 0);
+	gtk_widget_show(sep);
+
+	hbox = gtk_hbox_new(FALSE, 6);
+	gtk_box_pack_start(GTK_BOX(toolbar), hbox, FALSE, FALSE, 0);
+
+	/* Bold */
+	button = gaim_pixbuf_toolbar_button_from_stock(GTK_STOCK_BOLD);
+	gtk_size_group_add_widget(sg, button);
+	gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
+	gtk_tooltips_set_tip(toolbar->tooltips, button, _("Bold"), NULL);
+
+	g_signal_connect(G_OBJECT(button), "clicked",
+			 G_CALLBACK(do_bold), toolbar);
+
+	toolbar->bold = button;
+
+	/* Italic */
+	button = gaim_pixbuf_toolbar_button_from_stock(GTK_STOCK_ITALIC);
+	gtk_size_group_add_widget(sg, button);
+	gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
+	gtk_tooltips_set_tip(toolbar->tooltips, button, _("Italic"), NULL);
+
+	g_signal_connect(G_OBJECT(button), "clicked",
+			 G_CALLBACK(do_italic), toolbar);
+
+	toolbar->italic = button;
+
+	/* Underline */
+	button = gaim_pixbuf_toolbar_button_from_stock(GTK_STOCK_UNDERLINE);
+	gtk_size_group_add_widget(sg, button);
+	gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
+	gtk_tooltips_set_tip(toolbar->tooltips, button, _("Underline"), NULL);
+
+	g_signal_connect(G_OBJECT(button), "clicked",
+			 G_CALLBACK(do_underline), toolbar);
+
+	toolbar->underline = button;
+
+	/* Sep */
+	sep = gtk_vseparator_new();
+	gtk_box_pack_start(GTK_BOX(hbox), sep, FALSE, FALSE, 0);
+
+	/* Increase font size */
+	button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_TEXT_BIGGER);
+	gtk_size_group_add_widget(sg, button);
+	gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
+	gtk_tooltips_set_tip(toolbar->tooltips, button,
+			     _("Larger font size"), NULL);
+
+	g_signal_connect(G_OBJECT(button), "clicked",
+			 G_CALLBACK(do_big), toolbar);
+
+	toolbar->larger_size = button;
+
+	/* Decrease font size */
+	button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_TEXT_SMALLER);
+	gtk_size_group_add_widget(sg, button);
+	gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
+	gtk_tooltips_set_tip(toolbar->tooltips, button,
+			     _("Smaller font size"), NULL);
+
+	g_signal_connect(G_OBJECT(button), "clicked",
+			 G_CALLBACK(do_small), toolbar);
+
+	toolbar->smaller_size = button;
+
+	/* Sep */
+	sep = gtk_vseparator_new();
+	gtk_box_pack_start(GTK_BOX(hbox), sep, FALSE, FALSE, 0);
+
+	/* Font Face */
+
+	button = gaim_pixbuf_toolbar_button_from_stock(GTK_STOCK_SELECT_FONT);
+	gtk_size_group_add_widget(sg, button);
+	gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
+	gtk_tooltips_set_tip(toolbar->tooltips, button,
+			_("Font Face"), NULL);
+
+	g_signal_connect(G_OBJECT(button), "clicked",
+			 G_CALLBACK(toggle_font), toolbar);
+
+	toolbar->font = button;
+
+	/* Foreground Color */
+	button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_FGCOLOR);
+	gtk_size_group_add_widget(sg, button);
+	gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
+	gtk_tooltips_set_tip(toolbar->tooltips, button,
+			     _("Foreground font color"), NULL);
+
+	g_signal_connect(G_OBJECT(button), "clicked",
+			 G_CALLBACK(toggle_fg_color), toolbar);
+
+	toolbar->fgcolor = button;
+
+	/* Background Color */
+	button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_BGCOLOR);
+	gtk_size_group_add_widget(sg, button);
+	gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
+	gtk_tooltips_set_tip(toolbar->tooltips, button,
+			     _("Background color"), NULL);
+
+	g_signal_connect(G_OBJECT(button), "clicked",
+			 G_CALLBACK(toggle_bg_color), toolbar);
+
+	toolbar->bgcolor = button;
+
+	/* Sep */
+	sep = gtk_vseparator_new();
+	gtk_box_pack_start(GTK_BOX(hbox), sep, FALSE, FALSE, 0);
+
+	/* Insert Link */
+	button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_LINK);
+	gtk_size_group_add_widget(sg, button);
+	gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
+	gtk_tooltips_set_tip(toolbar->tooltips, button, _("Insert link"), NULL);
+	g_signal_connect(G_OBJECT(button), "clicked",
+				 G_CALLBACK(insert_link_cb), toolbar);
+	
+	toolbar->link = button;
+
+	/* Insert IM Image */
+	button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_IMAGE);
+	gtk_size_group_add_widget(sg, button);
+	gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
+	gtk_tooltips_set_tip(toolbar->tooltips, button, _("Insert image"), NULL);
+
+	g_signal_connect(G_OBJECT(button), "clicked",
+			 G_CALLBACK(insert_image_cb), toolbar);
+
+	toolbar->image = button;
+
+	/* Insert Smiley */
+	button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_SMILEY);
+	gtk_size_group_add_widget(sg, button);
+	gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
+	gtk_tooltips_set_tip(toolbar->tooltips, button, _("Insert smiley"), NULL);
+
+	g_signal_connect(G_OBJECT(button), "clicked",
+			 G_CALLBACK(insert_smiley_cb), toolbar);
+
+	toolbar->smiley = button;
+
+
+	sep = gtk_hseparator_new();
+	gtk_box_pack_start(GTK_BOX(toolbar), sep, FALSE, FALSE, 0);
+	gtk_widget_show(sep);
+
+
+//if (!gaim_prefs_get_bool("/gaim/gtk/conversations/show_formatting_toolbar"))
+//	gtk_widget_hide(vbox);
+
+	gtk_widget_show_all(hbox);
+}
+
+GtkWidget *gtk_imhtmltoolbar_new()
+{
+	return GTK_WIDGET(g_object_new(gtk_imhtmltoolbar_get_type(), NULL));
+}
+
+GType gtk_imhtmltoolbar_get_type()
+{
+	static GType imhtmltoolbar_type = 0;
+
+	if (!imhtmltoolbar_type) {
+		static const GTypeInfo imhtmltoolbar_info = {
+			sizeof(GtkIMHtmlToolbarClass),
+			NULL,
+			NULL,
+			(GClassInitFunc) gtk_imhtmltoolbar_class_init,
+			NULL,
+			NULL,
+			sizeof (GtkIMHtmlToolbar),
+			0,
+			(GInstanceInitFunc) gtk_imhtmltoolbar_init
+		};
+
+		imhtmltoolbar_type = g_type_register_static(gtk_vbox_get_type(),
+				"GtkIMHtmlToolbar", &imhtmltoolbar_info, 0);
+	}
+
+	return imhtmltoolbar_type;
+}
+
+
+void gtk_imhtmltoolbar_attach    (GtkIMHtmlToolbar *toolbar, GtkWidget *imhtml)
+{
+	toolbar->imhtml = imhtml;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/gtkimhtmltoolbar.h	Mon Feb 23 21:18:27 2004 +0000
@@ -0,0 +1,89 @@
+/*
+ * GtkIMHtmlToolbar
+ *
+ * Gaim is the legal property of its developers, whose names are too numerous
+ * to list here.  Please refer to the COPYRIGHT file distributed with this
+ * source distribution.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+#include <gtk/gtkvbox.h>
+#include "gtkimhtml.h"
+#ifndef __GTK_IMHTMLTOOLBAR_H
+#define __GTK_IMHTMLTOOLBAR_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define GTK_TYPE_IMHTMLTOOLBAR            (gtk_imhtmltoolbar_get_type ())
+#define GTK_IMHTMLTOOLBAR(obj)            (GTK_CHECK_CAST ((obj), GTK_TYPE_IMHTMLTOOLBAR, GtkIMHtmlToolbar))
+#define GTK_IMHTMLTOOLBAR_CLASS(klass)    (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_IMHTMLTOOLBAR, GtkIMHtmlToolbarClass))
+#define GTK_IS_IMHTMLTOOLBAR(obj)         (GTK_CHECK_TYPE ((obj), GTK_TYPE_IMHTMLTOOLBAR))
+#define GTK_IS_IMHTMLTOOLBAR_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_IMHTMLTOOLBAR))
+
+typedef struct _GtkIMHtmlToolbar		GtkIMHtmlToolbar;
+typedef struct _GtkIMHtmlToolbarClass		GtkIMHtmlToolbarClass;
+
+struct _GtkIMHtmlToolbar {
+	GtkVBox box;
+
+	GtkWidget *imhtml;
+
+	GtkTooltips *tooltips;
+	
+	GtkWidget *bold;
+	GtkWidget *italic;
+	GtkWidget *underline;
+	
+	GtkWidget *larger_size;
+	GtkWidget *normal_size;
+	GtkWidget *smaller_size;
+
+	GtkWidget *font;
+	GtkWidget *fgcolor;
+	GtkWidget *bgcolor;
+
+	GtkWidget *image;
+	GtkWidget *link;
+	GtkWidget *smiley;
+	GtkWidget *log;
+
+	GtkWidget *font_dialog;
+	GtkWidget *fgcolor_dialog;
+	GtkWidget *bgcolor_dialog;
+	GtkWidget *link_dialog;
+	GtkWidget *smiley_dialog;
+	GtkWidget *image_dialog;
+};
+
+struct _GtkIMHtmlToolbarClass {
+	GtkVBoxClass parent_class;
+
+};
+
+GtkType    gtk_imhtmltoolbar_get_type         (void);
+GtkWidget* gtk_imhtmltoolbar_new              (void);
+
+void gtk_imhtmltoolbar_attach    (GtkIMHtmlToolbar *toolbar, GtkWidget *imhtml);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
--- a/src/ui.h	Sun Feb 22 22:10:47 2004 +0000
+++ b/src/ui.h	Mon Feb 23 21:18:27 2004 +0000
@@ -136,10 +136,7 @@
 extern void create_away_mess(GtkWidget *, void *);
 extern void dialog_link_show(GaimConversation *);
 extern void dialog_link_destroy(GaimConversation *);
-extern void show_smiley_dialog(GaimConversation *, GtkWidget *);
-extern void close_smiley_dialog(GtkWidget *widget, GaimConversation *c);
 extern void set_smiley_array(GtkWidget *widget, int smiley_type);
-extern void insert_smiley_text(GtkWidget *widget, GaimConversation *c);
 extern void show_font_dialog(GaimConversation *c, GtkWidget *font);
 extern void cancel_font(GtkWidget *widget, GaimConversation *c);
 extern void apply_font(GtkWidget *widget, GtkFontSelection *fontsel);