[gnome-software] Keep focus widgets on screen



commit 997c6b5fa44835356b4b2aed0072c758005647b7
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Sep 17 19:54:36 2013 -0400

    Keep focus widgets on screen
    
    Use focus vadjustment functionality in GTK+ to ensure that all
    out scrolled windows keep the focus widget on screen.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=708183

 src/gs-shell-category.c |    6 ++++++
 src/gs-shell-overview.c |    7 +++++++
 2 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/src/gs-shell-category.c b/src/gs-shell-category.c
index c4345ec..cb3e834 100644
--- a/src/gs-shell-category.c
+++ b/src/gs-shell-category.c
@@ -334,6 +334,7 @@ gs_shell_category_setup (GsShellCategory *shell_category,
        GsShellCategoryPrivate *priv = shell_category->priv;
        GtkWidget *widget;
        GtkWidget *sw;
+       GtkAdjustment *adj;
 
        priv->plugin_loader = g_object_ref (plugin_loader);
        priv->builder = g_object_ref (builder);
@@ -348,6 +349,11 @@ gs_shell_category_setup (GsShellCategory *shell_category,
        widget = gtk_scrolled_window_get_vscrollbar (GTK_SCROLLED_WINDOW (sw));
        g_signal_connect (widget, "map", G_CALLBACK (scrollbar_mapped_cb), sw);
        g_signal_connect (widget, "unmap", G_CALLBACK (scrollbar_mapped_cb), sw);
+
+       sw = GTK_WIDGET (gtk_builder_get_object (priv->builder, "scrolledwindow_category"));
+       adj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (sw));
+       widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "category_detail_grid"));
+       gtk_container_set_focus_vadjustment (GTK_CONTAINER (widget), adj);
 }
 
 GsShellCategory *
diff --git a/src/gs-shell-overview.c b/src/gs-shell-overview.c
index 9e49f6d..cdd319d 100644
--- a/src/gs-shell-overview.c
+++ b/src/gs-shell-overview.c
@@ -282,6 +282,8 @@ gs_shell_overview_setup (GsShellOverview *shell_overview,
                         GCancellable *cancellable)
 {
        GsShellOverviewPrivate *priv = shell_overview->priv;
+       GtkWidget *sw, *widget;
+       GtkAdjustment *adj;
 
        g_return_if_fail (GS_IS_SHELL_OVERVIEW (shell_overview));
 
@@ -291,6 +293,11 @@ gs_shell_overview_setup (GsShellOverview *shell_overview,
 
        /* avoid a ref cycle */
        priv->shell = shell;
+
+       sw = GTK_WIDGET (gtk_builder_get_object (builder, "scrolledwindow_overview"));
+       adj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (sw));
+       widget = GTK_WIDGET (gtk_builder_get_object (builder, "box3"));
+       gtk_container_set_focus_vadjustment (GTK_CONTAINER (widget), adj);
 }
 
 static void


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