mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
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:
parent
65c05daf58
commit
552bc61c8b
@ -195,7 +195,7 @@ static void
|
|||||||
gnucash_command_line(int *argc, char **argv)
|
gnucash_command_line(int *argc, char **argv)
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
int debugging = 0;
|
int debugging = 0, extra = 0;
|
||||||
char *namespace_regexp = NULL;
|
char *namespace_regexp = NULL;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
GOptionContext *context;
|
GOptionContext *context;
|
||||||
@ -204,20 +204,22 @@ gnucash_command_line(int *argc, char **argv)
|
|||||||
_("Show GnuCash version"), NULL},
|
_("Show GnuCash version"), NULL},
|
||||||
|
|
||||||
{"debug", '\0', 0, G_OPTION_ARG_NONE, &debugging,
|
{"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", '\0', 0, G_OPTION_ARG_STRING_ARRAY, &log_flags,
|
||||||
_("Log level overrides, of the form \"log.ger.path={debug,info,warn,crit,error}\""),
|
_("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,
|
{"logto", '\0', 0, G_OPTION_ARG_STRING, &log_to_filename,
|
||||||
_("File to log into; defaults to \"/tmp/gnucash.trace\"; can be \"stderr\" or \"stdout\"."),
|
_("File to log into; defaults to \"/tmp/gnucash.trace\"; can be \"stderr\" or \"stdout\"."),
|
||||||
_("LOGTO")},
|
NULL},
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
{"loglevel", '\0', 0, G_OPTION_ARG_INT, &loglevel,
|
{"loglevel", '\0', 0, G_OPTION_ARG_INT, &loglevel,
|
||||||
/* Translators: This is the command line option autohelp
|
/* Translators: This is the command line option autohelp text; see popt(3) */
|
||||||
text; see popt(3) */
|
|
||||||
_("Set the logging level from 0 (least) to 6 (most)"),
|
_("Set the logging level from 0 (least) to 6 (most)"),
|
||||||
/* Translators: Argument description for autohelp; see
|
/* Translators: Argument description for autohelp; see
|
||||||
http://developer.gnome.org/doc/API/2.0/glib/glib-Commandline-option-parser.html */
|
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,
|
{"config-path", '\0', 0, G_OPTION_ARG_STRING, &config_path,
|
||||||
_("Set configuration path"),
|
_("Set configuration path"),
|
||||||
/* Translators: Argument description for autohelp; see
|
/* Translators: Argument description for autohelp; see
|
||||||
http://developer.gnome.org/doc/API/2.0/glib/glib-Commandline-option-parser.html */
|
http://developer.gnome.org/doc/API/2.0/glib/glib-Commandline-option-parser.html */
|
||||||
_("CONFIGPATH")},
|
_("CONFIGPATH")},
|
||||||
|
|
||||||
{"share-path", '\0', 0, G_OPTION_ARG_STRING, &share_path,
|
{"share-path", '\0', 0, G_OPTION_ARG_STRING, &share_path,
|
||||||
_("Set shared data file search path"),
|
_("Set shared data file search path"),
|
||||||
@ -268,10 +270,10 @@ gnucash_command_line(int *argc, char **argv)
|
|||||||
}
|
}
|
||||||
g_option_context_free (context);
|
g_option_context_free (context);
|
||||||
if (error)
|
if (error)
|
||||||
g_error_free(error);
|
g_error_free(error);
|
||||||
|
|
||||||
if (*argc > 0)
|
if (*argc > 0)
|
||||||
file_to_load = argv[1];
|
file_to_load = argv[1];
|
||||||
|
|
||||||
if (gnucash_show_version) {
|
if (gnucash_show_version) {
|
||||||
if (is_development_version)
|
if (is_development_version)
|
||||||
@ -292,7 +294,10 @@ gnucash_command_line(int *argc, char **argv)
|
|||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gnc_set_extra(extra);
|
||||||
|
|
||||||
gnc_set_debugging(debugging);
|
gnc_set_debugging(debugging);
|
||||||
|
|
||||||
if (namespace_regexp)
|
if (namespace_regexp)
|
||||||
gnc_main_set_namespace_regexp(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);
|
gnc_file_open_file(fn);
|
||||||
g_free(fn);
|
g_free(fn);
|
||||||
}
|
}
|
||||||
else if (gnc_gconf_get_bool("dialogs/new_user", "first_startup", &error) &&
|
else if (gnc_gconf_get_bool("dialogs/new_user", "first_startup", &error)
|
||||||
!error) {
|
&& !error)
|
||||||
|
{
|
||||||
gnc_destroy_splash_screen();
|
gnc_destroy_splash_screen();
|
||||||
gnc_ui_new_user_dialog();
|
gnc_ui_new_user_dialog();
|
||||||
}
|
}
|
||||||
@ -486,6 +492,13 @@ gnc_log_init()
|
|||||||
|
|
||||||
gnc_log_default();
|
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)
|
if (log_flags != NULL)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
@ -25,7 +25,8 @@
|
|||||||
#include "gnc-main.h"
|
#include "gnc-main.h"
|
||||||
|
|
||||||
static gchar *namespace_regexp = NULL;
|
static gchar *namespace_regexp = NULL;
|
||||||
static gboolean is_debugging;
|
static gboolean is_debugging = 0;
|
||||||
|
static gboolean extras_enabled = 0;
|
||||||
|
|
||||||
void
|
void
|
||||||
gnc_main_set_namespace_regexp(const gchar *str)
|
gnc_main_set_namespace_regexp(const gchar *str)
|
||||||
@ -54,3 +55,15 @@ gnc_set_debugging(gboolean d)
|
|||||||
{
|
{
|
||||||
is_debugging = d;
|
is_debugging = d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
gnc_is_extra_enabled(void)
|
||||||
|
{
|
||||||
|
return extras_enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gnc_set_extra(gboolean enabled)
|
||||||
|
{
|
||||||
|
extras_enabled = enabled;
|
||||||
|
}
|
||||||
|
@ -32,4 +32,7 @@ const gchar *gnc_main_get_namespace_regexp(void);
|
|||||||
gboolean gnc_is_debugging(void);
|
gboolean gnc_is_debugging(void);
|
||||||
void gnc_set_debugging(gboolean d);
|
void gnc_set_debugging(gboolean d);
|
||||||
|
|
||||||
|
gboolean gnc_is_extra_enabled(void);
|
||||||
|
void gnc_set_extra(gboolean enabled);
|
||||||
|
|
||||||
#endif /* GNC_MAIN_H */
|
#endif /* GNC_MAIN_H */
|
||||||
|
@ -2740,26 +2740,26 @@ gnc_main_window_setup_window (GncMainWindow *window)
|
|||||||
priv->action_group = gtk_action_group_new ("MainWindowActions");
|
priv->action_group = gtk_action_group_new ("MainWindowActions");
|
||||||
gnc_gtk_action_group_set_translation_domain (priv->action_group, GETTEXT_PACKAGE);
|
gnc_gtk_action_group_set_translation_domain (priv->action_group, GETTEXT_PACKAGE);
|
||||||
gtk_action_group_add_actions (priv->action_group, gnc_menu_actions,
|
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,
|
gtk_action_group_add_toggle_actions (priv->action_group,
|
||||||
toggle_actions, n_toggle_actions,
|
toggle_actions, n_toggle_actions,
|
||||||
window);
|
window);
|
||||||
gtk_action_group_add_radio_actions (priv->action_group,
|
gtk_action_group_add_radio_actions (priv->action_group,
|
||||||
radio_entries, n_radio_entries,
|
radio_entries, n_radio_entries,
|
||||||
0,
|
0,
|
||||||
G_CALLBACK(gnc_main_window_cmd_window_raise),
|
G_CALLBACK(gnc_main_window_cmd_window_raise),
|
||||||
window);
|
window);
|
||||||
gnc_plugin_update_actions(priv->action_group,
|
gnc_plugin_update_actions(priv->action_group,
|
||||||
initially_insensitive_actions,
|
initially_insensitive_actions,
|
||||||
"sensitive", FALSE);
|
"sensitive", FALSE);
|
||||||
gnc_plugin_update_actions(priv->action_group,
|
gnc_plugin_update_actions(priv->action_group,
|
||||||
always_insensitive_actions,
|
always_insensitive_actions,
|
||||||
"sensitive", FALSE);
|
"sensitive", FALSE);
|
||||||
gnc_plugin_update_actions(priv->action_group,
|
gnc_plugin_update_actions(priv->action_group,
|
||||||
always_hidden_actions,
|
always_hidden_actions,
|
||||||
"visible", FALSE);
|
"visible", FALSE);
|
||||||
gnc_plugin_set_important_actions (priv->action_group,
|
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);
|
gtk_ui_manager_insert_action_group (window->ui_merge, priv->action_group, 0);
|
||||||
|
|
||||||
g_signal_connect (G_OBJECT (window->ui_merge), "add_widget",
|
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
|
/* Use the "connect-proxy" signal for tooltip display in the
|
||||||
status bar */
|
status bar */
|
||||||
g_signal_connect (G_OBJECT (window->ui_merge), "connect-proxy",
|
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");
|
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);
|
g_assert(merge_id || error);
|
||||||
if (merge_id) {
|
if (merge_id) {
|
||||||
gtk_window_add_accel_group (GTK_WINDOW (window),
|
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);
|
gtk_ui_manager_ensure_update (window->ui_merge);
|
||||||
} else {
|
} else {
|
||||||
g_critical("Failed to load ui file.\n Filename %s\n Error %s",
|
g_critical("Failed to load ui file.\n Filename %s\n Error %s",
|
||||||
filename, error->message);
|
filename, error->message);
|
||||||
g_error_free(error);
|
g_error_free(error);
|
||||||
g_assert(merge_id != 0);
|
g_assert(merge_id != 0);
|
||||||
}
|
}
|
||||||
g_free(filename);
|
g_free(filename);
|
||||||
|
|
||||||
gnc_gconf_add_notification(G_OBJECT(window), GCONF_GENERAL,
|
gnc_gconf_add_notification(G_OBJECT(window), GCONF_GENERAL,
|
||||||
gnc_main_window_gconf_changed,
|
gnc_main_window_gconf_changed,
|
||||||
GNC_MAIN_WINDOW_NAME);
|
GNC_MAIN_WINDOW_NAME);
|
||||||
gnc_gconf_add_notification(G_OBJECT(window), DESKTOP_GNOME_INTERFACE,
|
gnc_gconf_add_notification(G_OBJECT(window), DESKTOP_GNOME_INTERFACE,
|
||||||
gnc_main_window_gconf_changed,
|
gnc_main_window_gconf_changed,
|
||||||
GNC_MAIN_WINDOW_NAME);
|
GNC_MAIN_WINDOW_NAME);
|
||||||
gnc_main_window_update_toolbar(window);
|
gnc_main_window_update_toolbar(window);
|
||||||
gnc_main_window_update_tab_position(window);
|
gnc_main_window_update_tab_position(window);
|
||||||
|
|
||||||
gnc_main_window_init_menu_updaters(window);
|
gnc_main_window_init_menu_updaters(window);
|
||||||
|
|
||||||
/* Testing */
|
/* Testing */
|
||||||
/* Now update the "eXtensions" menu */
|
/* Now update the "eXtensions" menu */
|
||||||
if (!gnc_is_debugging()) {
|
if (!gnc_is_extra_enabled()) {
|
||||||
GtkAction* action;
|
GtkAction* action;
|
||||||
|
|
||||||
action = gtk_action_group_get_action(priv->action_group,
|
action = gtk_action_group_get_action(priv->action_group,
|
||||||
"ExtensionsAction");
|
"ExtensionsAction");
|
||||||
gtk_action_set_visible(action, FALSE);
|
gtk_action_set_visible(action, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* GncPluginManager stuff */
|
/* GncPluginManager stuff */
|
||||||
manager = gnc_plugin_manager_get ();
|
manager = gnc_plugin_manager_get ();
|
||||||
plugins = gnc_plugin_manager_get_plugins (manager);
|
plugins = gnc_plugin_manager_get_plugins (manager);
|
||||||
g_list_foreach (plugins, gnc_main_window_add_plugin, window);
|
g_list_foreach (plugins, gnc_main_window_add_plugin, window);
|
||||||
g_list_free (plugins);
|
g_list_free (plugins);
|
||||||
|
|
||||||
g_signal_connect (G_OBJECT (manager), "plugin-added",
|
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_signal_connect (G_OBJECT (manager), "plugin-removed",
|
||||||
G_CALLBACK (gnc_main_window_plugin_removed), window);
|
G_CALLBACK (gnc_main_window_plugin_removed), window);
|
||||||
|
|
||||||
LEAVE(" ");
|
LEAVE(" ");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user