[gnome-software] trivial: Add a score to the GsReview object
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] trivial: Add a score to the GsReview object
- Date: Tue, 9 Feb 2016 18:59:40 +0000 (UTC)
commit 31d0536c81c998cd0b528a8543fb0a3a50eb30e6
Author: Richard Hughes <richard hughsie com>
Date: Tue Feb 9 18:57:42 2016 +0000
trivial: Add a score to the GsReview object
This will allow sorting reviews from multiple plugins in the future.
src/gs-review.c | 26 +++++++++++++++++++++++++-
src/gs-review.h | 4 ++++
2 files changed, 29 insertions(+), 1 deletions(-)
---
diff --git a/src/gs-review.c b/src/gs-review.c
index 2939b79..56df9c2 100644
--- a/src/gs-review.c
+++ b/src/gs-review.c
@@ -31,6 +31,7 @@ struct _GsReview
gchar *summary;
gchar *text;
gint karma;
+ gint score;
gint rating;
gchar *version;
gchar *reviewer;
@@ -73,6 +74,29 @@ gs_review_set_karma (GsReview *review, gint karma)
}
/**
+ * gs_review_get_score:
+ *
+ * This allows the UI to sort reviews into the correct order.
+ * Higher numbers indicate a more important or relevant review.
+ */
+gint
+gs_review_get_score (GsReview *review)
+{
+ g_return_val_if_fail (GS_IS_REVIEW (review), 0);
+ return review->score;
+}
+
+/**
+ * gs_review_set_score:
+ */
+void
+gs_review_set_score (GsReview *review, gint score)
+{
+ g_return_if_fail (GS_IS_REVIEW (review));
+ review->score = score;
+}
+
+/**
* gs_review_get_summary:
*/
const gchar *
@@ -328,7 +352,7 @@ gs_review_class_init (GsReviewClass *klass)
* GsApp:karma:
*/
pspec = g_param_spec_int ("karma", NULL, NULL,
- 0, G_MAXINT, G_MININT,
+ G_MININT, G_MAXINT, 0,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
g_object_class_install_property (object_class, PROP_KARMA, pspec);
diff --git a/src/gs-review.h b/src/gs-review.h
index c47bfff..7039261 100644
--- a/src/gs-review.h
+++ b/src/gs-review.h
@@ -51,6 +51,10 @@ gint gs_review_get_karma (GsReview *review);
void gs_review_set_karma (GsReview *review,
gint karma);
+gint gs_review_get_score (GsReview *review);
+void gs_review_set_score (GsReview *review,
+ gint score);
+
const gchar *gs_review_get_summary (GsReview *review);
void gs_review_set_summary (GsReview *review,
const gchar *summary);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]