[gnome-software: 2/4] gs-details-page: Ensure the reviews box is hidden if empty
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software: 2/4] gs-details-page: Ensure the reviews box is hidden if empty
- Date: Thu, 12 Aug 2021 17:29:36 +0000 (UTC)
commit 0b55c9470a05fa691bc2e0da4d264783d8264690
Author: Philip Withnall <pwithnall endlessos org>
Date: Thu Aug 12 13:44:25 2021 +0100
gs-details-page: Ensure the reviews box is hidden if empty
It’s possible for all the children of the box to be hidden or empty for
various reasons. If so, hide the outer box, which ensures that the
‘Reviews’ header is hidden.
The `list_box_reviews` is never hidden, but can be empty, hence the
check for `reviews->len > 0`.
Signed-off-by: Philip Withnall <pwithnall endlessos org>
Fixes: #1376
src/gs-details-page.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/src/gs-details-page.c b/src/gs-details-page.c
index 810a2ec52..cdefe3c53 100644
--- a/src/gs-details-page.c
+++ b/src/gs-details-page.c
@@ -1342,7 +1342,6 @@ gs_details_page_refresh_reviews (GsDetailsPage *self)
/* enable appropriate widgets */
gtk_widget_set_visible (self->star, show_reviews);
- gtk_widget_set_visible (self->box_reviews, show_reviews);
gtk_widget_set_visible (self->histogram, review_ratings != NULL && review_ratings->len > 0);
gtk_widget_set_visible (self->label_review_count, n_reviews > 0);
@@ -1355,8 +1354,10 @@ gs_details_page_refresh_reviews (GsDetailsPage *self)
}
/* no point continuing */
- if (!show_reviews)
+ if (!show_reviews) {
+ gtk_widget_set_visible (self->box_reviews, FALSE);
return;
+ }
/* find what the plugins support */
for (i = 0; i < G_N_ELEMENTS (all_actions); i++) {
@@ -1411,6 +1412,14 @@ gs_details_page_refresh_reviews (GsDetailsPage *self)
/* TRANSLATORS: we need a remote server to process */
_("You need internet access to write a review"));
}
+
+ /* Update the overall container. */
+ gtk_widget_set_visible (self->box_reviews,
+ show_reviews &&
+ (gtk_widget_get_visible (self->histogram) ||
+ gtk_widget_get_visible (self->button_review) ||
+ reviews->len > 0 ||
+ gtk_widget_get_visible (self->button_more_reviews)));
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]