Update --extra and --debug as per discussion.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@15570 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Joshua Sled 2007-02-11 23:53:38 +00:00
parent 65c05daf58
commit 552bc61c8b
4 changed files with 71 additions and 42 deletions

View File

@ -195,7 +195,7 @@ static void
gnucash_command_line(int *argc, char **argv)
{
char *p;
int debugging = 0;
int debugging = 0, extra = 0;
char *namespace_regexp = NULL;
GError *error = NULL;
GOptionContext *context;
@ -204,20 +204,22 @@ gnucash_command_line(int *argc, char **argv)
_("Show GnuCash version"), NULL},
{"debug", '\0', 0, G_OPTION_ARG_NONE, &debugging,
_("Enable debugging mode"), NULL},
_("Enable debugging mode: increasing logging to provide deep detail."), NULL},
{"extra", '\0', 0, G_OPTION_ARG_NONE, &extra,
_("Enable extra/development/debugging features."), NULL},
{"log", '\0', 0, G_OPTION_ARG_STRING_ARRAY, &log_flags,
_("Log level overrides, of the form \"log.ger.path={debug,info,warn,crit,error}\""),
_("LOG")},
NULL},
{"logto", '\0', 0, G_OPTION_ARG_STRING, &log_to_filename,
_("File to log into; defaults to \"/tmp/gnucash.trace\"; can be \"stderr\" or \"stdout\"."),
_("LOGTO")},
NULL},
#if 0
{"loglevel", '\0', 0, G_OPTION_ARG_INT, &loglevel,
/* Translators: This is the command line option autohelp
text; see popt(3) */
/* Translators: This is the command line option autohelp text; see popt(3) */
_("Set the logging level from 0 (least) to 6 (most)"),
/* Translators: Argument description for autohelp; see
http://developer.gnome.org/doc/API/2.0/glib/glib-Commandline-option-parser.html */
@ -292,7 +294,10 @@ gnucash_command_line(int *argc, char **argv)
exit(0);
}
gnc_set_extra(extra);
gnc_set_debugging(debugging);
if (namespace_regexp)
gnc_main_set_namespace_regexp(namespace_regexp);
}
@ -448,8 +453,9 @@ inner_main (void *closure, int argc, char **argv)
gnc_file_open_file(fn);
g_free(fn);
}
else if (gnc_gconf_get_bool("dialogs/new_user", "first_startup", &error) &&
!error) {
else if (gnc_gconf_get_bool("dialogs/new_user", "first_startup", &error)
&& !error)
{
gnc_destroy_splash_screen();
gnc_ui_new_user_dialog();
}
@ -486,6 +492,13 @@ gnc_log_init()
gnc_log_default();
if (gnc_is_debugging())
{
qof_log_set_level("", QOF_LOG_INFO);
qof_log_set_level("qof", QOF_LOG_INFO);
qof_log_set_level("gnc", QOF_LOG_INFO);
}
if (log_flags != NULL)
{
int i = 0;

View File

@ -25,7 +25,8 @@
#include "gnc-main.h"
static gchar *namespace_regexp = NULL;
static gboolean is_debugging;
static gboolean is_debugging = 0;
static gboolean extras_enabled = 0;
void
gnc_main_set_namespace_regexp(const gchar *str)
@ -54,3 +55,15 @@ gnc_set_debugging(gboolean d)
{
is_debugging = d;
}
gboolean
gnc_is_extra_enabled(void)
{
return extras_enabled;
}
void
gnc_set_extra(gboolean enabled)
{
extras_enabled = enabled;
}

View File

@ -32,4 +32,7 @@ const gchar *gnc_main_get_namespace_regexp(void);
gboolean gnc_is_debugging(void);
void gnc_set_debugging(gboolean d);
gboolean gnc_is_extra_enabled(void);
void gnc_set_extra(gboolean enabled);
#endif /* GNC_MAIN_H */

View File

@ -2802,7 +2802,7 @@ gnc_main_window_setup_window (GncMainWindow *window)
/* Testing */
/* Now update the "eXtensions" menu */
if (!gnc_is_debugging()) {
if (!gnc_is_extra_enabled()) {
GtkAction* action;
action = gtk_action_group_get_action(priv->action_group,