[tracker-miners/wip/carlosg/apps-in-miner-fs: 8/10] tracker-miner-fs: Index application dirs
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker-miners/wip/carlosg/apps-in-miner-fs: 8/10] tracker-miner-fs: Index application dirs
- Date: Tue, 13 Nov 2018 11:47:55 +0000 (UTC)
commit d13fd8b28a7c95a1f1bced33052e456eb9cce3a0
Author: Carlos Garnacho <carlosg gnome org>
Date: Sat Nov 10 17:26:12 2018 +0100
tracker-miner-fs: Index application dirs
This is the second step towards folding tracker-miner-apps into
tracker-miner-fs. The TrackerIndexingTree has been made to also
index system/user application directories, which does the scaffolding
for tracker-extract to index those.
....freedesktop.Tracker.Miner.Files.gschema.xml.in | 2 +-
src/miners/fs/tracker-miner-files.c | 39 ++++++++++++++++++++++
2 files changed, 40 insertions(+), 1 deletion(-)
---
diff --git a/src/miners/fs/org.freedesktop.Tracker.Miner.Files.gschema.xml.in
b/src/miners/fs/org.freedesktop.Tracker.Miner.Files.gschema.xml.in
index a96e5194e..bc47a8417 100644
--- a/src/miners/fs/org.freedesktop.Tracker.Miner.Files.gschema.xml.in
+++ b/src/miners/fs/org.freedesktop.Tracker.Miner.Files.gschema.xml.in
@@ -144,7 +144,7 @@ Boston, MA 02110-1301, USA.
<key name="ignored-files" type="as">
<_summary>Ignored files</_summary>
<_description>List of file patterns to avoid</_description>
- <default>[ '*~', '*.o', '*.la', '*.lo' , '*.loT', '*.in', '*.csproj', '*.m4', '*.rej', '*.gmo',
'*.orig', '*.pc', '*.omf', '*.aux', '*.tmp', '*.vmdk', '*.vm*', '*.nvram', '*.part', '*.rcore', '*.lzo',
'autom4te', 'conftest', 'confstat', 'Makefile', 'SCCS', 'ltmain.sh', 'libtool', 'config.status',
'confdefs.h', 'configure', '#*#', '~$*.doc?', '~$*.dot?', '~$*.xls?', '~$*.xlt?', '~$*.xlam', '~$*.ppt?',
'~$*.pot?', '~$*.ppam', '~$*.ppsm', '~$*.ppsx', '~$*.vsd?', '~$*.vss?', '~$*.vst?', '*.desktop',
'*.directory' ]</default>
+ <default>[ '*~', '*.o', '*.la', '*.lo' , '*.loT', '*.in', '*.csproj', '*.m4', '*.rej', '*.gmo',
'*.orig', '*.pc', '*.omf', '*.aux', '*.tmp', '*.vmdk', '*.vm*', '*.nvram', '*.part', '*.rcore', '*.lzo',
'autom4te', 'conftest', 'confstat', 'Makefile', 'SCCS', 'ltmain.sh', 'libtool', 'config.status',
'confdefs.h', 'configure', '#*#', '~$*.doc?', '~$*.dot?', '~$*.xls?', '~$*.xlt?', '~$*.xlam', '~$*.ppt?',
'~$*.pot?', '~$*.ppam', '~$*.ppsm', '~$*.ppsx', '~$*.vsd?', '~$*.vss?', '~$*.vst?', 'mimeapps.list',
'mimeinfo.cache', '*.directory' ]</default>
</key>
<key name="ignored-directories" type="as">
diff --git a/src/miners/fs/tracker-miner-files.c b/src/miners/fs/tracker-miner-files.c
index c91ed28b9..2e4ee47bb 100644
--- a/src/miners/fs/tracker-miner-files.c
+++ b/src/miners/fs/tracker-miner-files.c
@@ -531,6 +531,29 @@ miner_files_initable_iface_init (GInitableIface *iface)
iface->init = miner_files_initable_init;
}
+static void
+miner_files_add_application_dir (TrackerMinerFiles *mf,
+ const gchar *dir)
+{
+ TrackerIndexingTree *indexing_tree;
+ GFile *file;
+ gchar *path;
+
+ indexing_tree = tracker_miner_fs_get_indexing_tree (TRACKER_MINER_FS (mf));
+
+ /* Add $dir/applications */
+ path = g_build_filename (dir, "applications", NULL);
+ file = g_file_new_for_path (path);
+ g_message (" Adding:'%s'", path);
+
+ tracker_indexing_tree_add (indexing_tree, file,
+ TRACKER_DIRECTORY_FLAG_RECURSE |
+ TRACKER_DIRECTORY_FLAG_MONITOR |
+ TRACKER_DIRECTORY_FLAG_CHECK_MTIME);
+ g_object_unref (file);
+ g_free (path);
+}
+
static gboolean
miner_files_initable_init (GInitable *initable,
GCancellable *cancellable,
@@ -540,10 +563,13 @@ miner_files_initable_init (GInitable *initable,
TrackerMinerFS *fs;
TrackerIndexingTree *indexing_tree;
TrackerDirectoryFlags flags;
+ const gchar *user_data_dir;
+ const gchar * const *xdg_dirs;
GError *inner_error = NULL;
GSList *mounts = NULL;
GSList *dirs;
GSList *m;
+ gint i;
/* Chain up parent's initable callback before calling child's one */
if (!miner_files_initable_parent_iface->init (initable, cancellable, &inner_error)) {
@@ -752,6 +778,19 @@ miner_files_initable_init (GInitable *initable,
NULL);
}
+ /* Add application directories */
+ g_message ("Setting up applications to iterate from XDG system directories");
+ xdg_dirs = g_get_system_data_dirs ();
+
+ for (i = 0; xdg_dirs[i]; i++) {
+ miner_files_add_application_dir (mf, xdg_dirs[i]);
+ }
+
+ user_data_dir = g_get_user_data_dir ();
+ if (user_data_dir) {
+ miner_files_add_application_dir (mf, user_data_dir);
+ }
+
/* We want to get notified when config changes */
g_signal_connect (mf->private->config, "notify::low-disk-space-limit",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]