[gnome-builder/wip/gtk4-port] plugins/meson-templates: move "test" check to template



commit 8f27b2d6d65d7e248dc6016f6373124d7f831924
Author: Christian Hergert <chergert redhat com>
Date:   Fri May 27 14:25:39 2022 -0700

    plugins/meson-templates: move "test" check to template

 src/libide/projects/ide-project-template.c     | 4 ----
 src/plugins/meson-templates/meson_templates.py | 6 ++++++
 2 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/src/libide/projects/ide-project-template.c b/src/libide/projects/ide-project-template.c
index cfee83989..85e6a6ac1 100644
--- a/src/libide/projects/ide-project-template.c
+++ b/src/libide/projects/ide-project-template.c
@@ -48,10 +48,6 @@ ide_project_template_real_validate_name (IdeProjectTemplate *self,
   if (g_unichar_isdigit (g_utf8_get_char (name)))
     return FALSE;
 
-  /* TODO: Move this check to Meson template subclass */
-  if (ide_str_equal0 (name, "test"))
-    return FALSE;
-
   for (const char *c = name; *c; c = g_utf8_next_char (c))
     {
       gunichar ch = g_utf8_get_char (c);
diff --git a/src/plugins/meson-templates/meson_templates.py b/src/plugins/meson-templates/meson_templates.py
index 118a29b68..1097da146 100644
--- a/src/plugins/meson-templates/meson_templates.py
+++ b/src/plugins/meson-templates/meson_templates.py
@@ -95,6 +95,12 @@ class MesonTemplate(Ide.ProjectTemplate):
     def do_get_priority(self):
         return self.priority
 
+    def do_validate_name(self, name):
+        # meson reserves the name 'test'
+        if name == 'test':
+            return False
+        return super().do_validate_name(name)
+
     def do_expand_async(self, params, cancellable, callback, data):
         self.reset()
 


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