[gnome-builder/wip/project-selector] project-selector: add file filters
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/project-selector] project-selector: add file filters
- Date: Fri, 3 Apr 2015 01:46:52 +0000 (UTC)
commit d0e783ecd81224e8ee67cd657e4b705fa755c551
Author: Christian Hergert <christian hergert me>
Date: Thu Apr 2 18:46:46 2015 -0700
project-selector: add file filters
data/ui/gb-new-project-dialog.ui | 2 +-
src/dialogs/gb-new-project-dialog.c | 34 ++++++++++++++++++++++++++++++++++
2 files changed, 35 insertions(+), 1 deletions(-)
---
diff --git a/data/ui/gb-new-project-dialog.ui b/data/ui/gb-new-project-dialog.ui
index e2d803c..8ae6ac0 100644
--- a/data/ui/gb-new-project-dialog.ui
+++ b/data/ui/gb-new-project-dialog.ui
@@ -273,7 +273,7 @@
</child>
<child>
<object class="GtkFileChooserWidget" id="file_chooser">
- <property name="action">select-folder</property>
+ <property name="action">open</property>
<property name="local-only">false</property>
<property name="visible">true</property>
<property name="width-request">800</property>
diff --git a/src/dialogs/gb-new-project-dialog.c b/src/dialogs/gb-new-project-dialog.c
index 95a4bc2..3f233b9 100644
--- a/src/dialogs/gb-new-project-dialog.c
+++ b/src/dialogs/gb-new-project-dialog.c
@@ -103,6 +103,32 @@ gb_new_project_dialog__stack_notify_visible_child (GbNewProjectDialog *self,
}
}
+static GList *
+gb_new_project_dialog_create_filters (GbNewProjectDialog *self)
+{
+ GtkFileFilter *filter;
+ GList *list = NULL;
+
+ /*
+ * TODO: These should come from extension points in libide.
+ */
+
+ g_assert (GB_IS_NEW_PROJECT_DIALOG (self));
+
+ /* autotools filter */
+ filter = gtk_file_filter_new ();
+ gtk_file_filter_set_name (filter, _("Autotools based 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_add_pattern (filter, "*");
+ list = g_list_append (list, filter);
+
+ return list;
+}
+
static void
gb_new_project_dialog_finalize (GObject *object)
{
@@ -165,8 +191,16 @@ gb_new_project_dialog_class_init (GbNewProjectDialogClass *klass)
static void
gb_new_project_dialog_init (GbNewProjectDialog *self)
{
+ GList *iter;
+ GList *filters;
+
gtk_widget_init_template (GTK_WIDGET (self));
+ filters = gb_new_project_dialog_create_filters (self);
+ for (iter = filters; iter; iter = iter->next)
+ gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (self->file_chooser), iter->data);
+ g_list_free (filters);
+
g_signal_connect_object (self->stack,
"notify::visible-child",
G_CALLBACK (gb_new_project_dialog__stack_notify_visible_child),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]