# HG changeset patch # User Ka-Hing Cheung # Date 1186031411 0 # Node ID 900b13e40471dbbafba250fbafbb7e1d8a0210a7 # Parent d76f1a491357418922381daf911979bd6bedc347 Show current outgoing conversation formatting on the font label on the toolbar. This makes the toolbar sometimes shift a bit as you move across bold, italic, which probably can be worked around by setting the size a little bigger to accomodate, but is not done yet. The font size also doesn't affect the label formatting because I think it would shift too much diff -r d76f1a491357 -r 900b13e40471 ChangeLog --- a/ChangeLog Thu Aug 02 04:18:11 2007 +0000 +++ b/ChangeLog Thu Aug 02 05:10:11 2007 +0000 @@ -6,6 +6,10 @@ * Added support for Unicode status messages in Yahoo. * Server-stored aliases for Yahoo. (John Moody) + Pidgin: + * Show current outgoing conversation formatting on the font label on + the toolbar + version 2.1.0 (07/28/2007): libpurple: * Core changes to allow UIs to use second-granularity for scheduling. diff -r d76f1a491357 -r 900b13e40471 pidgin/gtkimhtmltoolbar.c --- a/pidgin/gtkimhtmltoolbar.c Thu Aug 02 04:18:11 2007 +0000 +++ b/pidgin/gtkimhtmltoolbar.c Thu Aug 02 05:10:11 2007 +0000 @@ -815,6 +815,9 @@ gboolean bold, italic, underline; char *tmp; char *tmp2; + GtkLabel *label = g_object_get_data(G_OBJECT(toolbar), "font_label"); + + gtk_label_set_label(label, _("_Font")); gtk_imhtml_get_current_format(GTK_IMHTML(toolbar->imhtml), &bold, &italic, &underline); @@ -822,7 +825,6 @@ if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->bold)) != bold) toggle_button_set_active_block(GTK_TOGGLE_BUTTON(toolbar->bold), bold, toolbar); - if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->italic)) != italic) toggle_button_set_active_block(GTK_TOGGLE_BUTTON(toolbar->italic), italic, toolbar); @@ -835,20 +837,57 @@ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->smaller_size), FALSE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->larger_size), FALSE); + if (bold) { + gchar *markup = g_strdup_printf("%s", + gtk_label_get_label(label)); + gtk_label_set_markup_with_mnemonic(label, markup); + g_free(markup); + } + if (italic) { + gchar *markup = g_strdup_printf("%s", + gtk_label_get_label(label)); + gtk_label_set_markup_with_mnemonic(label, markup); + g_free(markup); + } + if (underline) { + gchar *markup = g_strdup_printf("%s", + gtk_label_get_label(label)); + gtk_label_set_markup_with_mnemonic(label, markup); + g_free(markup); + } + tmp = gtk_imhtml_get_current_fontface(GTK_IMHTML(toolbar->imhtml)); toggle_button_set_active_block(GTK_TOGGLE_BUTTON(toolbar->font), (tmp != NULL), toolbar); + if (tmp != NULL) { + gchar *markup = g_strdup_printf("%s", + tmp, gtk_label_get_label(label)); + gtk_label_set_markup_with_mnemonic(label, markup); + g_free(markup); + } g_free(tmp); tmp = gtk_imhtml_get_current_forecolor(GTK_IMHTML(toolbar->imhtml)); toggle_button_set_active_block(GTK_TOGGLE_BUTTON(toolbar->fgcolor), (tmp != NULL), toolbar); + if (tmp != NULL) { + gchar *markup = g_strdup_printf("%s", + tmp, gtk_label_get_label(label)); + gtk_label_set_markup_with_mnemonic(label, markup); + g_free(markup); + } g_free(tmp); tmp = gtk_imhtml_get_current_backcolor(GTK_IMHTML(toolbar->imhtml)); tmp2 = gtk_imhtml_get_current_background(GTK_IMHTML(toolbar->imhtml)); toggle_button_set_active_block(GTK_TOGGLE_BUTTON(toolbar->bgcolor), (tmp != NULL || tmp2 != NULL), toolbar); + if (tmp != NULL) { + gchar *markup = g_strdup_printf("%s", + tmp, gtk_label_get_label(label)); + gtk_label_set_markup_with_mnemonic(label, markup); + g_free(markup); + } g_free(tmp); g_free(tmp2); } @@ -1100,6 +1139,8 @@ image = gtk_image_new_from_stock(GTK_STOCK_BOLD, gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL)); gtk_box_pack_start(GTK_BOX(bbox), image, FALSE, FALSE, 0); label = gtk_label_new_with_mnemonic(_("_Font")); + gtk_label_set_use_markup(GTK_LABEL(label), TRUE); + g_object_set_data(G_OBJECT(hbox), "font_label", label); gtk_box_pack_start(GTK_BOX(bbox), label, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), font_button, FALSE, FALSE, 0); gtk_widget_show_all(font_button);