[gnome-builder/wip/project-selector: 30/57] project-selector: open file tweaks



commit 8b5bd4202fb1d5addbc4ca50176a05b79316be31
Author: Christian Hergert <christian hergert me>
Date:   Thu Apr 2 18:57:50 2015 -0700

    project-selector: open file tweaks

 src/dialogs/gb-new-project-dialog.c |   24 ++++++++++++++++++++++--
 1 files changed, 22 insertions(+), 2 deletions(-)
---
diff --git a/src/dialogs/gb-new-project-dialog.c b/src/dialogs/gb-new-project-dialog.c
index 3f233b9..f90628c 100644
--- a/src/dialogs/gb-new-project-dialog.c
+++ b/src/dialogs/gb-new-project-dialog.c
@@ -117,12 +117,12 @@ gb_new_project_dialog_create_filters (GbNewProjectDialog *self)
 
   /* autotools filter */
   filter = gtk_file_filter_new ();
-  gtk_file_filter_set_name (filter, _("Autotools based Project (configure.ac)"));
+  gtk_file_filter_set_name (filter, _("Autotools Project (configure.ac)"));
   gtk_file_filter_add_pattern (filter, "configure.ac");
   list = g_list_append (list, filter);
 
   filter = gtk_file_filter_new ();
-  gtk_file_filter_set_name (filter, _("Directory based Project"));
+  gtk_file_filter_set_name (filter, _("Any Directory"));
   gtk_file_filter_add_pattern (filter, "*");
   list = g_list_append (list, filter);
 
@@ -130,6 +130,20 @@ gb_new_project_dialog_create_filters (GbNewProjectDialog *self)
 }
 
 static void
+gb_new_project_dialog__file_chooser_selection_changed (GbNewProjectDialog *self,
+                                                       GtkFileChooser     *file_chooser)
+{
+  g_autoptr(GFile) file = NULL;
+
+  g_assert (GB_IS_NEW_PROJECT_DIALOG (self));
+  g_assert (GTK_IS_FILE_CHOOSER (file_chooser));
+
+  file = gtk_file_chooser_get_file (file_chooser);
+
+  gtk_widget_set_sensitive (GTK_WIDGET (self->create_button), !!file);
+}
+
+static void
 gb_new_project_dialog_finalize (GObject *object)
 {
   GbNewProjectDialog *self = (GbNewProjectDialog *)object;
@@ -225,5 +239,11 @@ gb_new_project_dialog_init (GbNewProjectDialog *self)
                            self,
                            G_CONNECT_SWAPPED);
 
+  g_signal_connect_object (self->file_chooser,
+                           "selection-changed",
+                           G_CALLBACK (gb_new_project_dialog__file_chooser_selection_changed),
+                           self,
+                           G_CONNECT_SWAPPED);
+
   g_object_notify (G_OBJECT (self->stack), "visible-child");
 }


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