[gimp] app: fix generated tool-enums.c and deactivate Paint Select tool…



commit 9f6fbe8aca486d0889fe21c1b070fcdb81012870
Author: Jehan <jehan girinstud io>
Date:   Tue Nov 24 21:26:04 2020 +0100

    app: fix generated tool-enums.c and deactivate Paint Select tool…
    
    … checkbox in Preferences when GEGL operation "gegl:paint-select" is
    missing.
    
    Otherwise the tool won't appear and you don't understand why.

 app/dialogs/preferences-dialog.c | 12 ++++++++++++
 app/tools/tools-enums.c          | 14 +++++++++++++-
 2 files changed, 25 insertions(+), 1 deletion(-)
---
diff --git a/app/dialogs/preferences-dialog.c b/app/dialogs/preferences-dialog.c
index 8187be7825..75e986f396 100644
--- a/app/dialogs/preferences-dialog.c
+++ b/app/dialogs/preferences-dialog.c
@@ -1651,6 +1651,18 @@ prefs_dialog_new (Gimp       *gimp,
       button = prefs_check_button_add (object, "playground-paint-select-tool",
                                        _("_Paint Select tool"),
                                        GTK_BOX (vbox2));
+      if (! gegl_has_operation ("gegl:paint-select"))
+        {
+          gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), FALSE);
+          gtk_widget_set_sensitive (button, FALSE);
+          /* The tooltip is not translated on purpose. By the time it
+           * hits stable release, I sure hope this won't be considered
+           * an optional operation anymore. The info is still useful for
+           * dev-release testers, but no need to bother translators with
+           * a temporary string otherwise.
+           */
+          gimp_help_set_help_data (button, "Missing GEGL operation 'gegl:paint-select'.", NULL);
+        }
     }
 
 
diff --git a/app/tools/tools-enums.c b/app/tools/tools-enums.c
index ee695858b8..e2a3b4070f 100644
--- a/app/tools/tools-enums.c
+++ b/app/tools/tools-enums.c
@@ -352,7 +352,19 @@ gimp_paint_select_mode_get_type (void)
     { GIMP_PAINT_SELECT_MODE_ADD, NC_("paint-select-mode", "Add to selection"), NULL },
     { GIMP_PAINT_SELECT_MODE_SUBTRACT, NC_("paint-select-mode", "Subtract from selection"), NULL },
     { 0, NULL, NULL }
-};
+  };
+
+  static GType type = 0;
+
+  if (G_UNLIKELY (! type))
+    {
+      type = g_enum_register_static ("GimpPaintSelectMode", values);
+      gimp_type_set_translation_context (type, "paint-select-mode");
+      gimp_enum_set_value_descriptions (type, descs);
+    }
+
+  return type;
+}
 
 
 /* Generated data ends here */


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