static void
miner_applications_basedir_add (TrackerMinerFS *fs,
                                const gchar    *basedir)
{
	TrackerIndexingTree *indexing_tree;
	GFile *file;
	gchar *path;

	indexing_tree = tracker_miner_fs_get_indexing_tree (fs);

	/* Add $dir/applications */
	path = g_build_filename (basedir, "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);

	/* Add $dir/desktop-directories */
	path = g_build_filename (basedir, "desktop-directories", 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 inline gboolean
miner_userguides_basedir_add_path (TrackerMinerFS *fs,
                                   const gchar    *path,
                                   const gchar    *locale)
{
	if (g_file_test (path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)) {
		TrackerIndexingTree *indexing_tree;
		GFile *file;

		indexing_tree = tracker_miner_fs_get_indexing_tree (fs);

		g_message ("  Adding:'%s'", path);
		file = g_file_new_for_path (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);

		return TRUE;
	}

	g_message ("  No userguide found for locale:'%s' in this prefix", locale);

	return FALSE;
}
Esempio n. 3
0
static void
miner_applications_add_directories (TrackerMinerFS *fs)
{
#ifdef HAVE_MEEGOTOUCH
	TrackerIndexingTree *indexing_tree;
	GFile *file;
	const gchar *path;
#endif /* HAVE_MEEGOTOUCH */
	const gchar * const *xdg_dirs;
	const gchar *user_data_dir;
	gint i;

	g_message ("Setting up applications to iterate from XDG system directories");

	/* Add all XDG system and local dirs */
	xdg_dirs = g_get_system_data_dirs ();

	for (i = 0; xdg_dirs[i]; i++) {
		miner_applications_basedir_add (fs, xdg_dirs[i]);
	}

	g_message ("Setting up applications to iterate from XDG user directories");

	user_data_dir = g_get_user_data_dir ();
	if (user_data_dir) {
		miner_applications_basedir_add (fs, user_data_dir);
	}

#ifdef HAVE_MEEGOTOUCH
	/* NOTE: We don't use miner_applications_basedir_add() for
	 * this location because it is unique to MeeGoTouch.
	 */
	path = "/usr/lib/duicontrolpanel/";
	indexing_tree = tracker_miner_fs_get_indexing_tree (fs);

	g_message ("Setting up applications to iterate from MeegoTouch directories");
	g_message ("  Adding:'%s'", path);

	file = g_file_new_for_path (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);
#endif /* HAVE_MEEGOTOUCH */
}