#include <gio/gio.h>

int
main (int argc, char *argv[])
{
	GDBusConnection *connection;
	GDBusMessage *message;
	GMainLoop *main_loop;
	GFile *file;
	gchar *uri;

	file = g_file_new_for_commandline_arg (argv[1]);

	connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
	main_loop = g_main_loop_new (NULL, FALSE);

	message = g_dbus_message_new_method_call ("org.freedesktop.Tracker1.Miner.Files",
	                                          "/org/freedesktop/Tracker1/Miner/Files/Index",
	                                          "org.freedesktop.Tracker1.Miner.Files.Index",
	                                          "IndexFile");

	uri = g_file_get_uri (file);
	g_dbus_message_set_body (message, g_variant_new ("(s)", uri));
	g_free (uri);

	g_dbus_connection_send_message (connection, message, 0, NULL, NULL);

	g_main_loop_run (main_loop);

	g_object_unref (file);

	return 0;
}
