diff options
author | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2018-10-24 13:38:37 +0200 |
---|---|---|
committer | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2018-11-27 15:24:57 -0500 |
commit | e076ab0bd174635bfb785e129cfc92744f63dacb (patch) | |
tree | a5bb0d5f25c68f7aa5dcc8878dd917b1265f09bc /src/nautilus-search-engine-recent.c | |
parent | 9ea71a9a4231faa705fe3249cccfbdc80a94f73e (diff) | |
download | nautilus-e076ab0bd174635bfb785e129cfc92744f63dacb.tar.gz |
search-engine-recent: only do IO operations if name comparision matches
Avoid to do more expensive IO operations on a file if its name does not
matches the query. Those computations are quicker than IO ops, thus
better to delay them.
Diffstat (limited to 'src/nautilus-search-engine-recent.c')
-rw-r--r-- | src/nautilus-search-engine-recent.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/src/nautilus-search-engine-recent.c b/src/nautilus-search-engine-recent.c index 3e4be37d2..2810b5575 100644 --- a/src/nautilus-search-engine-recent.c +++ b/src/nautilus-search-engine-recent.c @@ -213,28 +213,6 @@ recent_thread_func (gpointer user_data) continue; } - if (gtk_recent_info_is_local (info)) - { - g_autoptr (GError) error = NULL; - - if (!is_file_valid_recursive (self, file, &error)) - { - if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) - { - break; - } - - if (error != NULL && - !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_EXISTS)) - { - g_debug("Impossible to read recent file info: %s", - error->message); - } - - continue; - } - } - if (g_cancellable_is_cancelled (self->cancellable)) { break; @@ -256,6 +234,28 @@ recent_thread_func (gpointer user_data) g_autoptr (GDateTime) gmodified = NULL; g_autoptr (GDateTime) gvisited = NULL; + if (gtk_recent_info_is_local (info)) + { + g_autoptr (GError) error = NULL; + + if (!is_file_valid_recursive (self, file, &error)) + { + if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) + { + break; + } + + if (error != NULL && + !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_EXISTS)) + { + g_debug ("Impossible to read recent file info: %s", + error->message); + } + + continue; + } + } + if (mime_types) { GList *ml; |