Mercurial > pidgin
changeset 31102:ac2cf73dbab8
Add support for rendering strikethrough when received as in-line CSS,
such as on XMPP, deprecating a struct in the process that had no use
being public anyway.
Fixes #13168
author | Stu Tomlinson <stu@nosnilmot.com> |
---|---|
date | Thu, 06 Jan 2011 20:43:12 +0000 |
parents | abaff1dd6548 |
children | 4ce69a55f2c6 |
files | ChangeLog pidgin/gtkimhtml.c pidgin/gtkimhtml.h |
diffstat | 3 files changed, 39 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Thu Jan 06 19:46:06 2011 +0000 +++ b/ChangeLog Thu Jan 06 20:43:12 2011 +0000 @@ -13,6 +13,7 @@ * Support using the Page Up and Page Down keys on the numeric keypad in the conversation window. (Ryan Flegel) (#13127) * Fix a few memory leaks. (Nader Morshed) (#13162) + * Support rendering strikethrough when received as in-line CSS. (#13168) Plugins: * The Voice/Video Settings plugin no longer resets selected devices to
--- a/pidgin/gtkimhtml.c Thu Jan 06 19:46:06 2011 +0000 +++ b/pidgin/gtkimhtml.c Thu Jan 06 20:43:12 2011 +0000 @@ -99,6 +99,18 @@ gboolean (*context_menu)(GtkIMHtml *imhtml, GtkIMHtmlLink *link, GtkWidget *menu); } GtkIMHtmlProtocol; +typedef struct _GtkIMHtmlFontDetail { + gushort size; + gchar *face; + gchar *fore; + gchar *back; + gchar *bg; + gchar *sml; + gboolean underline; + gboolean strike; + gshort bold; +} GtkIMHtmlFontDetail; + static gboolean gtk_text_view_drag_motion (GtkWidget *widget, GdkDragContext *context, @@ -3191,6 +3203,19 @@ gtk_imhtml_toggle_underline(imhtml); font->underline = 1; } + + if (oldfont) + { + font->strike = oldfont->strike; + } + if (textdec && font->strike != 1 + && g_ascii_strcasecmp(textdec, "line-through") == 0 + && (imhtml->format_functions & GTK_IMHTML_STRIKE) + && !(options & GTK_IMHTML_NO_FORMATTING)) + { + gtk_imhtml_toggle_strike(imhtml); + font->strike = 1; + } g_free(textdec); if (oldfont) @@ -3243,6 +3268,8 @@ gtk_imhtml_font_set_size(imhtml, 3); if (font->underline && !(options & GTK_IMHTML_NO_FORMATTING)) gtk_imhtml_toggle_underline(imhtml); + if (font->strike && !(options & GTK_IMHTML_NO_FORMATTING)) + gtk_imhtml_toggle_strike(imhtml); if (font->bold && !(options & GTK_IMHTML_NO_FORMATTING)) gtk_imhtml_toggle_bold(imhtml); if (!(options & GTK_IMHTML_NO_FONTS)) @@ -3255,14 +3282,17 @@ else { - if ((font->size != oldfont->size) && !(options & GTK_IMHTML_NO_SIZES)) + if ((font->size != oldfont->size) && !(options & GTK_IMHTML_NO_SIZES)) gtk_imhtml_font_set_size(imhtml, oldfont->size); if ((font->underline != oldfont->underline) && !(options & GTK_IMHTML_NO_FORMATTING)) gtk_imhtml_toggle_underline(imhtml); + if ((font->strike != oldfont->strike) && !(options & GTK_IMHTML_NO_FORMATTING)) + gtk_imhtml_toggle_strike(imhtml); + if (((font->bold && !oldfont->bold) || (oldfont->bold && !font->bold)) && !(options & GTK_IMHTML_NO_FORMATTING)) - gtk_imhtml_toggle_bold(imhtml); + gtk_imhtml_toggle_bold(imhtml); if (font->face && (!oldfont->face || strcmp(font->face, oldfont->face) != 0) && !(options & GTK_IMHTML_NO_FONTS)) gtk_imhtml_toggle_fontface(imhtml, oldfont->face); @@ -3271,7 +3301,7 @@ gtk_imhtml_toggle_forecolor(imhtml, oldfont->fore); if (font->back && (!oldfont->back || strcmp(font->back, oldfont->back) != 0) && !(options & GTK_IMHTML_NO_COLOURS)) - gtk_imhtml_toggle_backcolor(imhtml, oldfont->back); + gtk_imhtml_toggle_backcolor(imhtml, oldfont->back); } g_free (font->face);
--- a/pidgin/gtkimhtml.h Thu Jan 06 19:46:06 2011 +0000 +++ b/pidgin/gtkimhtml.h Thu Jan 06 20:43:12 2011 +0000 @@ -50,7 +50,9 @@ typedef struct _GtkIMHtml GtkIMHtml; typedef struct _GtkIMHtmlClass GtkIMHtmlClass; +#if !(defined PIDGIN_DISABLE_DEPRECATED) && !(defined _PIDGIN_GTKIMHTML_C_) typedef struct _GtkIMHtmlFontDetail GtkIMHtmlFontDetail; /* The five elements contained in a FONT tag */ +#endif typedef struct _GtkSmileyTree GtkSmileyTree; typedef struct _GtkIMHtmlSmiley GtkIMHtmlSmiley; typedef struct _GtkIMHtmlScalable GtkIMHtmlScalable; @@ -162,6 +164,8 @@ GList *protocols; /* List of GtkIMHtmlProtocol's */ }; +#if !(defined PIDGIN_DISABLE_DEPRECATED) && !(defined _PIDGIN_GTKIMHTML_C_) +/** @deprecated as of 2.7.10 */ struct _GtkIMHtmlFontDetail { gushort size; gchar *face; @@ -172,6 +176,7 @@ gboolean underline; gshort bold; }; +#endif struct _GtkSmileyTree { GString *values;