diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2006-03-08 06:08:05 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2006-03-08 06:08:05 +0000 |
commit | d99f89edc0e85e7b1f9319cd0dd64c5e64e8e37a (patch) | |
tree | 41d82b17c6457e4d55eb757a2c7bf0796cdf52af /libsylph | |
parent | f11888bfed0c495fc2c492e929bcfc122d9c71cb (diff) |
read mailcap file other than standard location.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@1033 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'libsylph')
-rw-r--r-- | libsylph/procmime.c | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/libsylph/procmime.c b/libsylph/procmime.c index 31089455..0f9ab39f 100644 --- a/libsylph/procmime.c +++ b/libsylph/procmime.c @@ -1102,10 +1102,9 @@ static GHashTable *procmime_get_mime_type_table(void) #else mime_type_list = procmime_get_mime_type_list(SYSCONFDIR "/mime.types"); - if (!mime_type_list) { - list = procmime_get_mime_type_list("/etc/mime.types"); - mime_type_list = g_list_concat(mime_type_list, list); - } + if (!mime_type_list) + mime_type_list = + procmime_get_mime_type_list("/etc/mime.types"); #endif dir = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, "mime.types", NULL); @@ -1253,6 +1252,7 @@ gint procmime_execute_open_file(const gchar *file, const gchar *mime_type) MailCap *mailcap; gchar *cmdline, *p; gint ret = -1; + static gboolean mailcap_list_init = FALSE; g_return_val_if_fail(file != NULL, -1); @@ -1267,8 +1267,28 @@ gint procmime_execute_open_file(const gchar *file, const gchar *mime_type) } else mime_type_ = g_ascii_strdown(mime_type, -1); - if (!mailcap_list) - mailcap_list = procmime_parse_mailcap("/etc/mailcap"); + if (!mailcap_list_init && !mailcap_list) { + GList *list; + gchar *path; + + path = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, "mailcap", + NULL); + mailcap_list = procmime_parse_mailcap(path); + g_free(path); +#ifdef G_OS_WIN32 + path = g_strconcat(get_startup_dir(), G_DIR_SEPARATOR_S "etc" + G_DIR_SEPARATOR_S "mailcap", NULL); + list = procmime_parse_mailcap(path); + g_free(path); +#else + list = procmime_parse_mailcap(SYSCONFDIR "/mailcap"); + if (!list) + list = procmime_parse_mailcap("/etc/mailcap"); +#endif + mailcap_list = g_list_concat(mailcap_list, list); + + mailcap_list_init = TRUE; + } for (cur = mailcap_list; cur != NULL; cur = cur->next) { mailcap = (MailCap *)cur->data; |