# HG changeset patch # User Sean Egan # Date 1188234971 0 # Node ID 42ee8f13c9171cb98136f37d7ef4b8b7f8a3c51f # Parent 02a57d349b5cae93ef10a98416295941293c9d7d Add horizontal rules and strikethroughs to the toolbar diff -r 02a57d349b5c -r 42ee8f13c917 pidgin/gtkimhtmltoolbar.c --- a/pidgin/gtkimhtmltoolbar.c Mon Aug 27 05:35:00 2007 +0000 +++ b/pidgin/gtkimhtmltoolbar.c Mon Aug 27 17:16:11 2007 +0000 @@ -70,6 +70,14 @@ } static void +do_strikethrough(GtkWidget *strikethrough, GtkIMHtmlToolbar *toolbar) +{ + g_return_if_fail(toolbar != NULL); + gtk_imhtml_toggle_strike(GTK_IMHTML(toolbar->imhtml)); + gtk_widget_grab_focus(toolbar->imhtml); +} + +static void do_small(GtkWidget *smalltb, GtkIMHtmlToolbar *toolbar) { g_return_if_fail(toolbar != NULL); @@ -433,6 +441,17 @@ gtk_widget_grab_focus(toolbar->imhtml); } +static void insert_hr_cb(GtkWidget *widget, GtkIMHtmlToolbar *toolbar) +{ + GtkTextIter iter; + GtkTextMark *ins; + GtkIMHtmlScalable *hr; + + ins = gtk_text_buffer_get_insert(gtk_text_view_get_buffer(GTK_TEXT_VIEW(toolbar->imhtml))); + gtk_text_buffer_get_iter_at_mark(gtk_text_view_get_buffer(GTK_TEXT_VIEW(toolbar->imhtml)), &iter, ins); + hr = gtk_imhtml_hr_new(); + gtk_imhtml_hr_add_to(hr, GTK_IMHTML(toolbar->imhtml), &iter); +} static void do_insert_image_cb(GtkWidget *widget, int response, GtkIMHtmlToolbar *toolbar) @@ -1027,6 +1046,13 @@ G_CALLBACK(do_underline), toolbar); toolbar->underline = button; + + /* Strikethrough */ + button = pidgin_pixbuf_toolbar_button_from_stock(GTK_STOCK_STRIKETHROUGH); + g_signal_connect(G_OBJECT(button), "clicked", + G_CALLBACK(do_strikethrough), toolbar); + toolbar->strikethrough = button; + /* Increase font size */ button = pidgin_pixbuf_toolbar_button_from_stock(PIDGIN_STOCK_TOOLBAR_TEXT_LARGER); g_signal_connect(G_OBJECT(button), "clicked", @@ -1124,6 +1150,7 @@ {_("_Bold"), &toolbar->bold, TRUE}, {_("_Italic"), &toolbar->italic, TRUE}, {_("_Underline"), &toolbar->underline, TRUE}, + {_("Strikethrough"), &toolbar->strikethrough, TRUE}, {_("_Larger"), &toolbar->larger_size, TRUE}, #if 0 {_("_Normal"), &toolbar->normal_size, TRUE}, @@ -1230,6 +1257,11 @@ g_signal_connect(G_OBJECT(toolbar->link), "notify::sensitive", G_CALLBACK(button_sensitiveness_changed), menuitem); + menuitem = gtk_menu_item_new_with_mnemonic(_("_Horizontal rule")); + g_signal_connect(G_OBJECT(menuitem), "activate" , G_CALLBACK(insert_hr_cb), toolbar); + gtk_menu_shell_append(GTK_MENU_SHELL(insert_menu), menuitem); + toolbar->insert_hr = menuitem; + g_signal_connect_swapped(G_OBJECT(insert_button), "button-press-event", G_CALLBACK(gtk_widget_activate), insert_button); g_signal_connect(G_OBJECT(insert_button), "activate", G_CALLBACK(pidgin_menu_clicked), insert_menu); g_signal_connect(G_OBJECT(insert_menu), "deactivate", G_CALLBACK(pidgin_menu_deactivate), insert_button); diff -r 02a57d349b5c -r 42ee8f13c917 pidgin/gtkimhtmltoolbar.h --- a/pidgin/gtkimhtmltoolbar.h Mon Aug 27 05:35:00 2007 +0000 +++ b/pidgin/gtkimhtmltoolbar.h Mon Aug 27 17:16:11 2007 +0000 @@ -74,6 +74,8 @@ GtkWidget *image_dialog; char *sml; + GtkWidget *strikethrough; + GtkWidget *insert_hr; }; struct _GtkIMHtmlToolbarClass { diff -r 02a57d349b5c -r 42ee8f13c917 pidgin/pidginstock.c --- a/pidgin/pidginstock.c Mon Aug 27 05:35:00 2007 +0000 +++ b/pidgin/pidginstock.c Mon Aug 27 17:16:11 2007 +0000 @@ -396,7 +396,7 @@ /* register custom icon sizes */ - microscopic = gtk_icon_size_register("pidgin-icon-size-tango-microscopic", 11, 11); + microscopic = gtk_icon_size_register(PIDGIN_ICON_SIZE_TANGO_MICROSCOPIC, 11, 11); extra_small = gtk_icon_size_register(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL, 16, 16); small = gtk_icon_size_register(PIDGIN_ICON_SIZE_TANGO_SMALL, 22, 22); medium = gtk_icon_size_register(PIDGIN_ICON_SIZE_TANGO_MEDIUM, 32, 32);