diff --git a/app/actions/debug-actions.c b/app/actions/debug-actions.c index 5debf3b04b..79d5539c2a 100644 --- a/app/actions/debug-actions.c +++ b/app/actions/debug-actions.c @@ -32,8 +32,6 @@ #include "debug-commands.h" -#ifdef ENABLE_DEBUG_MENU - static const GimpActionEntry debug_actions[] = { { "debug-menu", NULL, "_Debug" }, @@ -78,16 +76,22 @@ static const GimpActionEntry debug_actions[] = NULL } }; -#endif - void debug_actions_setup (GimpActionGroup *group) { -#ifdef ENABLE_DEBUG_MENU + gint i; + gimp_action_group_add_actions (group, NULL, debug_actions, G_N_ELEMENTS (debug_actions)); -#endif + +#define SET_VISIBLE(action,condition) \ + gimp_action_group_set_action_visible (group, action, (condition) != 0) + + for (i = 0; i < G_N_ELEMENTS (debug_actions); i++) + SET_VISIBLE (debug_actions[i].name, group->gimp->show_debug_menu); + +#undef SET_VISIBLE } void diff --git a/app/actions/debug-commands.c b/app/actions/debug-commands.c index 85de856d70..9e9a82c0e3 100644 --- a/app/actions/debug-commands.c +++ b/app/actions/debug-commands.c @@ -49,8 +49,6 @@ #include "debug-commands.h" -#ifdef ENABLE_DEBUG_MENU - /* local function prototypes */ static gboolean debug_benchmark_projection (GimpDisplay *display); @@ -425,6 +423,3 @@ debug_accel_find_func (GtkAccelKey *key, { return (GClosure *) data == closure; } - - -#endif /* ENABLE_DEBUG_MENU */ diff --git a/app/actions/debug-commands.h b/app/actions/debug-commands.h index 42cb218ef6..0504e20d08 100644 --- a/app/actions/debug-commands.h +++ b/app/actions/debug-commands.h @@ -19,13 +19,6 @@ #define __DEBUG_COMMANDS_H__ -#ifdef GIMP_UNSTABLE -#define ENABLE_DEBUG_MENU 1 -#endif - - -#ifdef ENABLE_DEBUG_MENU - void debug_mem_profile_cmd_callback (GtkAction *action, gpointer data); void debug_benchmark_projection_cmd_callback (GtkAction *action, @@ -43,7 +36,4 @@ void debug_dump_attached_data_cmd_callback (GtkAction *action, void debug_benchmark_projection_cmd_callback (GtkAction *action, gpointer data); -#endif /* ENABLE_DEBUG_MENU */ - - #endif /* __DEBUG_COMMANDS_H__ */ diff --git a/app/app.c b/app/app.c index 7296b0b3c5..06044a0a4d 100644 --- a/app/app.c +++ b/app/app.c @@ -176,6 +176,7 @@ app_run (const gchar *full_prog_name, gboolean console_messages, gboolean use_debug_handler, gboolean show_playground, + gboolean show_debug_menu, GimpStackTraceMode stack_trace_mode, GimpPDBCompatMode pdb_compat_mode, const gchar *backtrace_file) @@ -244,6 +245,7 @@ app_run (const gchar *full_prog_name, use_cpu_accel, console_messages, show_playground, + show_debug_menu, stack_trace_mode, pdb_compat_mode); diff --git a/app/app.h b/app/app.h index 47d9ebf6a0..4c5baecf0c 100644 --- a/app/app.h +++ b/app/app.h @@ -48,6 +48,7 @@ void app_run (const gchar *full_prog_name, gboolean console_messages, gboolean use_debug_handler, gboolean show_playground, + gboolean show_debug_menu, GimpStackTraceMode stack_trace_mode, GimpPDBCompatMode pdb_compat_mode, const gchar *backtrace_file); diff --git a/app/core/gimp.c b/app/core/gimp.c index ef3c9333dc..8acf88a898 100644 --- a/app/core/gimp.c +++ b/app/core/gimp.c @@ -576,6 +576,7 @@ gimp_new (const gchar *name, gboolean use_cpu_accel, gboolean console_messages, gboolean show_playground, + gboolean show_debug_menu, GimpStackTraceMode stack_trace_mode, GimpPDBCompatMode pdb_compat_mode) { @@ -599,6 +600,7 @@ gimp_new (const gchar *name, gimp->use_cpu_accel = use_cpu_accel ? TRUE : FALSE; gimp->console_messages = console_messages ? TRUE : FALSE; gimp->show_playground = show_playground ? TRUE : FALSE; + gimp->show_debug_menu = show_debug_menu ? TRUE : FALSE; gimp->stack_trace_mode = stack_trace_mode; gimp->pdb_compat_mode = pdb_compat_mode; diff --git a/app/core/gimp.h b/app/core/gimp.h index 289be8e064..ad5d6e464c 100644 --- a/app/core/gimp.h +++ b/app/core/gimp.h @@ -53,6 +53,7 @@ struct _Gimp GimpMessageHandlerType message_handler; gboolean console_messages; gboolean show_playground; + gboolean show_debug_menu; GimpStackTraceMode stack_trace_mode; GimpPDBCompatMode pdb_compat_mode; @@ -161,6 +162,7 @@ Gimp * gimp_new (const gchar *name, gboolean use_cpu_accel, gboolean console_messages, gboolean show_playground, + gboolean show_debug_menu, GimpStackTraceMode stack_trace_mode, GimpPDBCompatMode pdb_compat_mode); void gimp_set_show_gui (Gimp *gimp, diff --git a/app/main.c b/app/main.c index 7c0bdac73d..60e846b4e0 100644 --- a/app/main.c +++ b/app/main.c @@ -139,10 +139,12 @@ static gboolean use_debug_handler = FALSE; #ifdef GIMP_UNSTABLE static gboolean show_playground = TRUE; +static gboolean show_debug_menu = TRUE; static GimpStackTraceMode stack_trace_mode = GIMP_STACK_TRACE_QUERY; static GimpPDBCompatMode pdb_compat_mode = GIMP_PDB_COMPAT_WARN; #else static gboolean show_playground = FALSE; +static gboolean show_debug_menu = FALSE; static GimpStackTraceMode stack_trace_mode = GIMP_STACK_TRACE_NEVER; static GimpPDBCompatMode pdb_compat_mode = GIMP_PDB_COMPAT_ON; #endif @@ -282,6 +284,11 @@ static const GOptionEntry main_entries[] = G_OPTION_ARG_NONE, &show_playground, N_("Show a preferences page with experimental features"), NULL }, + { + "show-debug-menu", 0, G_OPTION_FLAG_HIDDEN, + G_OPTION_ARG_NONE, &show_debug_menu, + N_("Show an image submenu with debug actions"), NULL + }, { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &filenames, @@ -532,6 +539,7 @@ main (int argc, console_messages, use_debug_handler, show_playground, + show_debug_menu, stack_trace_mode, pdb_compat_mode, backtrace_file); diff --git a/app/tests.c b/app/tests.c index d822c30fc5..bb52e380cd 100644 --- a/app/tests.c +++ b/app/tests.c @@ -65,7 +65,7 @@ gimp_init_for_testing (void) gegl_init (NULL, NULL); gimp = gimp_new ("Unit Tested GIMP", NULL, NULL, FALSE, TRUE, TRUE, TRUE, - FALSE, FALSE, TRUE, FALSE, + FALSE, FALSE, TRUE, FALSE, FALSE, GIMP_STACK_TRACE_QUERY, GIMP_PDB_COMPAT_OFF); gimp_load_config (gimp, NULL, NULL); @@ -119,7 +119,7 @@ gimp_init_for_gui_testing_internal (gboolean show_gui, /* from app_run() */ gimp = gimp_new ("Unit Tested GIMP", NULL, NULL, FALSE, TRUE, TRUE, !show_gui, - FALSE, FALSE, TRUE, FALSE, + FALSE, FALSE, TRUE, FALSE, FALSE, GIMP_STACK_TRACE_QUERY, GIMP_PDB_COMPAT_OFF); gimp_set_show_gui (gimp, show_gui); diff --git a/menus/image-menu.xml.in b/menus/image-menu.xml.in index 77e4c337ea..47553b66ef 100644 --- a/menus/image-menu.xml.in +++ b/menus/image-menu.xml.in @@ -23,7 +23,7 @@ - +