[gnome-software] gs-popular-tile: Simplify some star ratings handling code
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] gs-popular-tile: Simplify some star ratings handling code
- Date: Wed, 4 Dec 2019 16:31:31 +0000 (UTC)
commit 6932a05d2ead3651bd548fbf054d6f5aaad6d066
Author: Philip Withnall <withnall endlessm com>
Date: Tue Dec 3 15:31:14 2019 +0000
gs-popular-tile: Simplify some star ratings handling code
This simplifies two similar branches of an if-statement. It also ensures
that if the `GsPopularTile` is updated with new app info, and the rating
has gone from ≥ 0 to unset, then the star rating is updated accordingly.
Signed-off-by: Philip Withnall <withnall endlessm com>
src/gs-popular-tile.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
---
diff --git a/src/gs-popular-tile.c b/src/gs-popular-tile.c
index 46212662..fc6218b9 100644
--- a/src/gs-popular-tile.c
+++ b/src/gs-popular-tile.c
@@ -67,13 +67,9 @@ gs_popular_tile_refresh (GsAppTile *self)
atk_object_set_description (accessible, gs_app_get_summary (app));
}
- if (gs_app_get_rating (app) >= 0) {
- gtk_widget_set_sensitive (tile->stars, TRUE);
- gs_star_widget_set_rating (GS_STAR_WIDGET (tile->stars),
- gs_app_get_rating (app));
- } else {
- gtk_widget_set_sensitive (tile->stars, FALSE);
- }
+ gtk_widget_set_sensitive (tile->stars, gs_app_get_rating (app) >= 0);
+ gs_star_widget_set_rating (GS_STAR_WIDGET (tile->stars),
+ gs_app_get_rating (app));
gtk_stack_set_visible_child_name (GTK_STACK (tile->stack), "content");
/* perhaps set custom css */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]