diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2013-04-04 01:45:15 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2013-04-04 01:45:15 +0000 |
commit | 0fdf78ead1e0d34df889a4c0edd6e453b4ad0ef0 (patch) | |
tree | c157c6bf0cbcf1750465160d315a694ec7fd18cb /src | |
parent | 541afd326f6bd4f0a130e9fdce9a82b7350d37dc (diff) |
messageview_save_as(): added the feature to save message as plain text.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@3246 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src')
-rw-r--r-- | src/messageview.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/src/messageview.c b/src/messageview.c index 07496b6c..8112dbf0 100644 --- a/src/messageview.c +++ b/src/messageview.c @@ -908,6 +908,10 @@ void messageview_save_as(MessageView *messageview) gchar *filename = NULL; MsgInfo *msginfo; gchar *src, *dest; + GSList *types; + gint selected_type = 0; + gint result; + gboolean all_headers; if (!messageview->msginfo) return; msginfo = messageview->msginfo; @@ -919,14 +923,29 @@ void messageview_save_as(MessageView *messageview) } subst_for_filename(filename); - dest = filesel_save_as(filename); + types = g_slist_append(NULL, _("Original (EML/RFC 822)")); + types = g_slist_append(types, _("Text")); + types = g_slist_append(types, _("Text (UTF-8)")); + dest = filesel_save_as_type(filename, types, 0, &selected_type); + g_slist_free(types); g_free(filename); if (!dest) return; - src = procmsg_get_message_file(msginfo); - if (copy_file(src, dest, TRUE) < 0) { + all_headers = messageview->textview->show_all_headers; + + if (selected_type == 1) { + result = procmsg_save_message_as_text(msginfo, dest, conv_get_locale_charset_str(), all_headers); + } else if (selected_type == 2) { + result = procmsg_save_message_as_text(msginfo, dest, NULL, all_headers); + } else { + src = procmsg_get_message_file(msginfo); + result = copy_file(src, dest, TRUE); + g_free(src); + } + + if (result < 0) { gchar *utf8_dest; utf8_dest = conv_filename_to_utf8(dest); @@ -934,7 +953,6 @@ void messageview_save_as(MessageView *messageview) g_basename(utf8_dest)); g_free(utf8_dest); } - g_free(src); g_free(dest); } |