diff options
-rw-r--r-- | docs/reference/libtracker-miner/libtracker-miner-sections.txt | 1 | ||||
-rw-r--r-- | src/libtracker-miner/tracker-miner-fs.c | 77 | ||||
-rw-r--r-- | src/libtracker-miner/tracker-miner-fs.h | 2 | ||||
-rw-r--r-- | src/libtracker-miner/tracker-miner.vapi | 1 | ||||
-rw-r--r-- | src/miners/apps/tracker-miner-applications.c | 5 | ||||
-rw-r--r-- | src/miners/fs/tracker-miner-files.c | 6 |
6 files changed, 9 insertions, 83 deletions
diff --git a/docs/reference/libtracker-miner/libtracker-miner-sections.txt b/docs/reference/libtracker-miner/libtracker-miner-sections.txt index 9b23c948f..44fdaf911 100644 --- a/docs/reference/libtracker-miner/libtracker-miner-sections.txt +++ b/docs/reference/libtracker-miner/libtracker-miner-sections.txt @@ -204,7 +204,6 @@ tracker_miner_fs_writeback_file tracker_miner_fs_writeback_notify tracker_miner_fs_notify_finish tracker_miner_fs_get_urn -tracker_miner_fs_get_parent_urn tracker_miner_fs_query_urn tracker_miner_fs_has_items_to_process <SUBSECTION Standard> diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c index a57fc333f..e5418a5c2 100644 --- a/src/libtracker-miner/tracker-miner-fs.c +++ b/src/libtracker-miner/tracker-miner-fs.c @@ -159,7 +159,6 @@ typedef struct { typedef struct { GFile *file; gchar *urn; - gchar *parent_urn; gint priority; GCancellable *cancellable; TrackerMiner *miner; @@ -1301,7 +1300,6 @@ static UpdateProcessingTaskContext * update_processing_task_context_new (TrackerMiner *miner, gint priority, const gchar *urn, - const gchar *parent_urn, GCancellable *cancellable) { UpdateProcessingTaskContext *ctxt; @@ -1309,7 +1307,6 @@ update_processing_task_context_new (TrackerMiner *miner, ctxt = g_slice_new0 (UpdateProcessingTaskContext); ctxt->miner = miner; ctxt->urn = g_strdup (urn); - ctxt->parent_urn = g_strdup (parent_urn); ctxt->priority = priority; if (cancellable) { @@ -1323,7 +1320,6 @@ static void update_processing_task_context_free (UpdateProcessingTaskContext *ctxt) { g_free (ctxt->urn); - g_free (ctxt->parent_urn); if (ctxt->cancellable) { g_object_unref (ctxt->cancellable); @@ -1457,9 +1453,8 @@ item_add_or_update (TrackerMinerFS *fs, gboolean processing; gboolean attribute_update_only; TrackerTask *task; - const gchar *parent_urn, *urn; + const gchar *urn; gchar *uri; - GFile *parent; GTask *gtask; priv = fs->priv; @@ -1473,20 +1468,11 @@ item_add_or_update (TrackerMinerFS *fs, * we have to UPDATE, not INSERT. */ urn = lookup_file_urn (fs, file, FALSE); - if (!tracker_indexing_tree_file_is_root (fs->priv->indexing_tree, file)) { - parent = g_file_get_parent (file); - parent_urn = lookup_file_urn (fs, parent, TRUE); - g_object_unref (parent); - } else { - parent_urn = NULL; - } - /* Create task and add it to the pool as a WAIT task (we need to extract * the file metadata and such) */ ctxt = update_processing_task_context_new (TRACKER_MINER (fs), priority, urn, - parent_urn, cancellable); task = tracker_task_new (file, ctxt, (GDestroyNotify) update_processing_task_context_free); @@ -3510,67 +3496,6 @@ tracker_miner_fs_query_urn (TrackerMinerFS *fs, return g_strdup (lookup_file_urn (fs, file, TRUE)); } -/** - * tracker_miner_fs_get_parent_urn: - * @fs: a #TrackerMinerFS - * @file: a #GFile obtained in #TrackerMinerFS::process-file - * - * If @file is currently being processed by @fs, this function - * will return the parent folder URN if any. This function is - * useful to set the nie:belongsToContainer relationship. The - * processing order of #TrackerMinerFS guarantees that a folder - * has been already fully processed for indexing before any - * children is processed, so most usually this function should - * return non-%NULL. - * - * Returns: (transfer none) (nullable): The parent folder URN, or %NULL. - * - * Since: 0.8 - **/ -const gchar * -tracker_miner_fs_get_parent_urn (TrackerMinerFS *fs, - GFile *file) -{ - TrackerTask *task; - - g_return_val_if_fail (TRACKER_IS_MINER_FS (fs), NULL); - g_return_val_if_fail (G_IS_FILE (file), NULL); - - /* Check if found in currently processed data */ - task = tracker_task_pool_find (fs->priv->task_pool, file); - - if (!task) { - gchar *uri; - - uri = g_file_get_uri (file); - - g_critical ("File '%s' is not being currently processed, " - "so the parent URN cannot be retrieved.", uri); - g_free (uri); - - return NULL; - } else { - UpdateProcessingTaskContext *ctxt; - - /* We are only storing the URN in the created/updated tasks */ - ctxt = tracker_task_get_data (task); - - if (!ctxt) { - gchar *uri; - - uri = g_file_get_uri (file); - g_critical ("File '%s' is being processed, but not as a " - "CREATED/UPDATED task, so cannot get parent " - "URN", - uri); - g_free (uri); - return NULL; - } - - return ctxt->parent_urn; - } -} - void tracker_miner_fs_force_recheck (TrackerMinerFS *fs) { diff --git a/src/libtracker-miner/tracker-miner-fs.h b/src/libtracker-miner/tracker-miner-fs.h index 608de92d2..f5d14124b 100644 --- a/src/libtracker-miner/tracker-miner-fs.h +++ b/src/libtracker-miner/tracker-miner-fs.h @@ -195,8 +195,6 @@ void tracker_miner_fs_notify_finish (TrackerMinerFS *f /* URNs */ const gchar *tracker_miner_fs_get_urn (TrackerMinerFS *fs, GFile *file); -const gchar *tracker_miner_fs_get_parent_urn (TrackerMinerFS *fs, - GFile *file); gchar *tracker_miner_fs_query_urn (TrackerMinerFS *fs, GFile *file); diff --git a/src/libtracker-miner/tracker-miner.vapi b/src/libtracker-miner/tracker-miner.vapi index bc3d75ab7..1100f9a73 100644 --- a/src/libtracker-miner/tracker-miner.vapi +++ b/src/libtracker-miner/tracker-miner.vapi @@ -125,7 +125,6 @@ namespace Tracker { public unowned Tracker.IndexingTree get_indexing_tree (); public bool get_initial_crawling (); public bool get_mtime_checking (); - public unowned string? get_parent_urn (GLib.File file); public double get_throttle (); public unowned string? get_urn (GLib.File file); public bool has_items_to_process (); diff --git a/src/miners/apps/tracker-miner-applications.c b/src/miners/apps/tracker-miner-applications.c index 1133d216c..1bb6c8626 100644 --- a/src/miners/apps/tracker-miner-applications.c +++ b/src/miners/apps/tracker-miner-applications.c @@ -494,6 +494,7 @@ process_desktop_file (ProcessApplicationData *data, { TrackerSparqlBuilder *sparql; GKeyFile *key_file; + GFile *parent; gchar *name = NULL; gchar *path; gchar *type; @@ -808,7 +809,9 @@ process_desktop_file (ProcessApplicationData *data, tracker_sparql_builder_object_date (sparql, (time_t *) &time); } - parent_urn = tracker_miner_fs_get_parent_urn (TRACKER_MINER_FS (data->miner), data->file); + parent = g_file_get_parent (data->file); + parent_urn = tracker_miner_fs_query_urn (TRACKER_MINER_FS (data->miner), parent); + g_object_unref (parent); if (parent_urn) { tracker_sparql_builder_predicate (sparql, "nfo:belongsToContainer"); diff --git a/src/miners/fs/tracker-miner-files.c b/src/miners/fs/tracker-miner-files.c index e3653deeb..3c86bbdbc 100644 --- a/src/miners/fs/tracker-miner-files.c +++ b/src/miners/fs/tracker-miner-files.c @@ -2125,7 +2125,7 @@ process_file_cb (GObject *object, const gchar *mime_type, *urn, *parent_urn; GFileInfo *file_info; guint64 time_; - GFile *file; + GFile *file, *parent; gchar *uri; GError *error = NULL; gboolean is_iri; @@ -2205,7 +2205,9 @@ process_file_cb (GObject *object, tracker_sparql_builder_object (sparql, "nfo:Folder"); } - parent_urn = tracker_miner_fs_get_parent_urn (TRACKER_MINER_FS (data->miner), file); + parent = g_file_get_parent (file); + parent_urn = tracker_miner_fs_query_urn (TRACKER_MINER_FS (data->miner), parent); + g_object_unref (parent); if (parent_urn) { tracker_sparql_builder_predicate (sparql, "nfo:belongsToContainer"); |