[gnome-software] Improve back button behaviour
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Improve back button behaviour
- Date: Fri, 20 Sep 2013 21:39:10 +0000 (UTC)
commit ce2bdd002bf9919fb884f34abc0574a67ae50e39
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Sep 20 17:38:12 2013 -0400
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
src/gs-shell.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/src/gs-shell.c b/src/gs-shell.c
index d3b2586..ed0f285 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]