[tracker-miners/wip/carlosg/speed-track: 20/22] libtracker-miner: Add ::file-attributes property to TrackerMinerFS
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker-miners/wip/carlosg/speed-track: 20/22] libtracker-miner: Add ::file-attributes property to TrackerMinerFS
- Date: Thu, 22 Oct 2020 14:45:56 +0000 (UTC)
commit d8185367940156142e8b02bcc6c01f65cd838abc
Author: Carlos Garnacho <carlosg gnome org>
Date: Sat Oct 17 18:05:00 2020 +0200
libtracker-miner: Add ::file-attributes property to TrackerMinerFS
This way the files miner can specify the file attributes that it will
need for extraction.
src/libtracker-miner/tracker-miner-fs.c | 21 ++++++++++++++++++---
src/miners/fs/tracker-miner-files.c | 9 +++++++++
2 files changed, 27 insertions(+), 3 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index 128769deb..bd24d53b3 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -128,6 +128,7 @@ struct _TrackerMinerFSPrivate {
/* Properties */
gdouble throttle;
+ gchar *file_attributes;
/* Status */
GTimer *timer;
@@ -186,7 +187,8 @@ enum {
PROP_ROOT,
PROP_WAIT_POOL_LIMIT,
PROP_READY_POOL_LIMIT,
- PROP_DATA_PROVIDER
+ PROP_DATA_PROVIDER,
+ PROP_FILE_ATTRIBUTES,
};
static void miner_fs_initable_iface_init (GInitableIface *iface);
@@ -357,6 +359,14 @@ tracker_miner_fs_class_init (TrackerMinerFSClass *klass)
"Data provider populating data, e.g. like
GFileEnumerator",
TRACKER_TYPE_DATA_PROVIDER,
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));
+
/**
* TrackerMinerFS::process-file:
@@ -654,8 +664,7 @@ miner_fs_initable_init (GInitable *initable,
priv->file_notifier = tracker_file_notifier_new (priv->indexing_tree,
priv->data_provider,
tracker_miner_get_connection (TRACKER_MINER
(initable)),
- G_FILE_ATTRIBUTE_TIME_MODIFIED ","
- G_FILE_ATTRIBUTE_STANDARD_TYPE);
+ priv->file_attributes);
if (!priv->file_notifier) {
g_set_error (error,
@@ -966,6 +975,9 @@ fs_set_property (GObject *object,
case PROP_DATA_PROVIDER:
fs->priv->data_provider = g_value_dup_object (value);
break;
+ case PROP_FILE_ATTRIBUTES:
+ fs->priv->file_attributes = g_value_dup_string (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -998,6 +1010,9 @@ fs_get_property (GObject *object,
case PROP_DATA_PROVIDER:
g_value_set_object (value, fs->priv->data_provider);
break;
+ case PROP_FILE_ATTRIBUTES:
+ g_value_set_string (value, fs->priv->file_attributes);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
diff --git a/src/miners/fs/tracker-miner-files.c b/src/miners/fs/tracker-miner-files.c
index 3c7735504..8275dfa42 100644
--- a/src/miners/fs/tracker-miner-files.c
+++ b/src/miners/fs/tracker-miner-files.c
@@ -55,6 +55,14 @@
#define DEFAULT_GRAPH "tracker:FileSystem"
+#define FILE_ATTRIBUTES \
+ G_FILE_ATTRIBUTE_STANDARD_TYPE "," \
+ G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE "," \
+ G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME "," \
+ G_FILE_ATTRIBUTE_STANDARD_SIZE "," \
+ G_FILE_ATTRIBUTE_TIME_MODIFIED "," \
+ G_FILE_ATTRIBUTE_TIME_ACCESS
+
#define TRACKER_MINER_FILES_GET_PRIVATE(o) (tracker_miner_files_get_instance_private (TRACKER_MINER_FILES
(o)))
static GQuark miner_files_error_quark = 0;
@@ -2615,6 +2623,7 @@ tracker_miner_files_new (TrackerSparqlConnection *connection,
"domain", domain,
"processing-pool-wait-limit", 1,
"processing-pool-ready-limit", 100,
+ "file-attributes", FILE_ATTRIBUTES,
NULL);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]