[tracker/miner-fs-dbus-api: 5/13] tracker-control: Add --index-file parameter.



commit 90756d7c5e5b393b45cec5eed32521cb9a506bcb
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Aug 19 15:05:33 2010 +0200

    tracker-control: Add --index-file parameter.

 src/tracker-control/tracker-control.c |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/src/tracker-control/tracker-control.c b/src/tracker-control/tracker-control.c
index 6eaa997..9955c74 100644
--- a/src/tracker-control/tracker-control.c
+++ b/src/tracker-control/tracker-control.c
@@ -69,6 +69,7 @@ static gboolean remove_config;
 static gboolean start;
 static const gchar **reindex_mime_types;
 static gboolean print_version;
+static gchar *index_file;
 
 static gboolean term_option_arg_func (const gchar  *option_value,
                                       const gchar  *value,
@@ -97,6 +98,9 @@ static GOptionEntry entries[] = {
 	{ "reindex-mime-type", 'm', 0, G_OPTION_ARG_STRING_ARRAY, &reindex_mime_types,
 	  N_("Reindex files which match the mime type supplied (for new extractors), use -m MIME1 -m MIME2"),
 	  N_("MIME") },
+	{ "index-file", 'f', 0, G_OPTION_ARG_FILENAME, &index_file,
+	  N_("(Re)Index a given file"),
+	  N_("File") },
 	{ "version", 'V', 0, G_OPTION_ARG_NONE, &print_version,
 	  N_("Print version"),
 	  NULL },
@@ -532,6 +536,7 @@ main (int argc, char **argv)
 		}
 
 		g_slist_free (miners);
+		g_object_unref (manager);
 	}
 
 	if (reindex_mime_types) {
@@ -577,5 +582,26 @@ main (int argc, char **argv)
 		g_object_unref (proxy);
 	}
 
+	if (index_file) {
+		TrackerMinerManager *manager;
+		GError *error = NULL;
+		GFile *file;
+
+		file = g_file_new_for_commandline_arg (index_file);
+		manager = tracker_miner_manager_new ();
+
+		tracker_miner_manager_index_file (manager, file, &error);
+
+		if (error) {
+			g_print ("Could not (re)index file '%s': %s\n",
+			         index_file, error->message);
+			g_error_free (error);
+			return EXIT_FAILURE;
+		}
+
+		g_object_unref (manager);
+		g_object_unref (file);
+	}
+
 	return EXIT_SUCCESS;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]