[gimp] app: add small hack to make the generic operation tool always invisible



commit 895c0f558f37f089fe6dda54adf74e564101525f
Author: Michael Natterer <mitch gimp org>
Date:   Thu Jan 4 19:23:39 2018 +0100

    app: add small hack to make the generic operation tool always invisible
    
    so it can't be added to the toolbox. It's entirely useless when
    activated on its own.

 app/core/gimptoolinfo.c |    2 +-
 app/core/gimptoolinfo.h |    1 +
 app/tools/gimp-tools.c  |    5 +++++
 3 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/app/core/gimptoolinfo.c b/app/core/gimptoolinfo.c
index aff4ee9..bde27ff 100644
--- a/app/core/gimptoolinfo.c
+++ b/app/core/gimptoolinfo.c
@@ -151,7 +151,7 @@ gimp_tool_info_set_property (GObject      *object,
   switch (property_id)
     {
     case PROP_VISIBLE:
-      tool_info->visible = g_value_get_boolean (value);
+      tool_info->visible = (g_value_get_boolean (value) && ! tool_info->hidden);
       break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
diff --git a/app/core/gimptoolinfo.h b/app/core/gimptoolinfo.h
index 167bdc8..b033296 100644
--- a/app/core/gimptoolinfo.h
+++ b/app/core/gimptoolinfo.h
@@ -51,6 +51,7 @@ struct _GimpToolInfo
   gchar               *help_domain;
   gchar               *help_id;
 
+  gboolean             hidden; /* can't be made visible */
   gboolean             visible;
   GimpToolOptions     *tool_options;
   GimpPaintInfo       *paint_info;
diff --git a/app/tools/gimp-tools.c b/app/tools/gimp-tools.c
index 58086b5..9b9c4d0 100644
--- a/app/tools/gimp-tools.c
+++ b/app/tools/gimp-tools.c
@@ -586,6 +586,11 @@ gimp_tools_register (GType                   tool_type,
   visible = (! g_type_is_a (tool_type, GIMP_TYPE_FILTER_TOOL));
 
   g_object_set (tool_info, "visible", visible, NULL);
+
+  /* hack to make the operation tools always invisible */
+  if (tool_type == GIMP_TYPE_OPERATION_TOOL)
+    tool_info->hidden = TRUE;
+
   g_object_set_data (G_OBJECT (tool_info), "gimp-tool-default-visible",
                      GINT_TO_POINTER (visible));
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]