[gnome-builder/wip/project-selector] project-selector: handle double click/enter in filechooserwidget



commit 2ae5bcd292ba4082625e7758097ebe54d908cdb4
Author: Christian Hergert <christian hergert me>
Date:   Thu Apr 2 20:41:05 2015 -0700

    project-selector: handle double click/enter in filechooserwidget

 src/dialogs/gb-new-project-dialog.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/src/dialogs/gb-new-project-dialog.c b/src/dialogs/gb-new-project-dialog.c
index bf68fed..64284cc 100644
--- a/src/dialogs/gb-new-project-dialog.c
+++ b/src/dialogs/gb-new-project-dialog.c
@@ -189,6 +189,20 @@ gb_new_project_dialog__file_chooser_selection_changed (GbNewProjectDialog *self,
 }
 
 static void
+gb_new_project_dialog__file_chooser_file_activated (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);
+  if (file != NULL)
+    g_signal_emit (self, gSignals [OPEN_PROJECT], 0, file);
+}
+
+static void
 gb_new_project_dialog_close (GbNewProjectDialog *self)
 {
   g_assert (GB_IS_NEW_PROJECT_DIALOG (self));
@@ -344,5 +358,11 @@ gb_new_project_dialog_init (GbNewProjectDialog *self)
                            self,
                            G_CONNECT_SWAPPED);
 
+  g_signal_connect_object (self->file_chooser,
+                           "file-activated",
+                           G_CALLBACK (gb_new_project_dialog__file_chooser_file_activated),
+                           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]