pidgin: b53f7f4e: Add support for rendering strikethrough ...

nosnilmot at pidgin.im nosnilmot at pidgin.im
Thu Jan 6 15:45:57 EST 2011


----------------------------------------------------------------------
Revision: b53f7f4eeb80dadaa8c653c5d7d6aec036fdca7c
Parent:   2331ff0a5cbe7c0ae11fe5411c3aa8845715c9fd
Author:   nosnilmot at pidgin.im
Date:     01/06/11 15:43:12
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/b53f7f4eeb80dadaa8c653c5d7d6aec036fdca7c

Changelog: 

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

Changes against parent 2331ff0a5cbe7c0ae11fe5411c3aa8845715c9fd

  patched  ChangeLog
  patched  pidgin/gtkimhtml.c
  patched  pidgin/gtkimhtml.h

-------------- next part --------------
============================================================
--- ChangeLog	5765fbcbaf2ee7505a874cdacedba91d1b2cd751
+++ ChangeLog	0e2191fec5ebc271773abfafb6ac1c4d24ffe077
@@ -13,6 +13,7 @@ version 2.7.10 (??/??/????):
 	* 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
============================================================
--- pidgin/gtkimhtml.c	403285dc48be2eeeee9799f17e53817d90048253
+++ pidgin/gtkimhtml.c	3f067cd89bd1a5435ea299fb9df1269b3d6f24cf
@@ -99,6 +99,18 @@ typedef struct _GtkIMHtmlProtocol
 	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 @@ void gtk_imhtml_insert_html_at_iter(GtkI
 						    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 @@ void gtk_imhtml_insert_html_at_iter(GtkI
 							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 @@ void gtk_imhtml_insert_html_at_iter(GtkI
 						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 @@ void gtk_imhtml_insert_html_at_iter(GtkI
 							    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);
============================================================
--- pidgin/gtkimhtml.h	f3a1884dcd575634acb1b27afea5e946b55cf44f
+++ pidgin/gtkimhtml.h	a2ea72c153f16ea2829f25a5c4149859ce570313
@@ -50,7 +50,9 @@ typedef struct _GtkIMHtmlClass		GtkIMHtm
 
 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 @@ struct _GtkIMHtmlClass {
 	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 @@ struct _GtkIMHtmlFontDetail {
 	gboolean underline;
 	gshort bold;
 };
+#endif
 
 struct _GtkSmileyTree {
 	GString *values;


More information about the Commits mailing list