[gnome-software/wip/rancell/reviews] trivial: Only show review count label if have reviews
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/wip/rancell/reviews] trivial: Only show review count label if have reviews
- Date: Wed, 10 Feb 2016 01:30:03 +0000 (UTC)
commit 6db08263a7a2e33c30d85467ccfb39f6afb95cfe
Author: Robert Ancell <robert ancell canonical com>
Date: Wed Feb 10 14:29:47 2016 +1300
trivial: Only show review count label if have reviews
src/gs-shell-details.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/src/gs-shell-details.c b/src/gs-shell-details.c
index 0affa83..c7c5aba 100644
--- a/src/gs-shell-details.c
+++ b/src/gs-shell-details.c
@@ -580,6 +580,7 @@ gs_shell_details_refresh_all (GsShellDetails *self)
{
GPtrArray *history;
GArray *review_ratings;
+ gint n_reviews;
GdkPixbuf *pixbuf = NULL;
GList *addons;
GtkWidget *widget;
@@ -745,11 +746,8 @@ gs_shell_details_refresh_all (GsShellDetails *self)
} else {
gtk_widget_set_visible (self->histogram, FALSE);
}
+ n_reviews = 0;
if (review_ratings != NULL || gs_app_get_reviews (self->app) != NULL) {
- g_autofree gchar *text = NULL;
- gint n_reviews = 0;
-
- gtk_widget_set_visible (self->label_review_count, TRUE);
if (review_ratings != NULL) {
guint i;
for (i = 0; i < review_ratings->len; i++)
@@ -757,6 +755,10 @@ gs_shell_details_refresh_all (GsShellDetails *self)
} else {
n_reviews = gs_app_get_reviews (self->app)->len;
}
+ }
+ if (n_reviews > 0) {
+ g_autofree gchar *text = NULL;
+ gtk_widget_set_visible (self->label_review_count, TRUE);
text = g_strdup_printf ("(%u)", n_reviews);
gtk_label_set_text (GTK_LABEL (self->label_review_count), text);
} else {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]