[gnome-software] Focus the search entry on keypress



commit 6a9b217852588482a6a16caf423a97c9795b2604
Author: Elad Alfassa <elad fedoraproject org>
Date:   Mon Sep 1 21:17:54 2014 +0300

    Focus the search entry on keypress
    
    And don't steal the focus from the entry when the results appear
    
    https://bugzilla.gnome.org/show_bug.cgi?id=735274

 src/gs-shell-search.c |    3 ---
 src/gs-shell.c        |    5 +++++
 2 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/src/gs-shell-search.c b/src/gs-shell-search.c
index f8df235..faa6878 100644
--- a/src/gs-shell-search.c
+++ b/src/gs-shell-search.c
@@ -357,9 +357,6 @@ gs_shell_search_switch_to (GsShellSearch *shell_search, const gchar *value, gboo
                 adj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW 
(priv->scrolledwindow_search));
                 gtk_adjustment_set_value (adj, gtk_adjustment_get_lower (adj));
         }
-        if (gs_shell_get_mode (priv->shell) == GS_SHELL_MODE_SEARCH) {
-                gs_grab_focus_when_mapped (priv->scrolledwindow_search);
-        }
 
        if (g_strcmp0 (value, priv->value) == 0)
                return;
diff --git a/src/gs-shell.c b/src/gs-shell.c
index 36fe874..a33e078 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -396,6 +396,11 @@ window_keypress_handler (GtkWidget *window, GdkEvent *event, GsShell *shell)
        g_free (old_text);
        g_free (new_text);
 
+       /* We set "editable" so the text in the  entry won't get selected on focus */
+       g_object_set (entry, "editable", FALSE, NULL);
+       gtk_widget_grab_focus (entry);
+       g_object_set (entry, "editable", TRUE, NULL);
+
        return handled;
 }
 


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