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 gboolean
miner_applications_initable_init (GInitable     *initable,
                                  GCancellable  *cancellable,
                                  GError       **error)
{
	TrackerMinerFS *fs;
	TrackerMinerApplications *app;
	GError *inner_error = NULL;
	TrackerIndexingTree *indexing_tree;

	fs = TRACKER_MINER_FS (initable);
	app = TRACKER_MINER_APPLICATIONS (initable);
	indexing_tree = tracker_miner_fs_get_indexing_tree (fs);

	/* Set up files filter, deny every file, but
	 * those with a .desktop/directory extension
	 */
	tracker_indexing_tree_set_default_policy (indexing_tree,
						  TRACKER_FILTER_FILE,
						  TRACKER_FILTER_POLICY_DENY);
	tracker_indexing_tree_add_filter (indexing_tree,
					  TRACKER_FILTER_FILE,
					  "*.desktop");
	tracker_indexing_tree_add_filter (indexing_tree,
					  TRACKER_FILTER_FILE,
					  "*.directory");

	/* Chain up parent's initable callback before calling child's one */
	if (!miner_applications_initable_parent_iface->init (initable, cancellable, &inner_error)) {
		g_propagate_error (error, inner_error);
		return FALSE;
	}

	g_signal_connect (fs, "finished",
	                  G_CALLBACK (miner_finished_cb),
	                  NULL);

	miner_applications_add_directories (fs);

#ifdef HAVE_MEEGOTOUCH
	tracker_meego_init ();
#endif /* HAVE_MEEGOTOUCH */

	app->locale_notification_id = tracker_locale_notify_add (TRACKER_LOCALE_LANGUAGE,
	                                                         tracker_locale_notify_cb,
	                                                         app,
	                                                         NULL);

	return TRUE;
}
Esempio n. 4
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 */
}
static gboolean
miner_applications_initable_init (GInitable     *initable,
                                  GCancellable  *cancellable,
                                  GError       **error)
{
	TrackerMinerFS *fs;
	GError *inner_error = NULL;
	TrackerIndexingTree *indexing_tree;

	fs = TRACKER_MINER_FS (initable);
	indexing_tree = tracker_miner_fs_get_indexing_tree (fs);

	/* Set up files filter, deny every file, but
	 * those with a .desktop/directory extension
	 */
	tracker_indexing_tree_set_default_policy (indexing_tree,
						  TRACKER_FILTER_FILE,
						  TRACKER_FILTER_POLICY_DENY);
	tracker_indexing_tree_add_filter (indexing_tree,
					  TRACKER_FILTER_FILE,
					  "*.desktop");
	tracker_indexing_tree_add_filter (indexing_tree,
					  TRACKER_FILTER_FILE,
					  "*.directory");

	/* Chain up parent's initable callback before calling child's one */
	if (!miner_applications_initable_parent_iface->init (initable, cancellable, &inner_error)) {
		g_propagate_error (error, inner_error);
		return FALSE;
	}

	g_signal_connect (fs, "finished",
	                  G_CALLBACK (miner_finished_cb),
	                  NULL);

	miner_applications_add_directories (fs);

	/* If the locales changed, we need to reset things first */
	detect_locale_changed (TRACKER_MINER (fs));

	return TRUE;
}