changeset 11271:b33eccbc3a10

[gaim-migrate @ 13454] Add a clear formatting button to the GtkImHTML toolbar (to fulfill a request from SimGuy and Bleeter) and remove the ugly clear formatting button from the prefs. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Mon, 15 Aug 2005 06:52:45 +0000
parents da0dc44368ba
children 80ee726755d4
files pixmaps/Makefile.am pixmaps/clear.png src/gtkimhtmltoolbar.c src/gtkimhtmltoolbar.h src/gtkprefs.c src/gtkstock.c src/gtkstock.h
diffstat 7 files changed, 34 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/pixmaps/Makefile.am	Mon Aug 15 05:56:13 2005 +0000
+++ b/pixmaps/Makefile.am	Mon Aug 15 06:52:45 2005 +0000
@@ -6,6 +6,7 @@
 		away.png			\
 		change-bgcolor-small.png	\
 		change-fgcolor-small.png	\
+		clear.png			\
 		connect.png			\
 		edit.png			\
 		gaim.png			\
@@ -68,7 +69,7 @@
 
 
 gaimbuttonpixdir = $(datadir)/pixmaps/gaim/buttons
-gaimbuttonpix_DATA = about_menu.png accounts.png change-bgcolor-small.png change-fgcolor-small.png edit.png insert-image-small.png insert-link-small.png insert-smiley-small.png pause.png text_bigger.png text_normal.png text_smaller.png send-im.png
+gaimbuttonpix_DATA = about_menu.png accounts.png change-bgcolor-small.png change-fgcolor-small.png clear.png edit.png insert-image-small.png insert-link-small.png insert-smiley-small.png pause.png text_bigger.png text_normal.png text_smaller.png send-im.png
 
 gaimdialogpixdir = $(datadir)/pixmaps/gaim/dialogs
 gaimdialogpix_DATA = gaim_error.png gaim_info.png gaim_question.png gaim_warning.png gaim_cool.png gaim_auth.png
Binary file pixmaps/clear.png has changed
--- a/src/gtkimhtmltoolbar.c	Mon Aug 15 05:56:13 2005 +0000
+++ b/src/gtkimhtmltoolbar.c	Mon Aug 15 06:52:45 2005 +0000
@@ -322,6 +322,13 @@
 }
 
 static void
+clear_formatting_cb(GtkWidget *clear, GtkIMHtmlToolbar *toolbar)
+{
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->clear), FALSE);
+	gtk_imhtml_clear_formatting(GTK_IMHTML(toolbar->imhtml));
+}
+
+static void
 cancel_link_cb(GtkIMHtmlToolbar *toolbar, GaimRequestFields *fields)
 {
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->link), FALSE);
@@ -1009,6 +1016,22 @@
 	sep = gtk_vseparator_new();
 	gtk_box_pack_start(GTK_BOX(hbox), sep, FALSE, FALSE, 0);
 
+	/* Clear Formatting */
+	button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_CLEAR);
+	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,
+			     _("Clear formatting"), NULL);
+
+	g_signal_connect(G_OBJECT(button), "clicked",
+			 G_CALLBACK(clear_formatting_cb), toolbar);
+
+	toolbar->clear = 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);
--- a/src/gtkimhtmltoolbar.h	Mon Aug 15 05:56:13 2005 +0000
+++ b/src/gtkimhtmltoolbar.h	Mon Aug 15 06:52:45 2005 +0000
@@ -60,6 +60,8 @@
 	GtkWidget *fgcolor;
 	GtkWidget *bgcolor;
 
+	GtkWidget *clear;
+
 	GtkWidget *image;
 	GtkWidget *link;
 	GtkWidget *smiley;
--- a/src/gtkprefs.c	Mon Aug 15 05:56:13 2005 +0000
+++ b/src/gtkprefs.c	Mon Aug 15 06:52:45 2005 +0000
@@ -818,11 +818,6 @@
 	}
 }
 
-static void
-formatting_reset_cb(GtkWidget *w, GtkWidget *imhtml) {
-	gtk_imhtml_clear_formatting(GTK_IMHTML(imhtml));
-}
-
 static GtkWidget *
 list_page()
 {
@@ -873,14 +868,14 @@
 conv_page()
 {
 	GtkWidget *ret;
-	GtkWidget *vbox, *vbox2;
-	GtkWidget *hbox;
+	GtkWidget *vbox;
 	GtkWidget *label;
 	GList *names = NULL;
 	GtkWidget *frame;
 	GtkWidget *imhtml;
 	GtkWidget *toolbar;
-	GtkWidget *button;
+	GtkWidget *hbox;
+	GtkWidget *vbox2;
 
 	ret = gtk_vbox_new(FALSE, GAIM_HIG_BOX_SPACE);
 	gtk_container_set_border_width(GTK_CONTAINER(ret), GAIM_HIG_BORDER);
@@ -902,9 +897,6 @@
 			"/gaim/gtk/conversations/spellcheck", vbox);
 #endif
 
-	hbox = gtk_hbox_new(FALSE, GAIM_HIG_BOX_SPACE);
-	gtk_container_add(GTK_CONTAINER(vbox), hbox);
-
 	frame = gaim_gtk_create_imhtml(TRUE, &imhtml, &toolbar);
 	gtk_widget_set_name(imhtml, "gaim_gtkprefs_font_imhtml");
 	gtk_imhtml_set_whole_buffer_formatting_only(GTK_IMHTML(imhtml), TRUE);
@@ -921,12 +913,7 @@
 
 	gtk_imhtml_append_text(GTK_IMHTML(imhtml), _("This is how your outgoing message text will appear when you use protocols that support formatting. :)"), 0);
 
-	gtk_box_pack_start(GTK_BOX(hbox), frame, FALSE, FALSE, 0);
-
-	vbox2 = gtk_vbox_new(FALSE, 0);
-	gtk_box_pack_start(GTK_BOX(hbox), vbox2, FALSE, FALSE, 0);
-	button = gtk_button_new_with_mnemonic(_("_Clear Formatting"));
-	gtk_box_pack_start(GTK_BOX(vbox2), button, FALSE, FALSE, 0);
+	gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0);
 
 	if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_bold"))
 		gtk_imhtml_toggle_bold(GTK_IMHTML(imhtml));
@@ -940,9 +927,6 @@
 	gtk_imhtml_toggle_background(GTK_IMHTML(imhtml), gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"));
 	gtk_imhtml_toggle_fontface(GTK_IMHTML(imhtml), gaim_prefs_get_string("/gaim/gtk/conversations/font_face"));
 
-	g_signal_connect(G_OBJECT(button), "clicked",
-					 G_CALLBACK(formatting_reset_cb), imhtml);
-
 	g_signal_connect_after(G_OBJECT(imhtml), "format_function_toggle",
 					 G_CALLBACK(formatting_toggle_cb), toolbar);
 
--- a/src/gtkstock.c	Mon Aug 15 05:56:13 2005 +0000
+++ b/src/gtkstock.c	Mon Aug 15 06:52:45 2005 +0000
@@ -42,6 +42,7 @@
 	{ GAIM_STOCK_BGCOLOR,         "buttons", "change-bgcolor-small.png" },
 	{ GAIM_STOCK_BLOCK,           NULL,      GTK_STOCK_STOP             },
 	{ GAIM_STOCK_CHAT,            NULL,      GTK_STOCK_JUMP_TO          },
+	{ GAIM_STOCK_CLEAR,           "buttons", "clear.png"                },
 	{ GAIM_STOCK_DOWNLOAD,        NULL,      GTK_STOCK_GO_DOWN          },
 	{ GAIM_STOCK_DIALOG_AUTH,     "dialogs", "gaim_auth.png"            },
 	{ GAIM_STOCK_DIALOG_COOL,     "dialogs", "gaim_cool.png"            },
@@ -61,7 +62,7 @@
 	{ GAIM_STOCK_ICON_ONLINE,     "icons",   "online.png"               },
 	{ GAIM_STOCK_ICON_ONLINE_MSG, "icons",   "msgunread.png"            },
 	{ GAIM_STOCK_IGNORE,          NULL,      GTK_STOCK_DIALOG_ERROR     },
-	{ GAIM_STOCK_IM,              "buttons", "send-im.png"		        },
+	{ GAIM_STOCK_IM,              "buttons", "send-im.png"		    },
 	{ GAIM_STOCK_IMAGE,           "buttons", "insert-image-small.png"   },
 	{ GAIM_STOCK_INFO,            "icons",   "info.png",                },
 	{ GAIM_STOCK_INVITE,          NULL,      GTK_STOCK_JUMP_TO          },
--- a/src/gtkstock.h	Mon Aug 15 05:56:13 2005 +0000
+++ b/src/gtkstock.h	Mon Aug 15 06:52:45 2005 +0000
@@ -36,6 +36,7 @@
 #define GAIM_STOCK_BGCOLOR         "gaim-bgcolor"
 #define GAIM_STOCK_BLOCK           "gaim-block"
 #define GAIM_STOCK_CHAT            "gaim-chat"
+#define GAIM_STOCK_CLEAR           "gaim-clear"
 #define GAIM_STOCK_DIALOG_AUTH     "gaim-dialog-auth"
 #define GAIM_STOCK_DIALOG_COOL     "gaim-dialog-cool"
 #define GAIM_STOCK_DIALOG_ERROR    "gaim-dialog-error"