Revision 3253

View differences:

libsylph/prefs_common.c
337 337
	 P_INT},
338 338
	{"display_header", "TRUE", &prefs_common.display_header, P_BOOL},
339 339
	{"render_html", "TRUE", &prefs_common.render_html, P_BOOL},
340
	{"alt_prefer_html", "FALSE", &prefs_common.alt_prefer_html, P_BOOL},
340 341
	{"html_only_as_attach", "FALSE", &prefs_common.html_only_as_attach,
341 342
	 P_BOOL},
342 343
	{"line_space", "2", &prefs_common.line_space, P_INT},
libsylph/prefs_common.h
345 345
	gboolean enable_newmsg_notify_window; /* Receive */
346 346

  
347 347
	gboolean nofilter_junk_sender_in_book; /* Junk Mail */
348

  
349
	gboolean alt_prefer_html;            /* Message */
348 350
};
349 351

  
350 352
extern PrefsCommon prefs_common;
src/textview.c
1 1
/*
2 2
 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3
 * Copyright (C) 1999-2012 Hiroyuki Yamamoto
3
 * Copyright (C) 1999-2013 Hiroyuki Yamamoto
4 4
 *
5 5
 * This program is free software; you can redistribute it and/or modify
6 6
 * it under the terms of the GNU General Public License as published by
......
1076 1076
	} else {
1077 1077
		/* text part */
1078 1078
		gtk_text_buffer_insert(buffer, &iter, "\n", 1);
1079
		if (!mimeinfo->main &&
1080
		    mimeinfo->parent &&
1081
		    mimeinfo->parent->children != mimeinfo)
1079
		if (mimeinfo->mime_type == MIME_TEXT_HTML ||
1080
		    (!mimeinfo->main && mimeinfo->parent &&
1081
		     mimeinfo->parent->children != mimeinfo))
1082 1082
			textview_add_part_widget(textview, &iter, mimeinfo, buf);
1083 1083
		textview_write_body(textview, mimeinfo, fp, charset);
1084 1084
	}
......
1142 1142
	level = mimeinfo->level;
1143 1143

  
1144 1144
	for (;;) {
1145
		textview_add_part(textview, mimeinfo, fp);
1146
		if (mimeinfo->parent && mimeinfo->parent->content_type &&
1147
		    !g_ascii_strcasecmp(mimeinfo->parent->content_type,
1148
					"multipart/alternative"))
1149
			mimeinfo = mimeinfo->parent->next;
1150
		else
1151
			mimeinfo = procmime_mimeinfo_next(mimeinfo);
1145
		if (mimeinfo->mime_type == MIME_MULTIPART &&
1146
		    mimeinfo->content_type &&
1147
		    !g_ascii_strcasecmp(mimeinfo->content_type,
1148
					"multipart/alternative")) {
1149
			MimeInfo *preferred_part = mimeinfo->children;
1150
			MimeInfo *child;
1151

  
1152
			if (prefs_common.alt_prefer_html) {
1153
				for (child = mimeinfo->children; child != NULL; child = child->next) {
1154
					if (child->mime_type == MIME_TEXT_HTML) {
1155
						preferred_part = child;
1156
						break;
1157
					}
1158
				}
1159
			}
1160

  
1161
			if (preferred_part) {
1162
				textview_add_part(textview, preferred_part, fp);
1163
				mimeinfo = preferred_part;
1164
				while (mimeinfo->next)
1165
					mimeinfo = mimeinfo->next;
1166
			}
1167
		} else {
1168
			textview_add_part(textview, mimeinfo, fp);
1169
		}
1170

  
1171
		mimeinfo = procmime_mimeinfo_next(mimeinfo);
1172

  
1152 1173
		if (!mimeinfo || mimeinfo->level <= level)
1153 1174
			break;
1154 1175
	}
src/prefs_common_dialog.c
162 162
	GtkWidget *chkbtn_disphdrpane;
163 163
	GtkWidget *chkbtn_disphdr;
164 164
	GtkWidget *chkbtn_html;
165
	GtkWidget *chkbtn_prefer_html;
165 166
	GtkWidget *chkbtn_htmlonly;
166 167
	GtkWidget *spinbtn_linespc;
167 168
	GtkObject *spinbtn_linespc_adj;
......
463 464
	 prefs_set_data_from_toggle, prefs_set_toggle},
464 465
	{"render_html", &message.chkbtn_html,
465 466
	 prefs_set_data_from_toggle, prefs_set_toggle},
467
	{"alt_prefer_html", &message.chkbtn_prefer_html,
468
	 prefs_set_data_from_toggle, prefs_set_toggle},
466 469
	{"html_only_as_attach", &message.chkbtn_htmlonly,
467 470
	 prefs_set_data_from_toggle, prefs_set_toggle},
468 471
	{"line_space", &message.spinbtn_linespc,
......
1873 1876
	GtkWidget *chkbtn_disphdr;
1874 1877
	GtkWidget *button_edit_disphdr;
1875 1878
	GtkWidget *chkbtn_html;
1879
	GtkWidget *chkbtn_prefer_html;
1876 1880
	GtkWidget *chkbtn_htmlonly;
1877 1881
	GtkWidget *hbox_linespc;
1878 1882
	GtkWidget *label_linespc;
......
1942 1946

  
1943 1947
	PACK_CHECK_BUTTON(vbox2, chkbtn_html,
1944 1948
			  _("Render HTML messages as text"));
1949
	PACK_CHECK_BUTTON(vbox2, chkbtn_prefer_html,
1950
			  _("Prefer HTML in multipart/alternative for display"));
1945 1951
	PACK_CHECK_BUTTON(vbox2, chkbtn_htmlonly,
1946 1952
			  _("Treat HTML only messages as attachment"));
1947 1953

  
......
2023 2029
	message.chkbtn_disphdrpane = chkbtn_disphdrpane;
2024 2030
	message.chkbtn_disphdr     = chkbtn_disphdr;
2025 2031
	message.chkbtn_html        = chkbtn_html;
2032
	message.chkbtn_prefer_html = chkbtn_prefer_html;
2026 2033
	message.chkbtn_htmlonly    = chkbtn_htmlonly;
2027 2034
	message.spinbtn_linespc    = spinbtn_linespc;
2028 2035

  

Also available in: Unified diff