[gimp] app: add --show-debug-menu command-line option
- From: N/A <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: add --show-debug-menu command-line option
- Date: Thu, 29 Mar 2018 09:26:28 +0000 (UTC)
commit 53c145c0be4ad7ad52c3be40537b3032175f0856
Author: Ell <ell_se yahoo com>
Date: Thu Mar 29 05:20:20 2018 -0400
app: add --show-debug-menu command-line option
The debug menu is currently not included in stable versions.
Include the menu unconditionally, but hide it, and its associated
actions, by default in stable versions. Allow enabling the menu
using a new --show-debug-menu command-line option, in the same vein
as --show-playground.
app/actions/debug-actions.c | 16 ++++++++++------
app/actions/debug-commands.c | 5 -----
app/actions/debug-commands.h | 10 ----------
app/app.c | 2 ++
app/app.h | 1 +
app/core/gimp.c | 2 ++
app/core/gimp.h | 2 ++
app/main.c | 8 ++++++++
app/tests.c | 4 ++--
menus/image-menu.xml.in | 2 +-
menus/menus.xsl | 6 ------
11 files changed, 28 insertions(+), 30 deletions(-)
---
diff --git a/app/actions/debug-actions.c b/app/actions/debug-actions.c
index 5debf3b..79d5539 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 85de856..9e9a82c 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 42cb218..0504e20 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 7296b0b..06044a0 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 47d9ebf..4c5baec 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 ef3c933..8acf88a 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 289be8e..ad5d6e4 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 7c0bdac..60e846b 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
@@ -283,6 +285,11 @@ static const GOptionEntry main_entries[] =
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,
NULL, NULL
@@ -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 d822c30..bb52e38 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 77e4c33..47553b6 100644
--- a/menus/image-menu.xml.in
+++ b/menus/image-menu.xml.in
@@ -23,7 +23,7 @@
<menuitem action="dialogs-document-history" />
</menu>
-<!-- The debug-menu is automatically excluded for stable releases -->
+<!-- The debug-menu is hidden by default for stable releases -->
<menu action="debug-menu" name="Debug">
<menuitem action="debug-mem-profile" />
<menuitem action="debug-benchmark-projection" />
diff --git a/menus/menus.xsl b/menus/menus.xsl
index fdd65be..68495c7 100644
--- a/menus/menus.xsl
+++ b/menus/menus.xsl
@@ -38,12 +38,6 @@
<xsl:apply-templates />
</xsl:template>
- <xsl:template match="menu[@action='debug-menu']">
- <xsl:if test="$unstable-menus='yes'">
- <xsl:call-template name="identity" />
- </xsl:if>
- </xsl:template>
-
<!-- need to strip the XInclude namespace declaration from the ui element -->
<xsl:template match="ui">
<ui>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]