void
tracker_control_general_run_default (void)
{
	/* Enable list processes in the default run */
	list_processes = TRUE;

	tracker_control_general_run ();
}
Esempio n. 2
0
int
main (int argc, char **argv)
{
    GOptionContext *context;

    g_type_init();

    setlocale (LC_ALL, "");

    bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
    bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
    textdomain (GETTEXT_PACKAGE);

    /* Translators: this messagge will apper immediately after the  */
    /* usage string - Usage: COMMAND [OPTION]... <THIS_MESSAGE>     */
    context = g_option_context_new (_(" - Manage Tracker processes and data"));

    /* Groups */
    g_option_context_add_group (context,
                                tracker_control_general_get_option_group ());
    g_option_context_add_group (context,
                                tracker_control_status_get_option_group ());
    g_option_context_add_group (context,
                                tracker_control_miners_get_option_group ());
    /* Common options */
    g_option_context_add_main_entries (context, common_entries, NULL);

    g_option_context_parse (context, &argc, &argv, NULL);
    g_option_context_free (context);

    if (print_version) {
        g_print ("\n" ABOUT "\n" LICENSE "\n");
        return EXIT_SUCCESS;
    }

    /* General options? */
    if (tracker_control_general_options_enabled ()) {
        if (tracker_control_status_options_enabled ()) {
            g_printerr ("%s\n",
                        _("General and Status options cannot be used together"));
            return EXIT_FAILURE;
        }

        if (tracker_control_miners_options_enabled ()) {
            g_printerr ("%s\n",
                        _("General and Miners options cannot be used together"));
            return EXIT_FAILURE;
        }

        return tracker_control_general_run ();
    }

    /* Status options? */
    if (tracker_control_status_options_enabled ()) {
        if (tracker_control_miners_options_enabled ()) {
            g_printerr ("%s\n",
                        _("Status and Miners options cannot be used together"));
            return EXIT_FAILURE;
        }

        return tracker_control_status_run ();
    }

    /* Miners options? */
    if (tracker_control_miners_options_enabled ()) {
        return tracker_control_miners_run ();
    }

    /* Unknown options? */
    if (argc > 1) {
        gint i = 1;

        g_printerr ("%s: ",
                    _("Unrecognized options"));
        for (i = 1; i < argc; i++) {
            g_printerr ("'%s'%s",
                        argv[i],
                        i == (argc - 1) ? "\n" : ", ");
        }
        return EXIT_FAILURE;
    }

    /* No-args output */
    tracker_control_general_run_default ();
    printf ("\n");

    tracker_control_status_run_default ();
    printf ("\n");

    tracker_control_miners_run_default ();

    return EXIT_SUCCESS;
}