[gnome-software] Scroll the category view to the top when viewing a new category



commit 8bbcbf5fda2df000867ee24ee7f0ed3f5076242e
Author: Joaquim Rocha <jrocha endlessm com>
Date:   Wed Nov 15 17:44:42 2017 +0100

    Scroll the category view to the top when viewing a new category
    
    Otherwise it will keep the scroll value previously set, i.e. if we the
    category view to the scroll to the bottom and then change to a different
    category, it would still show the view scrolled to the bottom.

 src/gs-category-page.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/src/gs-category-page.c b/src/gs-category-page.c
index b28ed9d..beea2ed 100644
--- a/src/gs-category-page.c
+++ b/src/gs-category-page.c
@@ -473,6 +473,8 @@ gs_category_page_create_filter (GsCategoryPage *self,
 void
 gs_category_page_set_category (GsCategoryPage *self, GsCategory *category)
 {
+       GtkAdjustment *adj = NULL;
+
        /* this means we've come from the app-view -> back */
        if (self->category == category)
                return;
@@ -483,6 +485,11 @@ gs_category_page_set_category (GsCategoryPage *self, GsCategory *category)
 
        /* find apps in this group */
        gs_category_page_create_filter (self, category);
+
+       /* scroll the list of apps to the beginning, otherwise it will show
+        * with the previous scroll value */
+       adj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (self->scrolledwindow_category));
+       gtk_adjustment_set_value (adj, gtk_adjustment_get_lower (adj));
 }
 
 GsCategory *


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