[tracker-miners/wip/carlosg/speed-track: 10/22] libtracker-miner: Pass GFileInfo onto crawler check func
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker-miners/wip/carlosg/speed-track: 10/22] libtracker-miner: Pass GFileInfo onto crawler check func
- Date: Thu, 22 Oct 2020 14:45:56 +0000 (UTC)
commit bf5be2ec306e00692f0ece3ca6b5e19ef31426fe
Author: Carlos Garnacho <carlosg gnome org>
Date: Sat Oct 17 11:50:06 2020 +0200
libtracker-miner: Pass GFileInfo onto crawler check func
We already have a GFileInfo for the inspected file from the crawler,
push this forward so it can be used on file checks.
src/libtracker-miner/tracker-crawler.c | 19 +++++++++++++++----
src/libtracker-miner/tracker-crawler.h | 1 +
src/libtracker-miner/tracker-file-notifier.c | 1 +
tests/libtracker-miner/tracker-crawler-test.c | 1 +
4 files changed, 18 insertions(+), 4 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-crawler.c b/src/libtracker-miner/tracker-crawler.c
index d4cff0ac4..26b2d3f54 100644
--- a/src/libtracker-miner/tracker-crawler.c
+++ b/src/libtracker-miner/tracker-crawler.c
@@ -262,6 +262,7 @@ static gboolean
invoke_check (TrackerCrawler *crawler,
TrackerCrawlerCheckFlags flags,
GFile *file,
+ GFileInfo *file_info,
GList *children)
{
TrackerCrawlerPrivate *priv;
@@ -271,7 +272,8 @@ invoke_check (TrackerCrawler *crawler,
if (!priv->check_func)
return TRUE;
- return priv->check_func (crawler, flags, file, children,
+ return priv->check_func (crawler, flags,
+ file, file_info, children,
priv->check_func_data);
}
@@ -280,9 +282,12 @@ check_file (TrackerCrawler *crawler,
DirectoryRootInfo *info,
GFile *file)
{
+ GFileInfo *file_info;
gboolean use = FALSE;
- use = invoke_check (crawler, TRACKER_CRAWLER_CHECK_FILE, file, NULL);
+ file_info = g_object_get_qdata (G_OBJECT (file), file_info_quark);
+ use = invoke_check (crawler, TRACKER_CRAWLER_CHECK_FILE,
+ file, file_info, NULL);
info->files_found++;
@@ -298,9 +303,12 @@ check_directory (TrackerCrawler *crawler,
DirectoryRootInfo *info,
GFile *file)
{
+ GFileInfo *file_info;
gboolean use = FALSE;
- use = invoke_check (crawler, TRACKER_CRAWLER_CHECK_DIRECTORY, file, NULL);
+ file_info = g_object_get_qdata (G_OBJECT (file), file_info_quark);
+ use = invoke_check (crawler, TRACKER_CRAWLER_CHECK_DIRECTORY,
+ file, file_info, NULL);
info->directories_found++;
@@ -599,6 +607,7 @@ data_provider_data_process (DataProviderData *dpd)
TrackerCrawler *crawler;
GSList *l;
GList *children = NULL;
+ GFileInfo *file_info;
gboolean use;
crawler = dpd->crawler;
@@ -610,7 +619,9 @@ data_provider_data_process (DataProviderData *dpd)
children = g_list_prepend (children, child_data->child);
}
- use = invoke_check (crawler, TRACKER_CRAWLER_CHECK_CONTENT, dpd->dir_file, children);
+ file_info = g_object_get_qdata (G_OBJECT (dpd->dir_file), file_info_quark);
+ use = invoke_check (crawler, TRACKER_CRAWLER_CHECK_CONTENT,
+ dpd->dir_file, file_info, children);
g_list_free (children);
if (!use) {
diff --git a/src/libtracker-miner/tracker-crawler.h b/src/libtracker-miner/tracker-crawler.h
index d0a6fe09e..a39ea63b1 100644
--- a/src/libtracker-miner/tracker-crawler.h
+++ b/src/libtracker-miner/tracker-crawler.h
@@ -54,6 +54,7 @@ typedef enum {
typedef gboolean (*TrackerCrawlerCheckFunc) (TrackerCrawler *crawler,
TrackerCrawlerCheckFlags flags,
GFile *file,
+ GFileInfo *file_info,
const GList *children,
gpointer user_data);
diff --git a/src/libtracker-miner/tracker-file-notifier.c b/src/libtracker-miner/tracker-file-notifier.c
index 1fd3710a9..184acd1c2 100644
--- a/src/libtracker-miner/tracker-file-notifier.c
+++ b/src/libtracker-miner/tracker-file-notifier.c
@@ -1377,6 +1377,7 @@ static gboolean
crawler_check_func (TrackerCrawler *crawler,
TrackerCrawlerCheckFlags flags,
GFile *file,
+ GFileInfo *file_info,
const GList *children,
gpointer user_data)
{
diff --git a/tests/libtracker-miner/tracker-crawler-test.c b/tests/libtracker-miner/tracker-crawler-test.c
index 28eac432f..9ab89d561 100644
--- a/tests/libtracker-miner/tracker-crawler-test.c
+++ b/tests/libtracker-miner/tracker-crawler-test.c
@@ -78,6 +78,7 @@ static gboolean
check_func (TrackerCrawler *crawler,
TrackerCrawlerCheckFlags flags,
GFile *file,
+ GFileInfo *file_info,
const GList *children,
gpointer user_data)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]