Mercurial > pidgin
changeset 18773:900b13e40471
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
author | Ka-Hing Cheung <khc@hxbc.us> |
---|---|
date | Thu, 02 Aug 2007 05:10:11 +0000 |
parents | d76f1a491357 |
children | 88ad571744b4 ffec8cb71858 |
files | ChangeLog pidgin/gtkimhtmltoolbar.c |
diffstat | 2 files changed, 46 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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.
--- 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("<b>%s</b>", + gtk_label_get_label(label)); + gtk_label_set_markup_with_mnemonic(label, markup); + g_free(markup); + } + if (italic) { + gchar *markup = g_strdup_printf("<i>%s</i>", + gtk_label_get_label(label)); + gtk_label_set_markup_with_mnemonic(label, markup); + g_free(markup); + } + if (underline) { + gchar *markup = g_strdup_printf("<u>%s</u>", + 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("<span font_desc=\"%s\">%s</span>", + 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("<span foreground=\"%s\">%s</span>", + 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("<span background=\"%s\">%s</span>", + 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);