From 96cbfeab112fa68732acdb2d2eed528a2689a3a0 Mon Sep 17 00:00:00 2001 From: Chris Shoemaker Date: Wed, 25 Jan 2006 01:21:28 +0000 Subject: [PATCH] Process --debug command-line option from C instead of guile. This re-enables the debugging "extensions" menu. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@12974 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/bin/gnucash-bin.c | 4 +++- src/core-utils/gnc-main.c | 15 ++++++++++++++- src/core-utils/gnc-main.h | 2 ++ src/gnome-utils/gnc-main-window.c | 8 ++++---- 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/bin/gnucash-bin.c b/src/bin/gnucash-bin.c index b52a1353d4..91dca1a237 100644 --- a/src/bin/gnucash-bin.c +++ b/src/bin/gnucash-bin.c @@ -206,13 +206,14 @@ gnucash_command_line(int argc, char **argv) poptContext pc; char *p; int rc; + int debugging = 0; char *namespace_regexp = NULL; struct poptOption options[] = { POPT_AUTOHELP {"version", 'v', POPT_ARG_NONE, &gnucash_show_version, 1, _("Show GnuCash version"), NULL}, - {"debug", '\0', POPT_ARG_NONE, NULL, 0, + {"debug", '\0', POPT_ARG_NONE, &debugging, 0, _("Enable debugging mode"), NULL}, {"loglevel", '\0', POPT_ARG_INT, NULL, 0, _("Set the logging level from 0 (least) to 6 (most)"), @@ -250,6 +251,7 @@ gnucash_command_line(int argc, char **argv) exit(0); } + gnc_set_debugging(debugging); if (namespace_regexp) gnc_main_set_namespace_regexp(namespace_regexp); } diff --git a/src/core-utils/gnc-main.c b/src/core-utils/gnc-main.c index 9f810e4035..9ee7a474e1 100644 --- a/src/core-utils/gnc-main.c +++ b/src/core-utils/gnc-main.c @@ -25,6 +25,7 @@ #include "gnc-main.h" static char *namespace_regexp = NULL; +static int is_debugging; void gnc_main_set_namespace_regexp(const char *str) @@ -36,8 +37,20 @@ gnc_main_set_namespace_regexp(const char *str) namespace_regexp = g_strdup(str); } -const char *gnc_main_get_namespace_regexp(void) +const char * +gnc_main_get_namespace_regexp(void) { return namespace_regexp; } +int +gnc_is_debugging(void) +{ + return is_debugging; +} + +void +gnc_set_debugging(int d) +{ + is_debugging = d; +} diff --git a/src/core-utils/gnc-main.h b/src/core-utils/gnc-main.h index ef21dfeb78..bba8aa5e56 100644 --- a/src/core-utils/gnc-main.h +++ b/src/core-utils/gnc-main.h @@ -29,5 +29,7 @@ void gnc_main_set_namespace_regexp(const char *str); const char *gnc_main_get_namespace_regexp(void); +int gnc_is_debugging(void); +void gnc_set_debugging(int d); #endif /* GNC_MAIN_H */ diff --git a/src/gnome-utils/gnc-main-window.c b/src/gnome-utils/gnc-main-window.c index 0a23e8de64..672b95e11a 100644 --- a/src/gnome-utils/gnc-main-window.c +++ b/src/gnome-utils/gnc-main-window.c @@ -65,6 +65,7 @@ #include "gnc-ui.h" #include "gnc-version.h" #include "gnc-window.h" +#include "gnc-main.h" #include "gnc-gconf-utils.h" // +JSLED #include "gnc-html.h" @@ -2438,7 +2439,6 @@ gnc_main_window_setup_window (GncMainWindow *window) GList *plugins; GError *error = NULL; gchar *filename; - SCM debugging; ENTER(" "); @@ -2539,11 +2539,11 @@ gnc_main_window_setup_window (GncMainWindow *window) /* Testing */ /* Now update the "eXtensions" menu */ - debugging = scm_c_eval_string("(gnc:debugging?)"); - if (debugging == SCM_BOOL_F) { + if (!gnc_is_debugging()) { GtkAction* action; - action = gtk_action_group_get_action(priv->action_group,"ExtensionsAction"); + action = gtk_action_group_get_action(priv->action_group, + "ExtensionsAction"); g_object_set(G_OBJECT(action), "visible", FALSE, (char *)NULL); }