mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-30 16:02:00 +02:00
clapper-app: Fix opened file content type detection
Fixes issues with detecting whether file has one of supported subtitles mime types
This commit is contained in:
@@ -86,9 +86,21 @@ clapper_app_utils_is_subtitles_file (GFile *file)
|
|||||||
G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE,
|
G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE,
|
||||||
G_FILE_QUERY_INFO_NONE,
|
G_FILE_QUERY_INFO_NONE,
|
||||||
NULL, NULL))) {
|
NULL, NULL))) {
|
||||||
is_subs = g_strv_contains (
|
const gchar *content_type = NULL;
|
||||||
|
|
||||||
|
if (g_file_info_has_attribute (info,
|
||||||
|
G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE)) {
|
||||||
|
content_type = g_file_info_get_content_type (info);
|
||||||
|
} else if (g_file_info_has_attribute (info,
|
||||||
|
G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE)) {
|
||||||
|
content_type = g_file_info_get_attribute_string (info,
|
||||||
|
G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE);
|
||||||
|
}
|
||||||
|
|
||||||
|
is_subs = (content_type && g_strv_contains (
|
||||||
clapper_app_utils_get_subtitles_mime_types (),
|
clapper_app_utils_get_subtitles_mime_types (),
|
||||||
g_file_info_get_content_type (info));
|
content_type));
|
||||||
|
|
||||||
g_object_unref (info);
|
g_object_unref (info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user