From 1d409e35d068fa4cc01e7538582aed946d8d85d9 Mon Sep 17 00:00:00 2001 From: Alexander Schwinn Date: Sun, 8 Sep 2019 19:11:12 +0200 Subject: [PATCH] Use copy of TSE_MIME_TYPES and tse_is_archive(thunar-sendto-email plugin) to detect supported archive types. This adds support for brotli and zstd formats. (Bug #15918) --- thunar-archive-plugin/tap-provider.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/thunar-archive-plugin/tap-provider.c b/thunar-archive-plugin/tap-provider.c index ac90e7f..f2a791f 100644 --- a/thunar-archive-plugin/tap-provider.c +++ b/thunar-archive-plugin/tap-provider.c @@ -92,11 +92,13 @@ struct _TapProvider -static const gchar TAP_MIME_TYPES[][34] = { +static const char *TAP_MIME_TYPES[] = { "application/x-7z-compressed", "application/x-7z-compressed-tar", "application/x-ar", "application/x-arj", + "application/x-brotli", + "application/x-brotli-compressed-tar", "application/x-bzip", "application/x-bzip-compressed-tar", "application/x-compress", @@ -123,7 +125,8 @@ static const gchar TAP_MIME_TYPES[][34] = { "application/x-lzop", "application/x-zoo", "application/x-cd-image", - "application/x-7z-compressed", + "application/zstd", + "application/x-zstd-compressed-tar", }; static GQuark tap_item_files_quark; @@ -195,12 +198,23 @@ tap_provider_finalize (GObject *object) static gboolean tap_is_archive (ThunarxFileInfo *file_info) { - guint n; - + const gchar *content_type; + guint n; + /* determine the content type */ + content_type = thunarx_file_info_get_mime_type (file_info); + if (content_type == NULL) + { + return FALSE; + } for (n = 0; n < G_N_ELEMENTS (TAP_MIME_TYPES); ++n) - if (thunarx_file_info_has_mime_type (file_info, TAP_MIME_TYPES[n])) + { + /* check if this mime type matches */ + if (g_content_type_is_a (content_type, TAP_MIME_TYPES[n])) + { + /* yep, that's a match then */ return TRUE; - + } + } return FALSE; } -- 2.20.1