[gnome-builder] create-project: require 3-part application id



commit 466c7d97bac3dc602a2c995c448202b3ccd3bcc0
Author: Christian Hergert <chergert redhat com>
Date:   Fri Aug 30 14:16:39 2019 -0700

    create-project: require 3-part application id
    
    This is necessary for practical applications or we can't bundle them
    with systems such as Flatpak.
    
    Fixes #1011

 src/plugins/create-project/gbp-create-project-surface.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
---
diff --git a/src/plugins/create-project/gbp-create-project-surface.c 
b/src/plugins/create-project/gbp-create-project-surface.c
index 3d8377efd..da0647bf5 100644
--- a/src/plugins/create-project/gbp-create-project-surface.c
+++ b/src/plugins/create-project/gbp-create-project-surface.c
@@ -250,6 +250,16 @@ gbp_create_project_surface_name_changed (GbpCreateProjectSurface *self,
   g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_IS_READY]);
 }
 
+static guint
+count_chars (const gchar *str,
+             gunichar     ch)
+{
+  guint count = 0;
+  for (; *str; str = g_utf8_next_char (str))
+    count += *str == ch;
+  return count;
+}
+
 static void
 gbp_create_project_surface_app_id_changed (GbpCreateProjectSurface *self,
                                           GtkEntry               *entry)
@@ -261,7 +271,8 @@ gbp_create_project_surface_app_id_changed (GbpCreateProjectSurface *self,
 
   app_id = gtk_entry_get_text (entry);
 
-  if (!(ide_str_empty0 (app_id) || g_application_id_is_valid (app_id)))
+  if (!(ide_str_empty0 (app_id) ||
+        (g_application_id_is_valid (app_id) && count_chars (app_id, '.') >= 2)))
     {
       g_object_set (self->app_id_entry,
                     "secondary-icon-name", "dialog-warning-symbolic",


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