Commit ce2bdd00 authored by Matthias Clasen's avatar Matthias Clasen
Browse files

Improve back button behaviour

Maintain the previous focus when coming back via the back
button. Keyboard users all over the world love it.

https://bugzilla.gnome.org/show_bug.cgi?id=708492
parent 1b54d48b
......@@ -39,6 +39,7 @@ static void gs_shell_finalize (GObject *object);
typedef struct {
GsShellMode mode;
GtkWidget *focus;
GsApp *app;
GsCategory *category;
} BackEntry;
......@@ -183,6 +184,7 @@ save_back_entry (GsShell *shell)
{
GsShellPrivate *priv = shell->priv;
BackEntry *entry;
GtkWidget *window;
entry = g_new0 (BackEntry, 1);
entry->mode = priv->mode;
......@@ -196,6 +198,9 @@ save_back_entry (GsShell *shell)
g_object_ref (entry->app);
}
window = GTK_WIDGET (gtk_builder_get_object (priv->builder, "window_software"));
entry->focus = gtk_window_get_focus (GTK_WINDOW (window));
priv->back_entry_stack = g_slist_prepend (priv->back_entry_stack, entry);
}
......@@ -222,6 +227,10 @@ gs_shell_back_button_cb (GtkWidget *widget, GsShell *shell)
gs_shell_change_mode (shell, entry->mode, entry->app, entry->category, FALSE);
if (entry->focus) {
gtk_widget_grab_focus (entry->focus);
}
free_back_entry (entry);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment