Revision 3254 src/mimeview.c

View differences:

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 */

Also available in: Unified diff