[gnome-builder/wip/gtk4-port] plugins/symbol-tree: select-all in search entry upon focus



commit 9260f0d3204cfa4dd492a2055fe38b14c653458c
Author: Christian Hergert <chergert redhat com>
Date:   Wed Jun 1 13:11:48 2022 -0700

    plugins/symbol-tree: select-all in search entry upon focus
    
    To make this as predictable as possible each time we use it, just reselect
    all of the text upon focusing so that you can always "ctrl+shift+k type"
    to (re)filter the list.

 src/plugins/symbol-tree/gbp-symbol-popover.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/src/plugins/symbol-tree/gbp-symbol-popover.c b/src/plugins/symbol-tree/gbp-symbol-popover.c
index 9e91be418..87c231f37 100644
--- a/src/plugins/symbol-tree/gbp-symbol-popover.c
+++ b/src/plugins/symbol-tree/gbp-symbol-popover.c
@@ -145,7 +145,17 @@ gbp_symbol_popover_search_changed_cb (GbpSymbolPopover *self,
 static gboolean
 gbp_symbol_popover_grab_focus (GtkWidget *widget)
 {
-  return gtk_widget_grab_focus (GTK_WIDGET (GBP_SYMBOL_POPOVER (widget)->search_entry));
+  GbpSymbolPopover *self = (GbpSymbolPopover *)widget;
+  gboolean ret;
+
+  IDE_ENTRY;
+
+  g_assert (GBP_IS_SYMBOL_POPOVER (self));
+
+  ret = gtk_widget_grab_focus (GTK_WIDGET (self->search_entry));
+  gtk_editable_select_region (GTK_EDITABLE (self->search_entry), 0, -1);
+
+  IDE_RETURN (ret);
 }
 
 static gboolean


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