add-xdg-support.patch 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. Index: sylpheed-3.1.1/libsylph/procmime.c
  2. ===================================================================
  3. --- sylpheed-3.1.1.orig/libsylph/procmime.c
  4. +++ sylpheed-3.1.1/libsylph/procmime.c
  5. @@ -1685,74 +1685,13 @@ static GList *procmime_parse_mailcap(con
  6. gint procmime_execute_open_file(const gchar *file, const gchar *mime_type)
  7. {
  8. - gchar *mime_type_ = NULL;
  9. - GList *cur;
  10. - MailCap *mailcap;
  11. gchar *cmdline;
  12. gint ret = -1;
  13. - static gboolean mailcap_list_init = FALSE;
  14. g_return_val_if_fail(file != NULL, -1);
  15. - if (!mime_type ||
  16. - g_ascii_strcasecmp(mime_type, "application/octet-stream") == 0) {
  17. - gchar *tmp;
  18. - tmp = procmime_get_mime_type(file);
  19. - if (!tmp)
  20. - return -1;
  21. - mime_type_ = g_ascii_strdown(tmp, -1);
  22. - g_free(tmp);
  23. - } else
  24. - mime_type_ = g_ascii_strdown(mime_type, -1);
  25. -
  26. - if (!mailcap_list_init && !mailcap_list) {
  27. - GList *list;
  28. - gchar *path;
  29. -
  30. - path = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, "mailcap",
  31. - NULL);
  32. - mailcap_list = procmime_parse_mailcap(path);
  33. - g_free(path);
  34. -#ifdef G_OS_WIN32
  35. - path = g_strconcat(get_startup_dir(), G_DIR_SEPARATOR_S "etc"
  36. - G_DIR_SEPARATOR_S "mailcap", NULL);
  37. - list = procmime_parse_mailcap(path);
  38. - g_free(path);
  39. -#else
  40. - if (!mailcap_list) {
  41. - path = g_strconcat(get_home_dir(), G_DIR_SEPARATOR_S,
  42. - ".mailcap", NULL);
  43. - mailcap_list = procmime_parse_mailcap(path);
  44. - g_free(path);
  45. - }
  46. - list = procmime_parse_mailcap(SYSCONFDIR "/mailcap");
  47. - if (!list)
  48. - list = procmime_parse_mailcap("/etc/mailcap");
  49. -#endif
  50. - mailcap_list = g_list_concat(mailcap_list, list);
  51. -
  52. - mailcap_list_init = TRUE;
  53. - }
  54. -
  55. - for (cur = mailcap_list; cur != NULL; cur = cur->next) {
  56. - mailcap = (MailCap *)cur->data;
  57. -
  58. - if (!g_pattern_match_simple(mailcap->mime_type, mime_type_))
  59. - continue;
  60. - if (mailcap->needs_terminal)
  61. - continue;
  62. -
  63. - if (str_find_format_times(mailcap->cmdline_fmt, 's') == 1)
  64. - cmdline = g_strdup_printf(mailcap->cmdline_fmt, file);
  65. - else
  66. - cmdline = g_strconcat(mailcap->cmdline_fmt, " \"", file,
  67. - "\"", NULL);
  68. - ret = execute_command_line(cmdline, TRUE);
  69. - g_free(cmdline);
  70. - break;
  71. - }
  72. -
  73. - g_free(mime_type_);
  74. + cmdline = g_strdup_printf("/usr/bin/xdg-open '%s'", file);
  75. + ret = execute_command_line(cmdline, TRUE);
  76. return ret;
  77. }