Commit 9487ced5 authored by Carlos Garnacho's avatar Carlos Garnacho

libtracker-miner: Avoid extra file queries to find hidden files

Delegate this (for the most part) on TrackerCrawler, as it is already
in the business of fetching GFileInfos for inspected files. This avoids
one extra stat() per folder.
parent e8c5aecc
......@@ -27,7 +27,8 @@
#define FILE_ATTRIBUTES \
G_FILE_ATTRIBUTE_STANDARD_NAME "," \
G_FILE_ATTRIBUTE_STANDARD_TYPE
G_FILE_ATTRIBUTE_STANDARD_TYPE "," \
G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN
#define FILES_QUEUE_PROCESS_INTERVAL 2000
#define FILES_QUEUE_PROCESS_MAX 5000
......
......@@ -845,11 +845,16 @@ create_shallow_file_info (GFile *file,
gboolean is_directory)
{
GFileInfo *file_info;
gchar *basename;
file_info = g_file_info_new ();
g_file_info_set_file_type (file_info,
is_directory ?
G_FILE_TYPE_DIRECTORY : G_FILE_TYPE_REGULAR);
basename = g_file_get_basename (file);
g_file_info_set_is_hidden (file_info, basename[0] == '.');
g_free (basename);
return file_info;
}
......@@ -1283,7 +1288,8 @@ indexing_tree_child_updated (TrackerIndexingTree *indexing_tree,
priv = tracker_file_notifier_get_instance_private (notifier);
child_info = g_file_query_info (child,
G_FILE_ATTRIBUTE_STANDARD_TYPE,
G_FILE_ATTRIBUTE_STANDARD_TYPE ","
G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
NULL, NULL);
if (!child_info)
......
......@@ -892,7 +892,7 @@ tracker_indexing_tree_file_is_indexable (TrackerIndexingTree *tree,
}
if (tracker_indexing_tree_get_filter_hidden (tree) &&
tracker_file_is_hidden (file)) {
info && g_file_info_get_is_hidden (info)) {
return FALSE;
}
......
......@@ -596,7 +596,8 @@ check_eligible (void)
/* Start check */
file = g_file_new_for_commandline_arg (eligible);
info = g_file_query_info (file,
G_FILE_ATTRIBUTE_STANDARD_TYPE,
G_FILE_ATTRIBUTE_STANDARD_TYPE ","
G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN,
G_FILE_QUERY_INFO_NONE,
NULL,
&error);
......@@ -883,7 +884,8 @@ update_indexed_files_from_proxy (TrackerMinerFiles *miner,
}
file_info = g_file_query_info (file,
G_FILE_ATTRIBUTE_STANDARD_TYPE,
G_FILE_ATTRIBUTE_STANDARD_TYPE ","
G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
NULL, NULL);
......
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