[gnome-software] gs-details-page: Reset star rating when loading an unrated app



commit 211e62e83e5015bfeabb8320402a760a3b664079
Author: Philip Withnall <withnall endlessm com>
Date:   Tue Dec 3 15:32:29 2019 +0000

    gs-details-page: Reset star rating when loading an unrated app
    
    Previously, if the details page was loaded for an app with some ratings
    (so an app rating of 0/5 to 5/5), and then loaded for an app with no
    ratings (an unset app rating of -1/5), the ratings widget would continue
    to show the app rating from the first app.
    
    Fix that by unconditionally updating the widget, and marking it as
    insensitive if the current app’s rating is unset.
    
    Signed-off-by: Philip Withnall <withnall endlessm com>

 src/gs-details-page.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/src/gs-details-page.c b/src/gs-details-page.c
index 217e4fed..d2d9255e 100644
--- a/src/gs-details-page.c
+++ b/src/gs-details-page.c
@@ -1558,10 +1558,10 @@ gs_details_page_refresh_reviews (GsDetailsPage *self)
 
        /* set the star rating */
        if (show_reviews) {
-               if (gs_app_get_rating (self->app) >= 0) {
-                       gs_star_widget_set_rating (GS_STAR_WIDGET (self->star),
-                                                  gs_app_get_rating (self->app));
-               }
+               gtk_widget_set_sensitive (self->star, gs_app_get_rating (self->app) >= 0);
+               gs_star_widget_set_rating (GS_STAR_WIDGET (self->star),
+                                          gs_app_get_rating (self->app));
+
                review_ratings = gs_app_get_review_ratings (self->app);
                if (review_ratings != NULL) {
                        gs_review_histogram_set_ratings (GS_REVIEW_HISTOGRAM (self->histogram),


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