[gnome-terminal] search: Make sure to focus the search dialogue
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-terminal] search: Make sure to focus the search dialogue
- Date: Sat, 26 Dec 2020 12:43:16 +0000 (UTC)
commit 8d2ea58d6049aba02448b622b6ad2b97919ad9f8
Author: Christian Persch <chpe src gnome org>
Date: Sat Dec 26 13:42:56 2020 +0100
search: Make sure to focus the search dialogue
... when it already exists; and move focus to the search entry.
Fixes: https://gitlab.gnome.org/GNOME/gnome-terminal/-/issues/294
src/terminal-search-popover.c | 11 +++++++++++
src/terminal-window.c | 6 ++++--
2 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/src/terminal-search-popover.c b/src/terminal-search-popover.c
index 174f81c8..ff18f49b 100644
--- a/src/terminal-search-popover.c
+++ b/src/terminal-search-popover.c
@@ -343,6 +343,15 @@ wrap_around_toggled_cb (GtkToggleButton *button,
/* Class implementation */
+static void
+terminal_search_popover_grab_focus (GtkWidget *widget)
+{
+ TerminalSearchPopover *popover = TERMINAL_SEARCH_POPOVER (widget);
+ TerminalSearchPopoverPrivate *priv = PRIV (popover);
+
+ gtk_widget_grab_focus (priv->search_entry);
+}
+
static void
terminal_search_popover_init (TerminalSearchPopover *popover)
{
@@ -485,6 +494,8 @@ terminal_search_popover_class_init (TerminalSearchPopoverClass *klass)
gobject_class->get_property = terminal_search_popover_get_property;
gobject_class->set_property = terminal_search_popover_set_property;
+ widget_class->grab_focus = terminal_search_popover_grab_focus;
+
signals[SEARCH] =
g_signal_new (I_("search"),
G_OBJECT_CLASS_TYPE (gobject_class),
diff --git a/src/terminal-window.c b/src/terminal-window.c
index 0bed828e..4a90bbd3 100644
--- a/src/terminal-window.c
+++ b/src/terminal-window.c
@@ -1150,7 +1150,8 @@ action_find_cb (GSimpleAction *action,
search_popover_notify_regex_cb (priv->search_popover, NULL, window);
search_popover_notify_wrap_around_cb (priv->search_popover, NULL, window);
- gtk_widget_show (GTK_WIDGET (priv->search_popover));
+ gtk_window_present (GTK_WINDOW (priv->search_popover));
+ gtk_widget_grab_focus (GTK_WIDGET (priv->search_popover));
return;
}
@@ -1169,7 +1170,8 @@ action_find_cb (GSimpleAction *action,
g_signal_connect (priv->search_popover, "destroy", G_CALLBACK (gtk_widget_destroyed),
&priv->search_popover);
- gtk_widget_show (GTK_WIDGET (priv->search_popover));
+ gtk_window_present (GTK_WINDOW (priv->search_popover));
+ gtk_widget_grab_focus (GTK_WIDGET (priv->search_popover));
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]