[gnome-builder/wip/project-selector: 26/56] project-selector: handle activate manually



commit a6122c9c58e8727b8216051983ad43103d44db0d
Author: Christian Hergert <christian hergert me>
Date:   Thu Apr 2 16:53:43 2015 -0700

    project-selector: handle activate manually
    
    Apparently we can't setup activates-default and the listbox as the default.
    So we will just do the same manually in a callback.

 src/workbench/gb-project-window.c |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/src/workbench/gb-project-window.c b/src/workbench/gb-project-window.c
index 6bc7f77..11911e0 100644
--- a/src/workbench/gb-project-window.c
+++ b/src/workbench/gb-project-window.c
@@ -538,6 +538,26 @@ gb_project_window__cancel_button_clicked (GbProjectWindow *self,
 }
 
 static void
+gb_project_window__search_entry_activate (GbProjectWindow *self,
+                                          GtkEntry        *entry)
+{
+  GtkListBoxRow *row;
+
+  g_assert (GB_IS_PROJECT_WINDOW (self));
+  g_assert (GTK_IS_ENTRY (entry));
+
+  /* FIXME: We use 1 because 0 doesn't work and we have no API to get
+   *        the first row taking the sort/filter into account.
+   */
+  row = gtk_list_box_get_row_at_y (self->listbox, 1);
+
+  if (row != NULL)
+    {
+      g_signal_emit_by_name (row, "activate");
+    }
+}
+
+static void
 gb_project_window__search_entry_changed (GbProjectWindow *self,
                                          GtkEntry        *entry)
 {
@@ -577,6 +597,12 @@ gb_project_window_constructed (GObject *object)
                           G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
 
   g_signal_connect_object (self->search_entry,
+                           "activate",
+                           G_CALLBACK (gb_project_window__search_entry_activate),
+                           self,
+                           G_CONNECT_SWAPPED);
+
+  g_signal_connect_object (self->search_entry,
                            "changed",
                            G_CALLBACK (gb_project_window__search_entry_changed),
                            self,


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