[gnome-builder/wip/project-selector: 45/66] libide: give warning about invalid URI in uri entry



commit 114542c53dc1f058f119ebabff750de645257ed3
Author: Christian Hergert <christian hergert me>
Date:   Fri Apr 3 19:09:38 2015 -0700

    libide: give warning about invalid URI in uri entry

 src/dialogs/gb-new-project-dialog.c |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/src/dialogs/gb-new-project-dialog.c b/src/dialogs/gb-new-project-dialog.c
index dc83b2d..a4957b6 100644
--- a/src/dialogs/gb-new-project-dialog.c
+++ b/src/dialogs/gb-new-project-dialog.c
@@ -453,15 +453,28 @@ gb_new_project_dialog__clone_uri_entry_changed (GbNewProjectDialog *self,
                                                 GtkEntry           *entry)
 {
   const gchar *text;
-  gboolean sensitive;
+  gboolean is_valid;
 
   g_assert (GB_IS_NEW_PROJECT_DIALOG (self));
   g_assert (GTK_IS_ENTRY (entry));
 
   text = gtk_entry_get_text (entry);
-  sensitive = !gb_str_empty0 (text);
+  is_valid = ide_vcs_uri_is_valid (text);
 
-  gtk_widget_set_sensitive (GTK_WIDGET (self->create_button), sensitive);
+  gtk_widget_set_sensitive (GTK_WIDGET (self->create_button), is_valid);
+
+  if (is_valid)
+    {
+      g_object_set (self->clone_uri_entry,
+                    "secondary-icon-name", NULL,
+                    NULL);
+    }
+  else
+    {
+      g_object_set (self->clone_uri_entry,
+                    "secondary-icon-name", "dialog-warning-symbolic",
+                    NULL);
+    }
 }
 
 static void


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