[tepl] GotoLineBar: grab focus to the TeplView when bar explicitly hidden



commit 660d7fae3a8cb17d2b3792364adb389521e34cf8
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Wed May 6 18:54:27 2020 +0200

    GotoLineBar: grab focus to the TeplView when bar explicitly hidden

 tepl/tepl-goto-line-bar.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/tepl/tepl-goto-line-bar.c b/tepl/tepl-goto-line-bar.c
index a69b46c..f5aefd1 100644
--- a/tepl/tepl-goto-line-bar.c
+++ b/tepl/tepl-goto-line-bar.c
@@ -58,6 +58,17 @@ tepl_goto_line_bar_class_init (TeplGotoLineBarClass *klass)
        object_class->dispose = tepl_goto_line_bar_dispose;
 }
 
+static void
+hide_bar_by_explicit_user_action (TeplGotoLineBar *bar)
+{
+       gtk_widget_hide (GTK_WIDGET (bar));
+
+       if (bar->priv->view != NULL)
+       {
+               gtk_widget_grab_focus (GTK_WIDGET (bar->priv->view));
+       }
+}
+
 static void
 set_success (GtkEntry *entry,
             gboolean  success)
@@ -114,7 +125,7 @@ static void
 entry_activate_cb (GtkEntry        *entry,
                   TeplGotoLineBar *bar)
 {
-       gtk_widget_hide (GTK_WIDGET (bar));
+       hide_bar_by_explicit_user_action (bar);
 }
 
 static void
@@ -141,7 +152,7 @@ static void
 close_button_clicked_cb (GtkButton       *close_button,
                         TeplGotoLineBar *bar)
 {
-       gtk_widget_hide (GTK_WIDGET (bar));
+       hide_bar_by_explicit_user_action (bar);
 }
 
 static void


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