Commit e076ab0b authored by Marco Trevisan's avatar Marco Trevisan 🎺

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.
parent 9ea71a9a
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment