summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndrej Holy <oholy@redhat.com>2023-03-08 15:27:24 +0100
committerOndrej Holy <oholy@redhat.com>2023-03-29 13:49:46 +0000
commitcbd4c1d95e7f8ef7847c39fd28c66fbbaa25f941 (patch)
tree4a9c427dc95111b896b77600880f5b1595111e61
parentfa27862d0c5f5d641a52f0b83812ac3d08c1cc7b (diff)
downloadnautilus-cbd4c1d95e7f8ef7847c39fd28c66fbbaa25f941.tar.gz
Add fast-content-type fallback to all places
The `G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE` attribute doesn't have to be always set. The commit 0e597803 added the `G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE` fallback inside the `NautilusFile` class, but not for other places. Let's fix this oversight. Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2862
-rw-r--r--src/nautilus-directory-async.c15
-rw-r--r--src/nautilus-search-engine-simple.c9
2 files changed, 22 insertions, 2 deletions
diff --git a/src/nautilus-directory-async.c b/src/nautilus-directory-async.c
index 7436a6949..c3738565a 100644
--- a/src/nautilus-directory-async.c
+++ b/src/nautilus-directory-async.c
@@ -1008,6 +1008,12 @@ dequeue_pending_idle_callback (gpointer callback_data)
/* Add the MIME type to the set. */
mimetype = g_file_info_get_attribute_string (file_info,
G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE);
+ if (mimetype == NULL)
+ {
+ mimetype = g_file_info_get_attribute_string (file_info,
+ G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE);
+ }
+
if (mimetype != NULL)
{
istr_set_insert (dir_load_state->load_mime_list_hash,
@@ -3266,6 +3272,12 @@ mime_list_one (MimeListState *state,
mime_type = g_file_info_get_attribute_string (info,
G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE);
+ if (mime_type == NULL)
+ {
+ mime_type = g_file_info_get_attribute_string (info,
+ G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE);
+ }
+
if (mime_type != NULL)
{
istr_set_insert (state->mime_list_hash, mime_type);
@@ -3444,7 +3456,8 @@ mime_list_start (NautilusDirectory *directory,
}
g_file_enumerate_children_async (location,
- G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
+ G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE ","
+ G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE,
0, /* flags */
G_PRIORITY_LOW, /* prio */
state->cancellable,
diff --git a/src/nautilus-search-engine-simple.c b/src/nautilus-search-engine-simple.c
index 41c567c4b..bdfa5195d 100644
--- a/src/nautilus-search-engine-simple.c
+++ b/src/nautilus-search-engine-simple.c
@@ -302,7 +302,8 @@ visit_directory (GFile *dir,
enumerator = g_file_enumerate_children (dir,
data->mime_types->len > 0 ?
STD_ATTRIBUTES ","
- G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE
+ G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE ","
+ G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE
:
STD_ATTRIBUTES
,
@@ -347,6 +348,12 @@ visit_directory (GFile *dir,
{
mime_type = g_file_info_get_attribute_string (info,
G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE);
+ if (mime_type == NULL)
+ {
+ mime_type = g_file_info_get_attribute_string (info,
+ G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE);
+ }
+
found = FALSE;
for (gint i = 0; mime_type != NULL && i < data->mime_types->len; i++)