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 */
@ -229,9 +231,9 @@ gnucash_command_line(int *argc, char **argv)
{"config-path", '\0', 0, G_OPTION_ARG_STRING, &config_path,
_("Set configuration path"),
/* Translators: Argument description for autohelp; see
http://developer.gnome.org/doc/API/2.0/glib/glib-Commandline-option-parser.html */
_("CONFIGPATH")},
/* Translators: Argument description for autohelp; see
http://developer.gnome.org/doc/API/2.0/glib/glib-Commandline-option-parser.html */
_("CONFIGPATH")},
{"share-path", '\0', 0, G_OPTION_ARG_STRING, &share_path,
_("Set shared data file search path"),
@ -268,10 +270,10 @@ gnucash_command_line(int *argc, char **argv)
}
g_option_context_free (context);
if (error)
g_error_free(error);
g_error_free(error);
if (*argc > 0)
file_to_load = argv[1];
file_to_load = argv[1];
if (gnucash_show_version) {
if (is_development_version)
@ -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

@ -2740,26 +2740,26 @@ gnc_main_window_setup_window (GncMainWindow *window)
priv->action_group = gtk_action_group_new ("MainWindowActions");
gnc_gtk_action_group_set_translation_domain (priv->action_group, GETTEXT_PACKAGE);
gtk_action_group_add_actions (priv->action_group, gnc_menu_actions,
gnc_menu_n_actions, window);
gnc_menu_n_actions, window);
gtk_action_group_add_toggle_actions (priv->action_group,
toggle_actions, n_toggle_actions,
window);
toggle_actions, n_toggle_actions,
window);
gtk_action_group_add_radio_actions (priv->action_group,
radio_entries, n_radio_entries,
0,
G_CALLBACK(gnc_main_window_cmd_window_raise),
window);
radio_entries, n_radio_entries,
0,
G_CALLBACK(gnc_main_window_cmd_window_raise),
window);
gnc_plugin_update_actions(priv->action_group,
initially_insensitive_actions,
"sensitive", FALSE);
initially_insensitive_actions,
"sensitive", FALSE);
gnc_plugin_update_actions(priv->action_group,
always_insensitive_actions,
"sensitive", FALSE);
always_insensitive_actions,
"sensitive", FALSE);
gnc_plugin_update_actions(priv->action_group,
always_hidden_actions,
"visible", FALSE);
always_hidden_actions,
"visible", FALSE);
gnc_plugin_set_important_actions (priv->action_group,
gnc_menu_important_actions);
gnc_menu_important_actions);
gtk_ui_manager_insert_action_group (window->ui_merge, priv->action_group, 0);
g_signal_connect (G_OBJECT (window->ui_merge), "add_widget",
@ -2767,7 +2767,7 @@ gnc_main_window_setup_window (GncMainWindow *window)
/* Use the "connect-proxy" signal for tooltip display in the
status bar */
g_signal_connect (G_OBJECT (window->ui_merge), "connect-proxy",
G_CALLBACK (connect_proxy), priv->statusbar);
G_CALLBACK (connect_proxy), priv->statusbar);
filename = gnc_gnome_locate_ui_file("gnc-main-window-ui.xml");
@ -2779,47 +2779,47 @@ gnc_main_window_setup_window (GncMainWindow *window)
g_assert(merge_id || error);
if (merge_id) {
gtk_window_add_accel_group (GTK_WINDOW (window),
gtk_ui_manager_get_accel_group(window->ui_merge));
gtk_ui_manager_get_accel_group(window->ui_merge));
gtk_ui_manager_ensure_update (window->ui_merge);
} else {
g_critical("Failed to load ui file.\n Filename %s\n Error %s",
filename, error->message);
filename, error->message);
g_error_free(error);
g_assert(merge_id != 0);
}
g_free(filename);
gnc_gconf_add_notification(G_OBJECT(window), GCONF_GENERAL,
gnc_main_window_gconf_changed,
GNC_MAIN_WINDOW_NAME);
gnc_main_window_gconf_changed,
GNC_MAIN_WINDOW_NAME);
gnc_gconf_add_notification(G_OBJECT(window), DESKTOP_GNOME_INTERFACE,
gnc_main_window_gconf_changed,
GNC_MAIN_WINDOW_NAME);
gnc_main_window_gconf_changed,
GNC_MAIN_WINDOW_NAME);
gnc_main_window_update_toolbar(window);
gnc_main_window_update_tab_position(window);
gnc_main_window_init_menu_updaters(window);
/* Testing */
/* 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,
"ExtensionsAction");
"ExtensionsAction");
gtk_action_set_visible(action, FALSE);
}
/* GncPluginManager stuff */
manager = gnc_plugin_manager_get ();
plugins = gnc_plugin_manager_get_plugins (manager);
g_list_foreach (plugins, gnc_main_window_add_plugin, window);
g_list_free (plugins);
g_list_foreach (plugins, gnc_main_window_add_plugin, window);
g_list_free (plugins);
g_signal_connect (G_OBJECT (manager), "plugin-added",
G_CALLBACK (gnc_main_window_plugin_added), window);
G_CALLBACK (gnc_main_window_plugin_added), window);
g_signal_connect (G_OBJECT (manager), "plugin-removed",
G_CALLBACK (gnc_main_window_plugin_removed), window);
G_CALLBACK (gnc_main_window_plugin_removed), window);
LEAVE(" ");
}