From b93402f70532d7aef7d2df15990c550670e4c3ff Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Sat, 28 Nov 2009 14:54:46 +0200 Subject: [PATCH] * remove the '--print' option; it's implicit --- src/mu-config.c | 3 --- src/mu-config.h | 4 ++-- src/mu-query.c | 33 ++++++++------------------------- 3 files changed, 10 insertions(+), 30 deletions(-) diff --git a/src/mu-config.c b/src/mu-config.c index 6c3954d2..e844e330 100644 --- a/src/mu-config.c +++ b/src/mu-config.c @@ -71,8 +71,6 @@ mu_config_options_group_query (MuConfigOptions *opts) { GOptionGroup *og; GOptionEntry entries[] = { - {"print", 'p', 0, G_OPTION_ARG_NONE, &opts->print, - "print matching messages to screen (default)", NULL}, {"xquery", 'x', 0, G_OPTION_ARG_NONE, &opts->xquery, "print a string representation of the Xapian query", NULL}, {"fields", 'f', 0, G_OPTION_ARG_STRING, &opts->fields, @@ -114,7 +112,6 @@ mu_config_set_defaults (MuConfigOptions *opts) opts->reindex = FALSE; /* querying */ - opts->print = TRUE; opts->xquery = FALSE; opts->fields = "d f s"; } diff --git a/src/mu-config.h b/src/mu-config.h index c1542879..ff8a42c8 100644 --- a/src/mu-config.h +++ b/src/mu-config.h @@ -38,8 +38,8 @@ struct _MuConfigOptions { gboolean reindex; /* re-index existing mails */ /* options for querying */ - gboolean print; /* do output */ - gboolean xquery; /* give the Xapian query (for debuging)*/ + gboolean xquery; /* give the Xapian query instead of + search results */ char *fields; /* fields to show in output */ char* sortfield_str; /* fields to sort by */ diff --git a/src/mu-query.c b/src/mu-query.c index ca7b88c8..481d6370 100644 --- a/src/mu-query.c +++ b/src/mu-query.c @@ -76,7 +76,7 @@ display_field (MuMsgXapian *row, const MuMsgField* field) static gboolean -handle_options_sort_field_dir (MuConfigOptions *opts) +handle_options (MuConfigOptions *opts) { const MuMsgField *field; @@ -102,26 +102,6 @@ handle_options_sort_field_dir (MuConfigOptions *opts) return TRUE; } -static gboolean -handle_options (MuConfigOptions *opts) -{ - /* if nothing specified, or fields are specified use print */ - if ((!opts->xquery)||opts->fields) - opts->print = TRUE; - - /* if no fields are specified, use 'd f s' */ - if (opts->print && !opts->fields) { - opts->fields = "d f s"; /* default: date-from-subject.. */ - if (!opts->ascending_flag) /* ... and sort descending */ - opts->sortdir_ascending = FALSE; - } - - if (!handle_options_sort_field_dir (opts)) - return FALSE; - - return TRUE; -} - static gboolean print_rows (MuQueryXapian *xapian, const gchar *query, MuConfigOptions *opts) @@ -137,7 +117,7 @@ print_rows (MuQueryXapian *xapian, const gchar *query, MuConfigOptions *opts) } while (!mu_msg_xapian_is_done (row)) { - const char* fields = opts->fields; + const char* fields = opts->fields; int printlen = 0; while (*fields) { const MuMsgField* field = @@ -168,13 +148,16 @@ do_output (MuQueryXapian *xapian, GSList *args, MuConfigOptions* opts) gboolean retval = TRUE; query = mu_query_xapian_combine (args, FALSE); - if (opts->xquery) + + /* if xquery is set, we print the xapian query instead of the + * output; this is for debugging purposes */ + if (opts->xquery) retval = print_query (xapian, query); - - if (retval && opts->print) + else retval = print_rows (xapian, query, opts); g_free (query); + return retval; }