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



commit 06b914bcb25451249b71fa470825aef0bd15991f
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]