[tracker-miners/wip/carlosg/speed-track: 19/22] libtracker-miner: Add file-attributes argument to TrackerFileNotifier
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker-miners/wip/carlosg/speed-track: 19/22] libtracker-miner: Add file-attributes argument to TrackerFileNotifier
- Date: Thu, 22 Oct 2020 14:45:56 +0000 (UTC)
commit 60d93cf971e3e5872a783e6cac47afb918a98b8d
Author: Carlos Garnacho <carlosg gnome org>
Date: Sat Oct 17 17:59:08 2020 +0200
libtracker-miner: Add file-attributes argument to TrackerFileNotifier
We want to specify file attributes up in the miner, so add a way to
let these further down to the TrackerCrawler.
src/libtracker-miner/tracker-file-notifier.c | 28 ++++++++++++++++++----
src/libtracker-miner/tracker-file-notifier.h | 3 ++-
src/libtracker-miner/tracker-miner-fs.c | 4 +++-
.../libtracker-miner/tracker-file-notifier-test.c | 3 ++-
4 files changed, 30 insertions(+), 8 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-file-notifier.c b/src/libtracker-miner/tracker-file-notifier.c
index efd1e8096..7317ed93e 100644
--- a/src/libtracker-miner/tracker-file-notifier.c
+++ b/src/libtracker-miner/tracker-file-notifier.c
@@ -33,7 +33,8 @@ enum {
PROP_0,
PROP_INDEXING_TREE,
PROP_DATA_PROVIDER,
- PROP_CONNECTION
+ PROP_CONNECTION,
+ PROP_FILE_ATTRIBUTES,
};
enum {
@@ -98,6 +99,7 @@ typedef struct {
TrackerSparqlStatement *content_query;
GTimer *timer;
+ gchar *file_attributes;
/* List of pending directory
* trees to get data from
@@ -135,6 +137,9 @@ tracker_file_notifier_set_property (GObject *object,
case PROP_CONNECTION:
priv->connection = g_value_dup_object (value);
break;
+ case PROP_FILE_ATTRIBUTES:
+ priv->file_attributes = g_value_dup_string (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -161,6 +166,9 @@ tracker_file_notifier_get_property (GObject *object,
case PROP_CONNECTION:
g_value_set_object (value, priv->connection);
break;
+ case PROP_FILE_ATTRIBUTES:
+ g_value_set_string (value, priv->file_attributes);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -1331,6 +1339,7 @@ tracker_file_notifier_finalize (GObject *object)
g_queue_clear (&priv->queue);
g_hash_table_destroy (priv->cache);
+ g_free (priv->file_attributes);
if (priv->indexing_tree) {
g_object_unref (priv->indexing_tree);
@@ -1449,9 +1458,7 @@ tracker_file_notifier_constructed (GObject *object)
tracker_crawler_set_check_func (priv->crawler,
crawler_check_func,
object, NULL);
- tracker_crawler_set_file_attributes (priv->crawler,
- G_FILE_ATTRIBUTE_TIME_MODIFIED ","
- G_FILE_ATTRIBUTE_STANDARD_TYPE);
+ tracker_crawler_set_file_attributes (priv->crawler, priv->file_attributes);
check_disable_monitor (TRACKER_FILE_NOTIFIER (object));
}
@@ -1584,6 +1591,15 @@ tracker_file_notifier_class_init (TrackerFileNotifierClass *klass)
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (object_class,
+ PROP_FILE_ATTRIBUTES,
+ g_param_spec_string ("file-attributes",
+ "File attributes",
+ "File attributes",
+ NULL,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS));
}
static void
@@ -1624,7 +1640,8 @@ tracker_file_notifier_init (TrackerFileNotifier *notifier)
TrackerFileNotifier *
tracker_file_notifier_new (TrackerIndexingTree *indexing_tree,
TrackerDataProvider *data_provider,
- TrackerSparqlConnection *connection)
+ TrackerSparqlConnection *connection,
+ const gchar *file_attributes)
{
g_return_val_if_fail (TRACKER_IS_INDEXING_TREE (indexing_tree), NULL);
@@ -1632,6 +1649,7 @@ tracker_file_notifier_new (TrackerIndexingTree *indexing_tree,
"indexing-tree", indexing_tree,
"data-provider", data_provider,
"connection", connection,
+ "file-attributes", file_attributes,
NULL);
}
diff --git a/src/libtracker-miner/tracker-file-notifier.h b/src/libtracker-miner/tracker-file-notifier.h
index e563f3320..c6081bfda 100644
--- a/src/libtracker-miner/tracker-file-notifier.h
+++ b/src/libtracker-miner/tracker-file-notifier.h
@@ -81,7 +81,8 @@ GType tracker_file_notifier_get_type (void) G_GNUC_CONST;
TrackerFileNotifier *
tracker_file_notifier_new (TrackerIndexingTree *indexing_tree,
TrackerDataProvider *data_provider,
- TrackerSparqlConnection *connection);
+ TrackerSparqlConnection *connection,
+ const gchar *file_attributes);
gboolean tracker_file_notifier_start (TrackerFileNotifier *notifier);
void tracker_file_notifier_stop (TrackerFileNotifier *notifier);
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index 85a55efac..128769deb 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -653,7 +653,9 @@ miner_fs_initable_init (GInitable *initable,
/* Create the file notifier */
priv->file_notifier = tracker_file_notifier_new (priv->indexing_tree,
priv->data_provider,
- tracker_miner_get_connection (TRACKER_MINER
(initable)));
+ tracker_miner_get_connection (TRACKER_MINER
(initable)),
+ G_FILE_ATTRIBUTE_TIME_MODIFIED ","
+ G_FILE_ATTRIBUTE_STANDARD_TYPE);
if (!priv->file_notifier) {
g_set_error (error,
diff --git a/tests/libtracker-miner/tracker-file-notifier-test.c
b/tests/libtracker-miner/tracker-file-notifier-test.c
index 4451ef251..211eb8d82 100644
--- a/tests/libtracker-miner/tracker-file-notifier-test.c
+++ b/tests/libtracker-miner/tracker-file-notifier-test.c
@@ -292,7 +292,8 @@ test_common_context_setup (TestCommonContext *fixture,
fixture->main_loop = g_main_loop_new (NULL, FALSE);
fixture->notifier = tracker_file_notifier_new (fixture->indexing_tree, FALSE,
- fixture->connection);
+ fixture->connection,
+ G_FILE_ATTRIBUTE_STANDARD_TYPE);
g_signal_connect (fixture->notifier, "file-created",
G_CALLBACK (file_notifier_file_created_cb), fixture);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]