Files
main/network/mail/sylpheed/files/add-xdg-support.patch
T
2017-01-28 14:53:14 +01:00

82 lines
2.2 KiB
Diff

Index: sylpheed-3.1.1/libsylph/procmime.c
===================================================================
--- sylpheed-3.1.1.orig/libsylph/procmime.c
+++ sylpheed-3.1.1/libsylph/procmime.c
@@ -1685,74 +1685,13 @@ static GList *procmime_parse_mailcap(con
gint procmime_execute_open_file(const gchar *file, const gchar *mime_type)
{
- gchar *mime_type_ = NULL;
- GList *cur;
- MailCap *mailcap;
gchar *cmdline;
gint ret = -1;
- static gboolean mailcap_list_init = FALSE;
g_return_val_if_fail(file != NULL, -1);
- if (!mime_type ||
- g_ascii_strcasecmp(mime_type, "application/octet-stream") == 0) {
- gchar *tmp;
- tmp = procmime_get_mime_type(file);
- if (!tmp)
- return -1;
- mime_type_ = g_ascii_strdown(tmp, -1);
- g_free(tmp);
- } else
- mime_type_ = g_ascii_strdown(mime_type, -1);
-
- 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
- if (!mailcap_list) {
- path = g_strconcat(get_home_dir(), G_DIR_SEPARATOR_S,
- ".mailcap", NULL);
- mailcap_list = procmime_parse_mailcap(path);
- g_free(path);
- }
- 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;
-
- if (!g_pattern_match_simple(mailcap->mime_type, mime_type_))
- continue;
- if (mailcap->needs_terminal)
- continue;
-
- if (str_find_format_times(mailcap->cmdline_fmt, 's') == 1)
- cmdline = g_strdup_printf(mailcap->cmdline_fmt, file);
- else
- cmdline = g_strconcat(mailcap->cmdline_fmt, " \"", file,
- "\"", NULL);
- ret = execute_command_line(cmdline, TRUE);
- g_free(cmdline);
- break;
- }
-
- g_free(mime_type_);
+ cmdline = g_strdup_printf("/usr/bin/xdg-open '%s'", file);
+ ret = execute_command_line(cmdline, TRUE);
return ret;
}