[gnome-builder/wip/gtk4-port] plugins/symbol-tree: activate search entry should activate row



commit d60845c8cf556216866758b34d44530d8919c96f
Author: Christian Hergert <chergert redhat com>
Date:   Fri May 13 08:23:26 2022 -0700

    plugins/symbol-tree: activate search entry should activate row

 src/plugins/symbol-tree/gbp-symbol-popover.c  | 14 ++++++++++++++
 src/plugins/symbol-tree/gbp-symbol-popover.ui |  1 +
 2 files changed, 15 insertions(+)
---
diff --git a/src/plugins/symbol-tree/gbp-symbol-popover.c b/src/plugins/symbol-tree/gbp-symbol-popover.c
index 205fd7057..e812685ab 100644
--- a/src/plugins/symbol-tree/gbp-symbol-popover.c
+++ b/src/plugins/symbol-tree/gbp-symbol-popover.c
@@ -110,6 +110,19 @@ gbp_symbol_popover_activate_cb (GbpSymbolPopover *self,
   IDE_EXIT;
 }
 
+static void
+gbp_symbol_popover_search_activate_cb (GbpSymbolPopover *self,
+                                       GtkSearchEntry   *search_entry)
+{
+  guint position;
+
+  g_assert (GBP_IS_SYMBOL_POPOVER (self));
+  g_assert (GTK_IS_SEARCH_ENTRY (search_entry));
+
+  if (ide_gtk_list_view_get_selected_row (self->list_view, &position))
+    gbp_symbol_popover_activate_cb (self, position, self->list_view);
+}
+
 static void
 gbp_symbol_popover_search_changed_cb (GbpSymbolPopover *self,
                                       GtkSearchEntry   *search_entry)
@@ -242,6 +255,7 @@ gbp_symbol_popover_class_init (GbpSymbolPopoverClass *klass)
   gtk_widget_class_bind_template_child (widget_class, GbpSymbolPopover, list_view);
   gtk_widget_class_bind_template_child (widget_class, GbpSymbolPopover, search_entry);
   gtk_widget_class_bind_template_callback (widget_class, gbp_symbol_popover_activate_cb);
+  gtk_widget_class_bind_template_callback (widget_class, gbp_symbol_popover_search_activate_cb);
   gtk_widget_class_bind_template_callback (widget_class, gbp_symbol_popover_search_changed_cb);
   gtk_widget_class_bind_template_callback (widget_class, on_search_key_pressed_cb);
 }
diff --git a/src/plugins/symbol-tree/gbp-symbol-popover.ui b/src/plugins/symbol-tree/gbp-symbol-popover.ui
index 18b862333..c99333589 100644
--- a/src/plugins/symbol-tree/gbp-symbol-popover.ui
+++ b/src/plugins/symbol-tree/gbp-symbol-popover.ui
@@ -35,6 +35,7 @@
         <child>
           <object class="GtkSearchEntry" id="search_entry">
             <property name="placeholder-text" translatable="yes">Filter Symbols…</property>
+            <signal name="activate" handler="gbp_symbol_popover_search_activate_cb" swapped="true" 
object="GbpSymbolPopover"/>
             <signal name="search-changed" handler="gbp_symbol_popover_search_changed_cb" swapped="true" 
object="GbpSymbolPopover"/>
             <child>
               <object class="GtkEventControllerKey">


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