[gnome-software] gs-app-row: Remove app ratings from the installed and updates pages



commit 5a2293434522582aee0ac51c95daa4193e536ed8
Author: Philip Withnall <withnall endlessm com>
Date:   Thu Jun 27 17:46:27 2019 +0100

    gs-app-row: Remove app ratings from the installed and updates pages
    
    Ratings are only useful when deciding whether to initially install an
    app. On the installed apps and updates pages, they are just clutter.
    
    Optionally remove them in `GsAppRow`, but keep them for search results,
    since they’re useful there.
    
    Signed-off-by: Philip Withnall <withnall endlessm com>

 src/gs-app-row.c     | 12 +++++++++++-
 src/gs-app-row.h     |  2 ++
 src/gs-search-page.c |  1 +
 3 files changed, 14 insertions(+), 1 deletion(-)
---
diff --git a/src/gs-app-row.c b/src/gs-app-row.c
index d114e2dd..5296fd62 100644
--- a/src/gs-app-row.c
+++ b/src/gs-app-row.c
@@ -43,6 +43,7 @@ typedef struct
        gboolean         colorful;
        gboolean         show_folders;
        gboolean         show_buttons;
+       gboolean         show_rating;
        gboolean         show_source;
        gboolean         show_update;
        gboolean         show_installed_size;
@@ -361,7 +362,7 @@ gs_app_row_refresh (GsAppRow *app_row)
                gtk_widget_hide (priv->star);
        } else {
                gtk_widget_hide (priv->version_box);
-               if (missing_search_result || gs_app_get_rating (priv->app) <= 0) {
+               if (missing_search_result || gs_app_get_rating (priv->app) <= 0 || !priv->show_rating) {
                        gtk_widget_hide (priv->star);
                } else {
                        gtk_widget_show (priv->star);
@@ -756,6 +757,15 @@ gs_app_row_set_show_buttons (GsAppRow *app_row, gboolean show_buttons)
        gs_app_row_refresh (app_row);
 }
 
+void
+gs_app_row_set_show_rating (GsAppRow *app_row, gboolean show_rating)
+{
+       GsAppRowPrivate *priv = gs_app_row_get_instance_private (app_row);
+
+       priv->show_rating = show_rating;
+       gs_app_row_refresh (app_row);
+}
+
 void
 gs_app_row_set_show_source (GsAppRow *app_row, gboolean show_source)
 {
diff --git a/src/gs-app-row.h b/src/gs-app-row.h
index d374b45b..886958fe 100644
--- a/src/gs-app-row.h
+++ b/src/gs-app-row.h
@@ -34,6 +34,8 @@ void           gs_app_row_set_show_folders            (GsAppRow       *app_row,
                                                         gboolean        show_folders);
 void            gs_app_row_set_show_buttons            (GsAppRow       *app_row,
                                                         gboolean        show_buttons);
+void            gs_app_row_set_show_rating             (GsAppRow       *app_row,
+                                                        gboolean        show_rating);
 void            gs_app_row_set_show_source             (GsAppRow       *app_row,
                                                         gboolean        show_source);
 void            gs_app_row_set_show_update             (GsAppRow       *app_row,
diff --git a/src/gs-search-page.c b/src/gs-search-page.c
index 1eb04021..9d70c49c 100644
--- a/src/gs-search-page.c
+++ b/src/gs-search-page.c
@@ -118,6 +118,7 @@ gs_search_page_get_search_cb (GObject *source_object,
        for (i = 0; i < gs_app_list_length (list); i++) {
                app = gs_app_list_index (list, i);
                app_row = gs_app_row_new (app);
+               gs_app_row_set_show_rating (app_row, TRUE);
                g_signal_connect (app_row, "button-clicked",
                                  G_CALLBACK (gs_search_page_app_row_clicked_cb),
                                  self);


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