Revision 3254

View differences:

src/messageview.c
597 597
		if (!messageview->msginfo)
598 598
			messageview->msginfo = procmsg_msginfo_copy(msginfo);
599 599
	}
600
	procmime_mimeinfo_free_all(messageview->mimeinfo);
601
	messageview->mimeinfo = mimeinfo;
602
	g_free(messageview->file);
603
	messageview->file = file;
600 604

  
601 605
	if (messageview->window && msginfo->subject) {
602 606
		gchar *title;
......
619 623
	} else {
620 624
		messageview_change_view_type(messageview, MVIEW_TEXT);
621 625
		textview_show_message(messageview->textview, mimeinfo, file);
622
		procmime_mimeinfo_free_all(mimeinfo);
623 626
	}
624 627

  
625 628
	if (messageview->new_window)
......
628 631
	syl_plugin_signal_emit("messageview-show", messageview, msginfo,
629 632
			       all_headers);
630 633

  
631
	g_free(file);
632

  
633 634
	return 0;
634 635
}
635 636

  
......
780 781
void messageview_clear(MessageView *messageview)
781 782
{
782 783
	messageview_set_tool_menu(messageview, NULL);
784
	g_free(messageview->file);
785
	messageview->file = NULL;
786
	procmime_mimeinfo_free_all(messageview->mimeinfo);
787
	messageview->mimeinfo = NULL;
783 788
	procmsg_msginfo_free(messageview->msginfo);
784 789
	messageview->msginfo = NULL;
785 790
	messageview_change_view_type(messageview, MVIEW_TEXT);
src/messageview.h
74 74

  
75 75
	gboolean visible;
76 76
	gint current_page;
77

  
78
	MimeInfo *mimeinfo;
79
	gchar *file;
77 80
};
78 81

  
79 82
MessageView *messageview_create			(void);
src/mimeview.c
300 300

  
301 301
        debug_print("mimeview_is_signed: open\n" );
302 302

  
303
	if (!mimeview->file) return FALSE;
303
	if (!mimeview->messageview->file) return FALSE;
304 304

  
305 305
        debug_print("mimeview_is_signed: file\n" );
306 306

  
......
351 351
	g_return_if_fail(file != NULL);
352 352
	g_return_if_fail(mimeinfo != NULL);
353 353

  
354
	mimeview->mimeinfo = mimeinfo;
355

  
356
	mimeview->file = g_strdup(file);
357

  
358 354
#if USE_GPGME
359 355
	if (rfc2015_is_available() && prefs_common.auto_check_signatures) {
360 356
		FILE *fp;
......
410 406

  
411 407
void mimeview_clear(MimeView *mimeview)
412 408
{
413
	procmime_mimeinfo_free_all(mimeview->mimeinfo);
414
	mimeview->mimeinfo = NULL;
415 409
	mimeview->has_attach_file = FALSE;
416 410

  
417 411
	gtk_tree_store_clear(mimeview->store);
......
421 415
	gtk_tree_path_free(mimeview->opened);
422 416
	mimeview->opened = NULL;
423 417

  
424
	g_free(mimeview->file);
425
	mimeview->file = NULL;
426

  
427 418
	g_free(mimeview->drag_file);
428 419
	mimeview->drag_file = NULL;
429 420
}
......
432 423
{
433 424
	textview_destroy(mimeview->textview);
434 425
	imageview_destroy(mimeview->imageview);
435
	procmime_mimeinfo_free_all(mimeview->mimeinfo);
436 426
	g_object_unref(mimeview->popupfactory);
437
	g_free(mimeview->file);
438 427
	g_free(mimeview->drag_file);
439 428
	g_free(mimeview);
440 429
}
......
557 546

  
558 547
	if (!partinfo) return;
559 548

  
560
	fname = mimeview->file;
549
	fname = mimeview->messageview->file;
561 550
	if (!fname) return;
562 551

  
563 552
	if ((fp = g_fopen(fname, "rb")) == NULL) {
......
566 555
	}
567 556

  
568 557
	if (fseek(fp, partinfo->fpos, SEEK_SET) < 0) {
569
		FILE_OP_ERROR(mimeview->file, "fseek");
558
		FILE_OP_ERROR(fname, "fseek");
570 559
		fclose(fp);
571 560
		return;
572 561
	}
......
585 574

  
586 575
	filename = procmime_get_tmp_file_name(partinfo);
587 576

  
588
	if (procmime_get_part(filename, mimeview->file, partinfo) < 0)
577
	if (procmime_get_part(filename, mimeview->messageview->file, partinfo) < 0)
589 578
		alertpanel_error
590 579
			(_("Can't get the part of multipart message."));
591 580
	else {
......
1003 992
	MimeInfo *partinfo;
1004 993

  
1005 994
	if (!mimeview->opened) return;
1006
	if (!mimeview->file) return;
995
	if (!mimeview->messageview->file) return;
1007 996

  
1008 997
	partinfo = mimeview_get_selected_part(mimeview);
1009 998
	if (!partinfo) return;
......
1022 1011
		filename = g_strconcat(get_mime_tmp_dir(), G_DIR_SEPARATOR_S,
1023 1012
				       bname, NULL);
1024 1013

  
1025
	if (procmime_get_part(filename, mimeview->file, partinfo) < 0) {
1014
	if (procmime_get_part(filename, mimeview->messageview->file, partinfo) < 0) {
1026 1015
		g_warning(_("Can't save the part of multipart message."));
1027 1016
	} else
1028 1017
		mimeview->drag_file = encode_uri(filename);
......
1071 1060
	MimeInfo *partinfo;
1072 1061

  
1073 1062
	if (!mimeview->opened) return;
1074
	if (!mimeview->file) return;
1063
	if (!mimeview->messageview->file) return;
1075 1064

  
1076 1065
	partinfo = mimeview_get_selected_part(mimeview);
1077 1066
	g_return_if_fail(partinfo != NULL);
......
1086 1075
	dir = filesel_select_dir(NULL);
1087 1076
	if (!dir) return;
1088 1077

  
1089
	if (procmime_get_all_parts(dir, mimeview->file, mimeview->mimeinfo) < 0)
1078
	if (procmime_get_all_parts(dir, mimeview->messageview->file, mimeview->messageview->mimeinfo) < 0)
1090 1079
		alertpanel_error(_("Can't save the attachments."));
1091 1080

  
1092 1081
	g_free(dir);
......
1097 1086
	MimeInfo *partinfo;
1098 1087

  
1099 1088
	if (!mimeview->opened) return;
1100
	if (!mimeview->file) return;
1089
	if (!mimeview->messageview->file) return;
1101 1090

  
1102 1091
	partinfo = mimeview_get_selected_part(mimeview);
1103 1092
	g_return_if_fail(partinfo != NULL);
......
1109 1098
{
1110 1099
	g_return_if_fail(partinfo != NULL);
1111 1100

  
1112
	if (!mimeview->file) return;
1101
	if (!mimeview->messageview->file) return;
1113 1102

  
1114 1103
	if (partinfo->mime_type == MIME_MESSAGE_RFC822) {
1115 1104
		gchar *filename;
......
1117 1106
		MsgFlags flags = {0, 0};
1118 1107

  
1119 1108
		filename = procmime_get_tmp_file_name(partinfo);
1120
		if (procmime_get_part(filename, mimeview->file, partinfo) < 0) {
1109
		if (procmime_get_part(filename, mimeview->messageview->file, partinfo) < 0) {
1121 1110
			alertpanel_error
1122 1111
				(_("Can't save the part of multipart message."));
1123 1112
			g_free(filename);
......
1143 1132

  
1144 1133
	g_return_if_fail(partinfo != NULL);
1145 1134

  
1146
	if (!mimeview->file) return;
1135
	if (!mimeview->messageview->file) return;
1147 1136

  
1148 1137
	filename = procmime_get_tmp_file_name(partinfo);
1149 1138

  
1150
	if (procmime_get_part(filename, mimeview->file, partinfo) < 0)
1139
	if (procmime_get_part(filename, mimeview->messageview->file, partinfo) < 0)
1151 1140
		alertpanel_error
1152 1141
			(_("Can't save the part of multipart message."));
1153 1142
	else
......
1163 1152

  
1164 1153
	g_return_if_fail(partinfo != NULL);
1165 1154

  
1166
	if (!mimeview->file) return;
1155
	if (!mimeview->messageview->file) return;
1167 1156

  
1168 1157
	filename = procmime_get_tmp_file_name(partinfo);
1169 1158

  
1170
	if (procmime_get_part(filename, mimeview->file, partinfo) < 0) {
1159
	if (procmime_get_part(filename, mimeview->messageview->file, partinfo) < 0) {
1171 1160
		alertpanel_error
1172 1161
			(_("Can't save the part of multipart message."));
1173 1162
		g_free(filename);
......
1202 1191

  
1203 1192
	g_return_if_fail(partinfo != NULL);
1204 1193

  
1205
	if (!mimeview->file) return;
1194
	if (!mimeview->messageview->file) return;
1206 1195

  
1207 1196
	if (partinfo->filename) {
1208 1197
		filename = filesel_save_as(partinfo->filename);
......
1216 1205
	} else
1217 1206
		filename = filesel_save_as(NULL);
1218 1207

  
1219
	if (!filename) return;
1208
	if (!filename)
1209
		return;
1220 1210

  
1221
	if (procmime_get_part(filename, mimeview->file, partinfo) < 0)
1211
	if (procmime_get_part(filename, mimeview->messageview->file, partinfo) < 0)
1222 1212
		alertpanel_error
1223 1213
			(_("Can't save the part of multipart message."));
1224 1214

  
......
1230 1220
	MimeInfo *partinfo;
1231 1221

  
1232 1222
	if (!mimeview->opened) return;
1233
	if (!mimeview->file) return;
1223
	if (!mimeview->messageview->file) return;
1234 1224

  
1235 1225
	partinfo = mimeview_get_selected_part(mimeview);
1236 1226
	g_return_if_fail(partinfo != NULL);
......
1243 1233
	MimeInfo *partinfo;
1244 1234

  
1245 1235
	if (!mimeview->opened) return;
1246
	if (!mimeview->file) return;
1236
	if (!mimeview->messageview->file) return;
1247 1237

  
1248 1238
	partinfo = mimeview_get_selected_part(mimeview);
1249 1239
	g_return_if_fail(partinfo != NULL);
......
1336 1326
	ComposeMode mode = action;
1337 1327

  
1338 1328
	if (!mimeview->opened) return;
1339
	if (!mimeview->file) return;
1329
	if (!mimeview->messageview->file) return;
1340 1330

  
1341 1331
	partinfo = mimeview_get_selected_part(mimeview);
1342 1332
	g_return_if_fail(partinfo != NULL);
......
1345 1335
		return;
1346 1336

  
1347 1337
	filename = procmime_get_tmp_file_name(partinfo);
1348
	if (procmime_get_part(filename, mimeview->file, partinfo) < 0) {
1338
	if (procmime_get_part(filename, mimeview->messageview->file, partinfo) < 0) {
1349 1339
		alertpanel_error
1350 1340
			(_("Can't save the part of multipart message."));
1351 1341
			g_free(filename);
......
1419 1409

  
1420 1410
	mimeinfo = mimeview_get_selected_part(mimeview);
1421 1411
	g_return_if_fail(mimeinfo != NULL);
1422
	g_return_if_fail(mimeview->file != NULL);
1412
	g_return_if_fail(mimeview->messageview->file != NULL);
1423 1413

  
1424 1414
	while (mimeinfo->parent)
1425 1415
		mimeinfo = mimeinfo->parent;
1426 1416

  
1427
	if ((fp = g_fopen(mimeview->file, "rb")) == NULL) {
1428
		FILE_OP_ERROR(mimeview->file, "fopen");
1417
	if ((fp = g_fopen(mimeview->messageview->file, "rb")) == NULL) {
1418
		FILE_OP_ERROR(mimeview->messageview->file, "fopen");
1429 1419
		return;
1430 1420
	}
1431 1421

  
......
1436 1426
	mimeview_update_signature_info(mimeview);
1437 1427

  
1438 1428
	textview_show_message(mimeview->messageview->textview, mimeinfo,
1439
			      mimeview->file);
1429
			      mimeview->messageview->file);
1440 1430
}
1441 1431
#endif /* USE_GPGME */
src/mimeview.h
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
......
66 66

  
67 67
	MessageView *messageview;
68 68

  
69
	MimeInfo *mimeinfo;
69
	/* deprecated: use MessageView */
70
	MimeInfo *mimeinfo__;
71
	gchar *file__;
70 72

  
71
	gchar *file;
72

  
73 73
	gchar *drag_file;
74 74

  
75 75
	gboolean has_attach_file;
ChangeLog
1
2013-05-14
2

  
3
	* src/messageview.[ch]
4
	  src/mimeview.[ch]: refactored: moved MimeInfo and file path member
5
	  from MimeInfo to MessageView so that it can be used from TextView.
6

  
7
2013-05-14
8

  
9
	* libsylph/prefs_common.[ch]
10
	  src/prefs_common_dialog.c
11
	  src/textview.c: added an option to prefer HTML part in
12
	  multipart/alternative.
13

  
14
2013-05-14
15

  
16
	* libsylph/html.[ch]: supported <blockquote> tag.
17

  
1 18
2013-04-05
2 19

  
3 20
	* libsylph/procmsg.c: procmsg_print_message(): print all texts in

Also available in: Unified diff