[gnome-software: 1/3] details-page: Let the histogram row handle the visibility
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software: 1/3] details-page: Let the histogram row handle the visibility
- Date: Mon, 22 Aug 2022 15:24:34 +0000 (UTC)
commit aee04c7154030d2ab49dd42f54e1af088ea3c846
Author: Adrien Plazas <kekun plazas laposte net>
Date: Mon Aug 22 15:31:39 2022 +0200
details-page: Let the histogram row handle the visibility
This makes the code simpler, easier to understand.
src/gs-details-page.c | 6 ++++--
src/gs-details-page.ui | 5 ++---
2 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/src/gs-details-page.c b/src/gs-details-page.c
index f30c0670c..fd0084782 100644
--- a/src/gs-details-page.c
+++ b/src/gs-details-page.c
@@ -140,6 +140,7 @@ struct _GsDetailsPage
GtkWidget *box_reviews;
GtkWidget *box_reviews_internal;
GtkWidget *histogram;
+ GtkWidget *histogram_row;
GtkWidget *button_review;
GtkWidget *scrolledwindow_details;
GtkWidget *spinner_details;
@@ -1499,7 +1500,7 @@ gs_details_page_refresh_reviews (GsDetailsPage *self)
/* enable appropriate widgets */
gtk_widget_set_visible (self->star, show_reviews);
- gtk_widget_set_visible (self->histogram, review_ratings != NULL && review_ratings->len > 0);
+ gtk_widget_set_visible (self->histogram_row, review_ratings != NULL && review_ratings->len > 0);
gtk_widget_set_visible (self->label_review_count, n_reviews > 0);
/* update the review label next to the star widget */
@@ -1559,7 +1560,7 @@ gs_details_page_refresh_reviews (GsDetailsPage *self)
/* Update the overall container. */
gtk_widget_set_visible (self->box_reviews,
show_reviews &&
- (gtk_widget_get_visible (self->histogram) ||
+ (gtk_widget_get_visible (self->histogram_row) ||
gtk_widget_get_visible (self->button_review) ||
reviews->len > 0));
}
@@ -2453,6 +2454,7 @@ gs_details_page_class_init (GsDetailsPageClass *klass)
gtk_widget_class_bind_template_child (widget_class, GsDetailsPage, box_reviews);
gtk_widget_class_bind_template_child (widget_class, GsDetailsPage, box_reviews_internal);
gtk_widget_class_bind_template_child (widget_class, GsDetailsPage, histogram);
+ gtk_widget_class_bind_template_child (widget_class, GsDetailsPage, histogram_row);
gtk_widget_class_bind_template_child (widget_class, GsDetailsPage, button_review);
gtk_widget_class_bind_template_child (widget_class, GsDetailsPage, scrolledwindow_details);
gtk_widget_class_bind_template_child (widget_class, GsDetailsPage, spinner_details);
diff --git a/src/gs-details-page.ui b/src/gs-details-page.ui
index fffe7e069..a8adc469e 100644
--- a/src/gs-details-page.ui
+++ b/src/gs-details-page.ui
@@ -873,12 +873,11 @@
<class name="boxed-list"/>
</style>
<child>
- <object class="GtkListBoxRow">
+ <object class="GtkListBoxRow" id="histogram_row">
<property name="activatable">False</property>
- <property name="visible" bind-source="histogram"
bind-property="visible" bind-flags="sync-create"/>
+ <property name="visible">False</property>
<child>
<object class="GsReviewHistogram" id="histogram">
- <property name="visible">False</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="width-request">350</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]