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




commit a6927a03e48ddb5a0e2e78c9cd39a21125425aac
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]