* mu-config.c: cosmetics

This commit is contained in:
Dirk-Jan C. Binnema 2010-12-07 23:17:05 +02:00
parent 373973d813
commit b7e3786af7
1 changed files with 217 additions and 249 deletions

View File

@ -27,8 +27,7 @@
#include "mu-util.h" #include "mu-util.h"
#include "mu-config.h" #include "mu-config.h"
static void static void set_group_mu_defaults(MuConfigOptions * opts)
set_group_mu_defaults (MuConfigOptions *opts)
{ {
gchar *exp; gchar *exp;
@ -42,9 +41,7 @@ set_group_mu_defaults (MuConfigOptions *opts)
} }
} }
static GOptionGroup *config_options_group_mu(MuConfigOptions * opts)
static GOptionGroup*
config_options_group_mu (MuConfigOptions *opts)
{ {
GOptionGroup *og; GOptionGroup *og;
GOptionEntry entries[] = { GOptionEntry entries[] = {
@ -63,16 +60,13 @@ config_options_group_mu (MuConfigOptions *opts)
{NULL, 0, 0, 0, NULL, NULL, NULL} {NULL, 0, 0, 0, NULL, NULL, NULL}
}; };
og = g_option_group_new ("mu", "general mu options", og = g_option_group_new("mu", "general mu options", "", NULL, NULL);
"", NULL, NULL);
g_option_group_add_entries(og, entries); g_option_group_add_entries(og, entries);
return og; return og;
} }
static void set_group_index_defaults(MuConfigOptions * opts)
static void
set_group_index_defaults (MuConfigOptions *opts)
{ {
gchar *exp; gchar *exp;
@ -86,10 +80,7 @@ set_group_index_defaults (MuConfigOptions *opts)
} }
} }
static GOptionGroup *config_options_group_index(MuConfigOptions * opts)
static GOptionGroup*
config_options_group_index (MuConfigOptions *opts)
{ {
GOptionGroup *og; GOptionGroup *og;
GOptionEntry entries[] = { GOptionEntry entries[] = {
@ -100,7 +91,8 @@ config_options_group_index (MuConfigOptions *opts)
{"rebuild", 0, 0, G_OPTION_ARG_NONE, &opts->rebuild, {"rebuild", 0, 0, G_OPTION_ARG_NONE, &opts->rebuild,
"rebuild the database from scratch", NULL}, "rebuild the database from scratch", NULL},
{"autoupgrade", 0, 0, G_OPTION_ARG_NONE, &opts->autoupgrade, {"autoupgrade", 0, 0, G_OPTION_ARG_NONE, &opts->autoupgrade,
"automatically upgrade the database with new mu versions", NULL}, "automatically upgrade the database with new mu versions",
NULL},
{"nocleanup", 0, 0, G_OPTION_ARG_NONE, &opts->nocleanup, {"nocleanup", 0, 0, G_OPTION_ARG_NONE, &opts->nocleanup,
"don't clean up the database after indexing", NULL}, "don't clean up the database after indexing", NULL},
{NULL, 0, 0, 0, NULL, NULL, NULL} {NULL, 0, 0, 0, NULL, NULL, NULL}
@ -114,9 +106,7 @@ config_options_group_index (MuConfigOptions *opts)
return og; return og;
} }
static void set_group_find_defaults(MuConfigOptions * opts)
static void
set_group_find_defaults (MuConfigOptions *opts)
{ {
/* note, when no fields are specified, we use /* note, when no fields are specified, we use
* date-from-subject, and sort descending by date. If fields * date-from-subject, and sort descending by date. If fields
@ -143,9 +133,7 @@ set_group_find_defaults (MuConfigOptions *opts)
opts->summary_len = 0; opts->summary_len = 0;
} }
static GOptionGroup *config_options_group_find(MuConfigOptions * opts)
static GOptionGroup*
config_options_group_find (MuConfigOptions *opts)
{ {
GOptionGroup *og; GOptionGroup *og;
GOptionEntry entries[] = { GOptionEntry entries[] = {
@ -176,10 +164,7 @@ config_options_group_find (MuConfigOptions *opts)
return og; return og;
} }
static GOptionGroup *config_options_group_mkdir(MuConfigOptions * opts)
static GOptionGroup*
config_options_group_mkdir (MuConfigOptions *opts)
{ {
GOptionGroup *og; GOptionGroup *og;
GOptionEntry entries[] = { GOptionEntry entries[] = {
@ -199,9 +184,7 @@ config_options_group_mkdir (MuConfigOptions *opts)
return og; return og;
} }
static GOptionGroup *config_options_group_extract(MuConfigOptions * opts)
static GOptionGroup*
config_options_group_extract (MuConfigOptions *opts)
{ {
GOptionGroup *og; GOptionGroup *og;
GOptionEntry entries[] = { GOptionEntry entries[] = {
@ -229,12 +212,7 @@ config_options_group_extract (MuConfigOptions *opts)
return og; return og;
} }
static gboolean parse_params(MuConfigOptions * opts, int *argcp, char ***argvp)
static gboolean
parse_params (MuConfigOptions *opts, int *argcp, char ***argvp)
{ {
GError *err; GError *err;
GOptionContext *context; GOptionContext *context;
@ -242,16 +220,11 @@ parse_params (MuConfigOptions *opts, int *argcp, char ***argvp)
context = g_option_context_new("- mu general option"); context = g_option_context_new("- mu general option");
g_option_context_set_main_group (context, g_option_context_set_main_group(context, config_options_group_mu(opts));
config_options_group_mu (opts)); g_option_context_add_group(context, config_options_group_index(opts));
g_option_context_add_group (context, g_option_context_add_group(context, config_options_group_find(opts));
config_options_group_index (opts)); g_option_context_add_group(context, config_options_group_mkdir(opts));
g_option_context_add_group (context, g_option_context_add_group(context, config_options_group_extract(opts));
config_options_group_find (opts));
g_option_context_add_group (context,
config_options_group_mkdir (opts));
g_option_context_add_group (context,
config_options_group_extract (opts));
err = NULL; err = NULL;
rv = g_option_context_parse(context, argcp, argvp, &err); rv = g_option_context_parse(context, argcp, argvp, &err);
@ -271,9 +244,7 @@ parse_params (MuConfigOptions *opts, int *argcp, char ***argvp)
return rv; return rv;
} }
gboolean mu_config_init(MuConfigOptions * opts, int *argcp, char ***argvp)
gboolean
mu_config_init (MuConfigOptions *opts, int *argcp, char ***argvp)
{ {
g_return_val_if_fail(opts, FALSE); g_return_val_if_fail(opts, FALSE);
memset(opts, 0, sizeof(MuConfigOptions)); memset(opts, 0, sizeof(MuConfigOptions));
@ -287,8 +258,7 @@ mu_config_init (MuConfigOptions *opts, int *argcp, char ***argvp)
return TRUE; return TRUE;
} }
void void mu_config_uninit(MuConfigOptions * opts)
mu_config_uninit (MuConfigOptions *opts)
{ {
g_return_if_fail(opts); g_return_if_fail(opts);
@ -299,5 +269,3 @@ mu_config_uninit (MuConfigOptions *opts)
g_strfreev(opts->params); g_strfreev(opts->params);
} }