Commit d13fd8b2 authored by Carlos Garnacho's avatar Carlos Garnacho

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.
parent be2ba869
......@@ -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">
......
......@@ -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",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment