diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2006-12-07 04:01:38 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2006-12-07 04:01:38 +0000 |
commit | b4741da89216ec4b07e3561bbebe0f28133c3068 (patch) | |
tree | 2a60aa6d2d8325cb39cd804f8eb505c6730bc318 /src/textview.c | |
parent | 2515f7f6cf2eeb78ac384c69001cd1be1e45a659 (diff) |
give the priority to the separated message view's encoding setting on display and on reply.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@1399 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src/textview.c')
-rw-r--r-- | src/textview.c | 54 |
1 files changed, 26 insertions, 28 deletions
diff --git a/src/textview.c b/src/textview.c index 6ba4a262..d6b2e269 100644 --- a/src/textview.c +++ b/src/textview.c @@ -437,6 +437,26 @@ void textview_reflect_prefs(TextView *textview) prefs_common.textview_cursor_visible); } +static const gchar *textview_get_src_encoding(TextView *textview, + MimeInfo *mimeinfo) +{ + const gchar *charset; + + if (textview->messageview->forced_charset) + charset = textview->messageview->forced_charset; + else if (!textview->messageview->new_window && + prefs_common.force_charset) + charset = prefs_common.force_charset; + else if (mimeinfo->charset) + charset = mimeinfo->charset; + else if (prefs_common.default_encoding) + charset = prefs_common.default_encoding; + else + charset = NULL; + + return charset; +} + void textview_show_message(TextView *textview, MimeInfo *mimeinfo, const gchar *file) { @@ -445,7 +465,7 @@ void textview_show_message(TextView *textview, MimeInfo *mimeinfo, GtkTextMark *mark; GtkTextIter iter; FILE *fp; - const gchar *charset = NULL; + const gchar *charset; GPtrArray *headers = NULL; buffer = gtk_text_view_get_buffer(text); @@ -455,15 +475,7 @@ void textview_show_message(TextView *textview, MimeInfo *mimeinfo, return; } - if (textview->messageview->forced_charset) - charset = textview->messageview->forced_charset; - else if (prefs_common.force_charset) - charset = prefs_common.force_charset; - else if (mimeinfo->charset) - charset = mimeinfo->charset; - else if (prefs_common.default_encoding) - charset = prefs_common.default_encoding; - + charset = textview_get_src_encoding(textview, mimeinfo); textview_set_font(textview, charset); textview_clear(textview); @@ -496,7 +508,7 @@ void textview_show_part(TextView *textview, MimeInfo *mimeinfo, FILE *fp) gchar buf[BUFFSIZE]; const gchar *boundary = NULL; gint boundary_len = 0; - const gchar *charset = NULL; + const gchar *charset; GPtrArray *headers = NULL; gboolean is_rfc822_part = FALSE; GtkTextView *text = GTK_TEXT_VIEW(textview->text); @@ -518,14 +530,7 @@ void textview_show_part(TextView *textview, MimeInfo *mimeinfo, FILE *fp) boundary_len = strlen(boundary); } - if (textview->messageview->forced_charset) - charset = textview->messageview->forced_charset; - else if (prefs_common.force_charset) - charset = prefs_common.force_charset; - else if (mimeinfo->charset) - charset = mimeinfo->charset; - else if (prefs_common.default_encoding) - charset = prefs_common.default_encoding; + charset = textview_get_src_encoding(textview, mimeinfo); if (!boundary && mimeinfo->mime_type == MIME_TEXT) { if (fseek(fp, mimeinfo->fpos, SEEK_SET) < 0) @@ -605,7 +610,7 @@ static void textview_add_part(TextView *textview, MimeInfo *mimeinfo, FILE *fp) gchar buf[BUFFSIZE]; const gchar *boundary = NULL; gint boundary_len = 0; - const gchar *charset = NULL; + const gchar *charset; GPtrArray *headers = NULL; g_return_if_fail(mimeinfo != NULL); @@ -629,14 +634,7 @@ static void textview_add_part(TextView *textview, MimeInfo *mimeinfo, FILE *fp) while (fgets(buf, sizeof(buf), fp) != NULL) if (buf[0] == '\r' || buf[0] == '\n') break; - if (textview->messageview->forced_charset) - charset = textview->messageview->forced_charset; - else if (prefs_common.force_charset) - charset = prefs_common.force_charset; - else if (mimeinfo->charset) - charset = mimeinfo->charset; - else if (prefs_common.default_encoding) - charset = prefs_common.default_encoding; + charset = textview_get_src_encoding(textview, mimeinfo); if (mimeinfo->mime_type == MIME_MESSAGE_RFC822) { headers = textview_scan_header(textview, fp, charset); |