[tracker/data-provider-monitor-interface: 7/10] miners: Stopped using deprecated tracker_miner_fs_get_indexing_tree()
- From: Martyn James Russell <mr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/data-provider-monitor-interface: 7/10] miners: Stopped using deprecated tracker_miner_fs_get_indexing_tree()
- Date: Wed, 14 Jan 2015 17:04:52 +0000 (UTC)
commit 0715c1a49e47c34a4a2287ea26096adf7e3be430
Author: Martyn Russell <martyn lanedo com>
Date: Wed Jan 14 14:11:40 2015 +0000
miners: Stopped using deprecated tracker_miner_fs_get_indexing_tree()
src/miners/apps/tracker-miner-applications.c | 21 ++++++++++-
src/miners/fs/tracker-miner-files.c | 39 ++++++++++++++------
src/miners/user-guides/tracker-miner-user-guides.c | 21 ++++++++++-
3 files changed, 65 insertions(+), 16 deletions(-)
---
diff --git a/src/miners/apps/tracker-miner-applications.c b/src/miners/apps/tracker-miner-applications.c
index a01d3dd..8753ca0 100644
--- a/src/miners/apps/tracker-miner-applications.c
+++ b/src/miners/apps/tracker-miner-applications.c
@@ -91,11 +91,21 @@ static void
miner_applications_basedir_add (TrackerMinerFS *fs,
const gchar *basedir)
{
+ TrackerDataProvider *data_provider;
TrackerIndexingTree *indexing_tree;
+ GError *error = NULL;
GFile *file;
gchar *path;
- indexing_tree = tracker_miner_fs_get_indexing_tree (fs);
+ data_provider = tracker_miner_fs_get_data_provider (fs);
+ indexing_tree = tracker_data_provider_get_indexing_tree (data_provider, &error);
+
+ if (!indexing_tree) {
+ g_critical (" Could not add directories to be indexed, %s",
+ error ? error->message : "TrackerIndexingTree was NULL");
+ g_clear_error (&error);
+ return;
+ }
/* Add $dir/applications */
path = g_build_filename (basedir, "applications", NULL);
@@ -351,10 +361,17 @@ miner_applications_initable_init (GInitable *initable,
{
TrackerMinerFS *fs;
GError *inner_error = NULL;
+ TrackerDataProvider *data_provider;
TrackerIndexingTree *indexing_tree;
fs = TRACKER_MINER_FS (initable);
- indexing_tree = tracker_miner_fs_get_indexing_tree (fs);
+ data_provider = tracker_miner_fs_get_data_provider (fs);
+ indexing_tree = tracker_data_provider_get_indexing_tree (data_provider, &inner_error);
+
+ if (!indexing_tree) {
+ g_propagate_error (error, inner_error);
+ return FALSE;
+ }
/* Set up files filter, deny every file, but
* those with a .desktop/directory extension
diff --git a/src/miners/fs/tracker-miner-files.c b/src/miners/fs/tracker-miner-files.c
index 246e7db..56dfcdb 100644
--- a/src/miners/fs/tracker-miner-files.c
+++ b/src/miners/fs/tracker-miner-files.c
@@ -121,6 +121,9 @@ static void miner_files_initable_iface_init (GInitableIface *i
static gboolean miner_files_initable_init (GInitable *initable,
GCancellable *cancellable,
GError **error);
+static inline TrackerIndexingTree *
+ get_indexing_tree (TrackerMinerFiles *miner);
+
static void mount_pre_unmount_cb (GVolumeMonitor *volume_monitor,
GMount *mount,
TrackerMinerFiles *mf);
@@ -290,7 +293,6 @@ miner_files_initable_init (GInitable *initable,
GError **error)
{
TrackerMinerFiles *mf;
- TrackerMinerFS *fs;
TrackerIndexingTree *indexing_tree;
TrackerDirectoryFlags flags;
GError *inner_error = NULL;
@@ -305,8 +307,7 @@ miner_files_initable_init (GInitable *initable,
}
mf = TRACKER_MINER_FILES (initable);
- fs = TRACKER_MINER_FS (initable);
- indexing_tree = tracker_miner_fs_get_indexing_tree (fs);
+ indexing_tree = get_indexing_tree (mf);
tracker_indexing_tree_set_filter_hidden (indexing_tree, TRUE);
miner_files_update_filters (mf);
@@ -652,6 +653,20 @@ miner_files_finalize (GObject *object)
G_OBJECT_CLASS (tracker_miner_files_parent_class)->finalize (object);
}
+static inline TrackerIndexingTree *
+get_indexing_tree (TrackerMinerFiles *miner)
+{
+ TrackerDataProvider *dp;
+
+ if (!miner) {
+ return NULL;
+ }
+
+ dp = tracker_miner_fs_get_data_provider (TRACKER_MINER_FS (miner));
+
+ return tracker_data_provider_get_indexing_tree (dp, NULL);
+}
+
static void
ensure_mount_point_exists (TrackerMinerFiles *miner,
GFile *mount_point,
@@ -1034,7 +1049,7 @@ init_mount_points (TrackerMinerFiles *miner_files)
TrackerDirectoryFlags flags;
GFile *file;
- indexing_tree = tracker_miner_fs_get_indexing_tree (TRACKER_MINER_FS
(miner));
+ indexing_tree = get_indexing_tree (TRACKER_MINER_FILES (miner));
flags = TRACKER_DIRECTORY_FLAG_RECURSE |
TRACKER_DIRECTORY_FLAG_CHECK_MTIME |
TRACKER_DIRECTORY_FLAG_PRESERVE;
@@ -1158,7 +1173,7 @@ mount_point_removed_cb (TrackerStorage *storage,
/* Tell TrackerMinerFS to skip monitoring everything under the mount
* point (in case there was no pre-unmount notification) */
- indexing_tree = tracker_miner_fs_get_indexing_tree (TRACKER_MINER_FS (miner));
+ indexing_tree = get_indexing_tree (miner);
tracker_indexing_tree_remove (indexing_tree, mount_point_file);
/* Set mount point status in tracker-store */
@@ -1198,7 +1213,7 @@ mount_point_added_cb (TrackerStorage *storage,
GSList *l;
mount_point_file = g_file_new_for_path (mount_point);
- indexing_tree = tracker_miner_fs_get_indexing_tree (TRACKER_MINER_FS (miner));
+ indexing_tree = get_indexing_tree (miner);
/* Check if one of the recursively indexed locations is in
* the mounted path, or if the mounted path is inside
@@ -1433,7 +1448,7 @@ mount_pre_unmount_cb (GVolumeMonitor *volume_monitor,
uri = g_file_get_uri (mount_root);
g_message ("Pre-unmount requested for '%s'", uri);
- indexing_tree = tracker_miner_fs_get_indexing_tree (TRACKER_MINER_FS (mf));
+ indexing_tree = get_indexing_tree (mf);
tracker_indexing_tree_remove (indexing_tree, mount_root);
g_object_unref (mount_root);
@@ -1562,7 +1577,7 @@ miner_files_update_filters (TrackerMinerFiles *files)
TrackerIndexingTree *indexing_tree;
GSList *list;
- indexing_tree = tracker_miner_fs_get_indexing_tree (TRACKER_MINER_FS (files));
+ indexing_tree = get_indexing_tree (files);
/* Ignored files */
list = tracker_config_get_ignored_files (files->private->config);
@@ -1593,7 +1608,7 @@ update_directories_from_new_config (TrackerMinerFS *mf,
GSList *sl;
priv = TRACKER_MINER_FILES_GET_PRIVATE (mf);
- indexing_tree = tracker_miner_fs_get_indexing_tree (mf);
+ indexing_tree = get_indexing_tree (TRACKER_MINER_FILES (mf));
g_message ("Updating %s directories changed from configuration",
recurse ? "recursive" : "single");
@@ -1730,7 +1745,7 @@ miner_files_force_recheck_idle (gpointer user_data)
miner_files_update_filters (miner_files);
- indexing_tree = tracker_miner_fs_get_indexing_tree (TRACKER_MINER_FS (miner_files));
+ indexing_tree = get_indexing_tree (miner_files);
roots = tracker_indexing_tree_list_roots (indexing_tree);
for (l = roots; l; l = l->next) {
@@ -1846,7 +1861,7 @@ index_volumes_changed_idle (gpointer user_data)
TrackerIndexingTree *indexing_tree;
GSList *sl;
- indexing_tree = tracker_miner_fs_get_indexing_tree (TRACKER_MINER_FS (mf));
+ indexing_tree = get_indexing_tree (mf);
for (sl = mounts_removed; sl; sl = g_slist_next (sl)) {
GFile *mount_point_file;
@@ -2771,7 +2786,7 @@ miner_files_add_removable_or_optical_directory (TrackerMinerFiles *mf,
}
}
- indexing_tree = tracker_miner_fs_get_indexing_tree (TRACKER_MINER_FS (mf));
+ indexing_tree = get_indexing_tree (mf);
flags = TRACKER_DIRECTORY_FLAG_RECURSE |
TRACKER_DIRECTORY_FLAG_CHECK_MTIME |
TRACKER_DIRECTORY_FLAG_PRESERVE |
diff --git a/src/miners/user-guides/tracker-miner-user-guides.c
b/src/miners/user-guides/tracker-miner-user-guides.c
index 59dfc40..e06026c 100644
--- a/src/miners/user-guides/tracker-miner-user-guides.c
+++ b/src/miners/user-guides/tracker-miner-user-guides.c
@@ -104,10 +104,20 @@ miner_userguides_basedir_add_path (TrackerMinerFS *fs,
const gchar *locale)
{
if (g_file_test (path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)) {
+ TrackerDataProvider *data_provider;
TrackerIndexingTree *indexing_tree;
+ GError *error = NULL;
GFile *file;
- indexing_tree = tracker_miner_fs_get_indexing_tree (fs);
+ data_provider = tracker_miner_fs_get_data_provider (fs);
+ indexing_tree = tracker_data_provider_get_indexing_tree (data_provider, &error);
+
+ if (!indexing_tree) {
+ g_critical ("Could not add directories to be indexed, %s",
+ error ? error->message : "TrackerIndexingTree was NULL");
+ g_clear_error (&error);
+ return FALSE;
+ }
g_message (" Adding:'%s'", path);
file = g_file_new_for_path (path);
@@ -360,10 +370,17 @@ miner_userguides_initable_init (GInitable *initable,
{
TrackerMinerFS *fs;
GError *inner_error = NULL;
+ TrackerDataProvider *data_provider;
TrackerIndexingTree *indexing_tree;
fs = TRACKER_MINER_FS (initable);
- indexing_tree = tracker_miner_fs_get_indexing_tree (fs);
+ data_provider = tracker_miner_fs_get_data_provider (fs);
+ indexing_tree = tracker_data_provider_get_indexing_tree (data_provider, NULL);
+
+ if (!indexing_tree) {
+ g_propagate_error (error, inner_error);
+ return FALSE;
+ }
/* Set up files filter, deny every file, but
* those with a .desktop/directory extension
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]