From f57b228500d5511f3985c6986a26d2aaa732d42c Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Thu, 15 Apr 2004 18:55:33 +0000 Subject: Same idea here as with build_mesage(), don't convert th gconf charset 2004-04-15 Jeffrey Stedfast * e-msg-composer-attachment-bar.c (attach_to_multipart): Same idea here as with build_mesage(), don't convert th gconf charset setting to the iconv name before setting it on the mime part. * e-msg-composer.c (best_charset): Now returns a malloc'd string bufefr containing the charset that has NOT been converted to the iconv name. This is important in order to avoid using the iconv charset name which may or may not necessarily be the IANA blessed name. (composer_get_default_charset_setting): Changed to always return the actual value in the settings (eg. don't return the iconv name). (build_message): Updated for changes to best_charset(). Set the actual charset name as the charset param and then get the iconv_charset from that. Use iconv_charset everywhere else. (get_file_content): Updated for changes to get_default_charset_setting(). (setup_ui): Same. svn path=/trunk/; revision=25487 --- composer/e-msg-composer-attachment-bar.c | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) (limited to 'composer/e-msg-composer-attachment-bar.c') diff --git a/composer/e-msg-composer-attachment-bar.c b/composer/e-msg-composer-attachment-bar.c index 5f035ec410..d2f0ff4d48 100644 --- a/composer/e-msg-composer-attachment-bar.c +++ b/composer/e-msg-composer-attachment-bar.c @@ -743,29 +743,31 @@ e_msg_composer_attachment_bar_new (GtkAdjustment *adj) return GTK_WIDGET (new); } -static const char * +static char * get_default_charset (void) { GConfClient *gconf; - const char *charset; - char *buf; + const char *locale; + char *charset; gconf = gconf_client_get_default (); - buf = gconf_client_get_string (gconf, "/apps/evolution/mail/composer/charset", NULL); - if (buf && buf[0] == '\0') { - g_free (buf); - buf = NULL; + charset = gconf_client_get_string (gconf, "/apps/evolution/mail/composer/charset", NULL); + + if (!charset || charset[0] == '\0') { + g_free (charset); + charset = gconf_client_get_string (gconf, "/apps/evolution/mail/format/charset", NULL); + if (charset && charset[0] == '\0') { + g_free (charset); + charset = NULL; + } } g_object_unref (gconf); - if (buf != NULL) { - charset = e_iconv_charset_name (buf); - g_free (buf); - } else - charset = e_iconv_locale_charset (); + if (!charset && (locale = e_iconv_locale_charset ())) + charset = g_strdup (locale); - return charset; + return charset ? charset : g_strdup ("us-ascii"); } static void @@ -786,6 +788,7 @@ attach_to_multipart (CamelMultipart *multipart, CamelMimeFilterBestenc *bestenc; CamelStream *stream; const char *charset; + char *buf = NULL; char *type; charset = camel_content_type_param (content_type, "charset"); @@ -808,7 +811,7 @@ attach_to_multipart (CamelMultipart *multipart, default_charset = "us-ascii"; } else if (!charset) { if (!default_charset) - default_charset = get_default_charset (); + default_charset = buf = get_default_charset (); /* FIXME: We should really check that this fits within the default_charset and if not find one that does and/or @@ -821,6 +824,7 @@ attach_to_multipart (CamelMultipart *multipart, type = camel_content_type_format (content_type); camel_mime_part_set_content_type (attachment->body, type); g_free (type); + g_free (buf); } camel_object_unref (bestenc); -- cgit v1.2.3