[gnome-software/wip/hughsie/AsReview] Use AsReview from libappstream-glib



commit d3eac2b1c5b74fbc312a0bc5ae6a1894df1ea049
Author: Richard Hughes <richard hughsie com>
Date:   Wed Jul 20 08:30:12 2016 +0100

    Use AsReview from libappstream-glib

 src/Makefile.am                        |    5 -
 src/gs-app.c                           |   14 +-
 src/gs-app.h                           |    6 +-
 src/gs-plugin-loader-sync.c            |    4 +-
 src/gs-plugin-loader-sync.h            |    4 +-
 src/gs-plugin-loader.c                 |   28 +-
 src/gs-plugin-loader.h                 |   26 ++-
 src/gs-plugin-vfuncs.h                 |   26 +-
 src/gs-review-row.c                    |   46 ++--
 src/gs-review-row.h                    |    8 +-
 src/gs-review.c                        |  587 --------------------------------
 src/gs-review.h                        |  122 -------
 src/gs-self-test.c                     |   12 +-
 src/gs-shell-details.c                 |   46 ++--
 src/gs-shell-moderate.c                |   12 +-
 src/plugins/gs-appstream.c             |   20 ++
 src/plugins/gs-plugin-dummy.c          |   50 ++--
 src/plugins/gs-plugin-odrs.c           |   98 +++---
 src/plugins/gs-plugin-ubuntu-reviews.c |   54 ++--
 19 files changed, 246 insertions(+), 922 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index ae71985..de79bec 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -34,7 +34,6 @@ gnomesoftware_include_HEADERS =                               \
        gs-os-release.h                                 \
        gs-plugin.h                                     \
        gs-plugin-vfuncs.h                              \
-       gs-review.h                                     \
        gs-utils.h
 
 @INTLTOOL_DESKTOP_RULE@
@@ -110,7 +109,6 @@ gnome_software_cmd_SOURCES =                                \
        gs-app.c                                        \
        gs-app-list.c                                   \
        gs-auth.c                                       \
-       gs-review.c                                     \
        gs-cmd.c                                        \
        gs-common.c                                     \
        gs-debug.c                                      \
@@ -198,8 +196,6 @@ gnome_software_SOURCES =                            \
        gs-progress-button.h                            \
        gs-removal-dialog.c                             \
        gs-removal-dialog.h                             \
-       gs-review.c                                     \
-       gs-review.h                                     \
        gs-review-bar.c                                 \
        gs-review-bar.h                                 \
        gs-review-dialog.c                              \
@@ -344,7 +340,6 @@ gs_self_test_SOURCES =                                              \
        gs-plugin-loader-sync.c                                 \
        gs-plugin-loader.c                                      \
        gs-plugin.c                                             \
-       gs-review.c                                             \
        gs-utils.c                                              \
        gs-self-test.c
 
diff --git a/src/gs-app.c b/src/gs-app.c
index 2f750ba..e878a00 100644
--- a/src/gs-app.c
+++ b/src/gs-app.c
@@ -93,7 +93,7 @@ struct _GsApp
        guint                    priority;
        gint                     rating;
        GArray                  *review_ratings;
-       GPtrArray               *reviews; /* of GsReview */
+       GPtrArray               *reviews; /* of AsReview */
        guint64                  size_installed;
        guint64                  size_download;
        AsAppKind                kind;
@@ -1974,7 +1974,7 @@ gs_app_set_review_ratings (GsApp *app, GArray *review_ratings)
  *
  * Gets all the user-submitted reviews for the application.
  *
- * Returns: (element-type GsReview) (transfer none): the list of reviews
+ * Returns: (element-type AsReview) (transfer none): the list of reviews
  **/
 GPtrArray *
 gs_app_get_reviews (GsApp *app)
@@ -1986,27 +1986,27 @@ gs_app_get_reviews (GsApp *app)
 /**
  * gs_app_add_review:
  * @app: a #GsApp
- * @review: a #GsReview
+ * @review: a #AsReview
  *
  * Adds a user-submitted review to the application.
  **/
 void
-gs_app_add_review (GsApp *app, GsReview *review)
+gs_app_add_review (GsApp *app, AsReview *review)
 {
        g_return_if_fail (GS_IS_APP (app));
-       g_return_if_fail (GS_IS_REVIEW (review));
+       g_return_if_fail (AS_IS_REVIEW (review));
        g_ptr_array_add (app->reviews, g_object_ref (review));
 }
 
 /**
  * gs_app_remove_review:
  * @app: a #GsApp
- * @review: a #GsReview
+ * @review: a #AsReview
  *
  * Removes a user-submitted review to the application.
  **/
 void
-gs_app_remove_review (GsApp *app, GsReview *review)
+gs_app_remove_review (GsApp *app, AsReview *review)
 {
        g_return_if_fail (GS_IS_APP (app));
        g_ptr_array_remove (app->reviews, review);
diff --git a/src/gs-app.h b/src/gs-app.h
index e66108e..d7dacc6 100644
--- a/src/gs-app.h
+++ b/src/gs-app.h
@@ -27,8 +27,6 @@
 #include <gdk-pixbuf/gdk-pixbuf.h>
 #include <appstream-glib.h>
 
-#include "gs-review.h"
-
 G_BEGIN_DECLS
 
 #define GS_TYPE_APP (gs_app_get_type ())
@@ -214,9 +212,9 @@ void                 gs_app_set_review_ratings      (GsApp          *app,
                                                 GArray         *review_ratings);
 GPtrArray      *gs_app_get_reviews             (GsApp          *app);
 void            gs_app_add_review              (GsApp          *app,
-                                                GsReview       *review);
+                                                AsReview       *review);
 void            gs_app_remove_review           (GsApp          *app,
-                                                GsReview       *review);
+                                                AsReview       *review);
 guint64                 gs_app_get_size_installed      (GsApp          *app);
 void            gs_app_set_size_installed      (GsApp          *app,
                                                 guint64         size_installed);
diff --git a/src/gs-plugin-loader-sync.c b/src/gs-plugin-loader-sync.c
index 233bcd8..73f75c5 100644
--- a/src/gs-plugin-loader-sync.c
+++ b/src/gs-plugin-loader-sync.c
@@ -536,8 +536,8 @@ gs_plugin_loader_review_action_finish_sync (GsPluginLoader *plugin_loader,
 gboolean
 gs_plugin_loader_review_action (GsPluginLoader *plugin_loader,
                                GsApp *app,
-                               GsReview *review,
-                               GsReviewAction action,
+                               AsReview *review,
+                               GsPluginReviewAction action,
                                GCancellable *cancellable,
                                GError **error)
 {
diff --git a/src/gs-plugin-loader-sync.h b/src/gs-plugin-loader-sync.h
index 7a28845..ba49320 100644
--- a/src/gs-plugin-loader-sync.h
+++ b/src/gs-plugin-loader-sync.h
@@ -78,8 +78,8 @@ gboolean       gs_plugin_loader_app_action            (GsPluginLoader *plugin_loader,
                                                         GError         **error);
 gboolean        gs_plugin_loader_review_action         (GsPluginLoader *plugin_loader,
                                                         GsApp          *app,
-                                                        GsReview       *review,
-                                                        GsReviewAction  action,
+                                                        AsReview       *review,
+                                                        GsPluginReviewAction    action,
                                                         GCancellable   *cancellable,
                                                         GError         **error);
 gboolean        gs_plugin_loader_auth_action           (GsPluginLoader *plugin_loader,
diff --git a/src/gs-plugin-loader.c b/src/gs-plugin-loader.c
index 25c7cdd..fd75ddf 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -100,7 +100,7 @@ typedef gboolean     (*GsPluginActionFunc)          (GsPlugin       *plugin,
                                                         GError         **error);
 typedef gboolean        (*GsPluginReviewFunc)          (GsPlugin       *plugin,
                                                         GsApp          *app,
-                                                        GsReview       *review,
+                                                        AsReview       *review,
                                                         GCancellable   *cancellable,
                                                         GError         **error);
 typedef gboolean        (*GsPluginAuthFunc)            (GsPlugin       *plugin,
@@ -145,7 +145,7 @@ typedef struct {
        guint                            cache_age;
        GsCategory                      *category;
        GsApp                           *app;
-       GsReview                        *review;
+       AsReview                        *review;
        GsAuth                          *auth;
 } GsPluginLoaderAsyncState;
 
@@ -269,11 +269,11 @@ gs_plugin_loader_run_adopt (GsPluginLoader *plugin_loader, GsAppList *list)
 static gint
 gs_plugin_loader_review_score_sort_cb (gconstpointer a, gconstpointer b)
 {
-       GsReview *ra = *((GsReview **) a);
-       GsReview *rb = *((GsReview **) b);
-       if (gs_review_get_score (ra) < gs_review_get_score (rb))
+       AsReview *ra = *((AsReview **) a);
+       AsReview *rb = *((AsReview **) b);
+       if (as_review_get_score (ra) < as_review_get_score (rb))
                return 1;
-       if (gs_review_get_score (ra) > gs_review_get_score (rb))
+       if (as_review_get_score (ra) > as_review_get_score (rb))
                return -1;
        return 0;
 }
@@ -3077,8 +3077,8 @@ gs_plugin_loader_app_action_async (GsPluginLoader *plugin_loader,
 void
 gs_plugin_loader_review_action_async (GsPluginLoader *plugin_loader,
                                      GsApp *app,
-                                     GsReview *review,
-                                     GsReviewAction action,
+                                     AsReview *review,
+                                     GsPluginReviewAction action,
                                      GCancellable *cancellable,
                                      GAsyncReadyCallback callback,
                                      gpointer user_data)
@@ -3096,22 +3096,22 @@ gs_plugin_loader_review_action_async (GsPluginLoader *plugin_loader,
        state->review = g_object_ref (review);
 
        switch (action) {
-       case GS_REVIEW_ACTION_SUBMIT:
+       case GS_PLUGIN_REVIEW_ACTION_SUBMIT:
                state->function_name = "gs_plugin_review_submit";
                break;
-       case GS_REVIEW_ACTION_UPVOTE:
+       case GS_PLUGIN_REVIEW_ACTION_UPVOTE:
                state->function_name = "gs_plugin_review_upvote";
                break;
-       case GS_REVIEW_ACTION_DOWNVOTE:
+       case GS_PLUGIN_REVIEW_ACTION_DOWNVOTE:
                state->function_name = "gs_plugin_review_downvote";
                break;
-       case GS_REVIEW_ACTION_REPORT:
+       case GS_PLUGIN_REVIEW_ACTION_REPORT:
                state->function_name = "gs_plugin_review_report";
                break;
-       case GS_REVIEW_ACTION_REMOVE:
+       case GS_PLUGIN_REVIEW_ACTION_REMOVE:
                state->function_name = "gs_plugin_review_remove";
                break;
-       case GS_REVIEW_ACTION_DISMISS:
+       case GS_PLUGIN_REVIEW_ACTION_DISMISS:
                state->function_name = "gs_plugin_review_dismiss";
                break;
        default:
diff --git a/src/gs-plugin-loader.h b/src/gs-plugin-loader.h
index 1214d53..4805a71 100644
--- a/src/gs-plugin-loader.h
+++ b/src/gs-plugin-loader.h
@@ -61,6 +61,28 @@ typedef enum {
        GS_PLUGIN_LOADER_ACTION_LAST
 } GsPluginLoaderAction;
 
+/**
+ * GsPluginReviewAction:
+ * @GS_PLUGIN_REVIEW_ACTION_SUBMIT:    Submit a new review
+ * @GS_PLUGIN_REVIEW_ACTION_UPVOTE:    Upvote an existing review
+ * @GS_PLUGIN_REVIEW_ACTION_DOWNVOTE:  Downvote an existing review
+ * @GS_PLUGIN_REVIEW_ACTION_REPORT:    Report an existing review
+ * @GS_PLUGIN_REVIEW_ACTION_REMOVE:    Remove a review written by the user
+ * @GS_PLUGIN_REVIEW_ACTION_DISMISS:   Dismiss (ignore) a review when moderating
+ *
+ * The review action.
+ **/
+typedef enum {
+       GS_PLUGIN_REVIEW_ACTION_SUBMIT,
+       GS_PLUGIN_REVIEW_ACTION_UPVOTE,
+       GS_PLUGIN_REVIEW_ACTION_DOWNVOTE,
+       GS_PLUGIN_REVIEW_ACTION_REPORT,
+       GS_PLUGIN_REVIEW_ACTION_REMOVE,
+       GS_PLUGIN_REVIEW_ACTION_DISMISS,
+       /*< private >*/
+       GS_PLUGIN_REVIEW_ACTION_LAST
+} GsPluginReviewAction;
+
 typedef void    (*GsPluginLoaderFinishedFunc)          (GsPluginLoader *plugin_loader,
                                                         GsApp          *app,
                                                         gpointer        user_data);
@@ -220,8 +242,8 @@ gboolean     gs_plugin_loader_review_action_finish  (GsPluginLoader *plugin_loader,
                                                         GError         **error);
 void            gs_plugin_loader_review_action_async   (GsPluginLoader *plugin_loader,
                                                         GsApp          *app,
-                                                        GsReview       *review,
-                                                        GsReviewAction  action,
+                                                        AsReview       *review,
+                                                        GsPluginReviewAction    action,
                                                         GCancellable   *cancellable,
                                                         GAsyncReadyCallback callback,
                                                         gpointer        user_data);
diff --git a/src/gs-plugin-vfuncs.h b/src/gs-plugin-vfuncs.h
index 0473515..071465a 100644
--- a/src/gs-plugin-vfuncs.h
+++ b/src/gs-plugin-vfuncs.h
@@ -664,7 +664,7 @@ gboolean     gs_plugin_app_upgrade_trigger          (GsPlugin       *plugin,
  * gs_plugin_review_submit:
  * @plugin: a #GsPlugin
  * @app: a #GsApp
- * @review: a #GsReview
+ * @review: a #AsReview
  * @cancellable: a #GCancellable, or %NULL
  * @error: a #GError, or %NULL
  *
@@ -674,7 +674,7 @@ gboolean     gs_plugin_app_upgrade_trigger          (GsPlugin       *plugin,
  **/
 gboolean        gs_plugin_review_submit                (GsPlugin       *plugin,
                                                         GsApp          *app,
-                                                        GsReview       *review,
+                                                        AsReview       *review,
                                                         GCancellable   *cancellable,
                                                         GError         **error);
 
@@ -682,7 +682,7 @@ gboolean     gs_plugin_review_submit                (GsPlugin       *plugin,
  * gs_plugin_review_upvote:
  * @plugin: a #GsPlugin
  * @app: a #GsApp
- * @review: a #GsReview
+ * @review: a #AsReview
  * @cancellable: a #GCancellable, or %NULL
  * @error: a #GError, or %NULL
  *
@@ -692,7 +692,7 @@ gboolean     gs_plugin_review_submit                (GsPlugin       *plugin,
  **/
 gboolean        gs_plugin_review_upvote                (GsPlugin       *plugin,
                                                         GsApp          *app,
-                                                        GsReview       *review,
+                                                        AsReview       *review,
                                                         GCancellable   *cancellable,
                                                         GError         **error);
 
@@ -700,7 +700,7 @@ gboolean     gs_plugin_review_upvote                (GsPlugin       *plugin,
  * gs_plugin_review_downvote:
  * @plugin: a #GsPlugin
  * @app: a #GsApp
- * @review: a #GsReview
+ * @review: a #AsReview
  * @cancellable: a #GCancellable, or %NULL
  * @error: a #GError, or %NULL
  *
@@ -712,7 +712,7 @@ gboolean     gs_plugin_review_upvote                (GsPlugin       *plugin,
  **/
 gboolean        gs_plugin_review_downvote              (GsPlugin       *plugin,
                                                         GsApp          *app,
-                                                        GsReview       *review,
+                                                        AsReview       *review,
                                                         GCancellable   *cancellable,
                                                         GError         **error);
 
@@ -720,7 +720,7 @@ gboolean     gs_plugin_review_downvote              (GsPlugin       *plugin,
  * gs_plugin_review_report:
  * @plugin: a #GsPlugin
  * @app: a #GsApp
- * @review: a #GsReview
+ * @review: a #AsReview
  * @cancellable: a #GCancellable, or %NULL
  * @error: a #GError, or %NULL
  *
@@ -732,7 +732,7 @@ gboolean     gs_plugin_review_downvote              (GsPlugin       *plugin,
  **/
 gboolean        gs_plugin_review_report                (GsPlugin       *plugin,
                                                         GsApp          *app,
-                                                        GsReview       *review,
+                                                        AsReview       *review,
                                                         GCancellable   *cancellable,
                                                         GError         **error);
 
@@ -740,18 +740,18 @@ gboolean   gs_plugin_review_report                (GsPlugin       *plugin,
  * gs_plugin_review_remove:
  * @plugin: a #GsPlugin
  * @app: a #GsApp
- * @review: a #GsReview
+ * @review: a #AsReview
  * @cancellable: a #GCancellable, or %NULL
  * @error: a #GError, or %NULL
  *
  * Remove a review that the user wrote.
- * NOTE: Users should only be able to remove reviews with %GS_REVIEW_FLAG_SELF.
+ * NOTE: Users should only be able to remove reviews with %AS_REVIEW_FLAG_SELF.
  *
  * Returns: %TRUE for success or if not relevant
  **/
 gboolean        gs_plugin_review_remove                (GsPlugin       *plugin,
                                                         GsApp          *app,
-                                                        GsReview       *review,
+                                                        AsReview       *review,
                                                         GCancellable   *cancellable,
                                                         GError         **error);
 
@@ -759,7 +759,7 @@ gboolean     gs_plugin_review_remove                (GsPlugin       *plugin,
  * gs_plugin_review_dismiss:
  * @plugin: a #GsPlugin
  * @app: a #GsApp
- * @review: a #GsReview
+ * @review: a #AsReview
  * @cancellable: a #GCancellable, or %NULL
  * @error: a #GError, or %NULL
  *
@@ -771,7 +771,7 @@ gboolean     gs_plugin_review_remove                (GsPlugin       *plugin,
  **/
 gboolean        gs_plugin_review_dismiss               (GsPlugin       *plugin,
                                                         GsApp          *app,
-                                                        GsReview       *review,
+                                                        AsReview       *review,
                                                         GCancellable   *cancellable,
                                                         GError         **error);
 
diff --git a/src/gs-review-row.c b/src/gs-review-row.c
index c8b07b1..c85c71a 100644
--- a/src/gs-review-row.c
+++ b/src/gs-review-row.c
@@ -31,7 +31,7 @@ typedef struct
 {
        GtkListBoxRow    parent_instance;
 
-       GsReview        *review;
+       AsReview        *review;
        guint64          actions;
        GtkWidget       *stars;
        GtkWidget       *summary_label;
@@ -64,42 +64,42 @@ gs_review_row_refresh (GsReviewRow *row)
        g_autofree gchar *text = NULL;
 
        gs_star_widget_set_rating (GS_STAR_WIDGET (priv->stars),
-                                  gs_review_get_rating (priv->review));
-       reviewer = gs_review_get_reviewer (priv->review);
+                                  as_review_get_rating (priv->review));
+       reviewer = as_review_get_reviewer_name (priv->review);
        gtk_label_set_text (GTK_LABEL (priv->author_label), reviewer ? reviewer : "");
-       date = gs_review_get_date (priv->review);
+       date = as_review_get_date (priv->review);
        if (date != NULL)
                text = g_date_time_format (date, "%e %B %Y");
        else
                text = g_strdup ("");
        gtk_label_set_text (GTK_LABEL (priv->date_label), text);
        gtk_label_set_text (GTK_LABEL (priv->summary_label),
-                           gs_review_get_summary (priv->review));
+                           as_review_get_summary (priv->review));
        gtk_label_set_text (GTK_LABEL (priv->text_label),
-                           gs_review_get_text (priv->review));
+                           as_review_get_description (priv->review));
 
        /* if we voted, we can't do any actions */
-       if (gs_review_get_flags (priv->review) & GS_REVIEW_FLAG_VOTED)
+       if (as_review_get_flags (priv->review) & AS_REVIEW_FLAG_VOTED)
                priv->actions = 0;
 
        /* set actions up */
-       if ((priv->actions & (1 << GS_REVIEW_ACTION_UPVOTE |
-                             1 << GS_REVIEW_ACTION_DOWNVOTE |
-                             1 << GS_REVIEW_ACTION_DISMISS)) == 0) {
+       if ((priv->actions & (1 << GS_PLUGIN_REVIEW_ACTION_UPVOTE |
+                             1 << GS_PLUGIN_REVIEW_ACTION_DOWNVOTE |
+                             1 << GS_PLUGIN_REVIEW_ACTION_DISMISS)) == 0) {
                gtk_widget_set_visible (priv->box_voting, FALSE);
        } else {
                gtk_widget_set_visible (priv->box_voting, TRUE);
                gtk_widget_set_visible (priv->button_yes,
-                                       priv->actions & 1 << GS_REVIEW_ACTION_UPVOTE);
+                                       priv->actions & 1 << GS_PLUGIN_REVIEW_ACTION_UPVOTE);
                gtk_widget_set_visible (priv->button_no,
-                                       priv->actions & 1 << GS_REVIEW_ACTION_DOWNVOTE);
+                                       priv->actions & 1 << GS_PLUGIN_REVIEW_ACTION_DOWNVOTE);
                gtk_widget_set_visible (priv->button_dismiss,
-                                       priv->actions & 1 << GS_REVIEW_ACTION_DISMISS);
+                                       priv->actions & 1 << GS_PLUGIN_REVIEW_ACTION_DISMISS);
        }
        gtk_widget_set_visible (priv->button_remove,
-                               priv->actions & 1 << GS_REVIEW_ACTION_REMOVE);
+                               priv->actions & 1 << GS_PLUGIN_REVIEW_ACTION_REMOVE);
        gtk_widget_set_visible (priv->button_report,
-                               priv->actions & 1 << GS_REVIEW_ACTION_REPORT);
+                               priv->actions & 1 << GS_PLUGIN_REVIEW_ACTION_REPORT);
 }
 
 static gboolean
@@ -173,14 +173,14 @@ static void
 gs_review_row_button_clicked_upvote_cb (GtkButton *button, GsReviewRow *row)
 {
        g_signal_emit (row, signals[SIGNAL_BUTTON_CLICKED], 0,
-                      GS_REVIEW_ACTION_UPVOTE);
+                      GS_PLUGIN_REVIEW_ACTION_UPVOTE);
 }
 
 static void
 gs_review_row_button_clicked_downvote_cb (GtkButton *button, GsReviewRow *row)
 {
        g_signal_emit (row, signals[SIGNAL_BUTTON_CLICKED], 0,
-                      GS_REVIEW_ACTION_DOWNVOTE);
+                      GS_PLUGIN_REVIEW_ACTION_DOWNVOTE);
 }
 
 static void
@@ -188,7 +188,7 @@ gs_review_row_confirm_cb (GtkDialog *dialog, gint response_id, GsReviewRow *row)
 {
        if (response_id == GTK_RESPONSE_YES) {
                g_signal_emit (row, signals[SIGNAL_BUTTON_CLICKED], 0,
-                              GS_REVIEW_ACTION_REPORT);
+                              GS_PLUGIN_REVIEW_ACTION_REPORT);
        }
        gtk_widget_destroy (GTK_WIDGET (dialog));
 }
@@ -242,17 +242,17 @@ static void
 gs_review_row_button_clicked_dismiss_cb (GtkButton *button, GsReviewRow *row)
 {
        g_signal_emit (row, signals[SIGNAL_BUTTON_CLICKED], 0,
-                      GS_REVIEW_ACTION_DISMISS);
+                      GS_PLUGIN_REVIEW_ACTION_DISMISS);
 }
 
 static void
 gs_review_row_button_clicked_remove_cb (GtkButton *button, GsReviewRow *row)
 {
        g_signal_emit (row, signals[SIGNAL_BUTTON_CLICKED], 0,
-                      GS_REVIEW_ACTION_REMOVE);
+                      GS_PLUGIN_REVIEW_ACTION_REMOVE);
 }
 
-GsReview *
+AsReview *
 gs_review_row_get_review (GsReviewRow *review_row)
 {
        GsReviewRowPrivate *priv = gs_review_row_get_instance_private (review_row);
@@ -276,12 +276,12 @@ gs_review_row_set_actions (GsReviewRow *review_row, guint64 actions)
  * Return value: A new @GsReviewRow.
  **/
 GtkWidget *
-gs_review_row_new (GsReview *review)
+gs_review_row_new (AsReview *review)
 {
        GsReviewRow *row;
        GsReviewRowPrivate *priv;
 
-       g_return_val_if_fail (GS_IS_REVIEW (review), NULL);
+       g_return_val_if_fail (AS_IS_REVIEW (review), NULL);
 
        row = g_object_new (GS_TYPE_REVIEW_ROW, NULL);
        priv = gs_review_row_get_instance_private (row);
diff --git a/src/gs-review-row.h b/src/gs-review-row.h
index 74e2f01..c6c60be 100644
--- a/src/gs-review-row.h
+++ b/src/gs-review-row.h
@@ -24,7 +24,7 @@
 
 #include <gtk/gtk.h>
 
-#include "gs-review.h"
+#include "gs-plugin-loader.h"
 
 G_BEGIN_DECLS
 
@@ -36,11 +36,11 @@ struct _GsReviewRowClass
 {
        GtkListBoxRowClass       parent_class;
        void                    (*button_clicked)       (GsReviewRow    *review_row,
-                                                        GsReviewAction  action);
+                                                        GsPluginReviewAction    action);
 };
 
-GtkWidget      *gs_review_row_new              (GsReview       *review);
-GsReview       *gs_review_row_get_review       (GsReviewRow    *review_row);
+GtkWidget      *gs_review_row_new              (AsReview       *review);
+AsReview       *gs_review_row_get_review       (GsReviewRow    *review_row);
 void            gs_review_row_set_actions      (GsReviewRow    *review_row,
                                                 guint64         actions);
 
diff --git a/src/gs-self-test.c b/src/gs-self-test.c
index 6f6150f..7222fec 100644
--- a/src/gs-self-test.c
+++ b/src/gs-self-test.c
@@ -870,8 +870,8 @@ gs_plugin_loader_authentication_func (GsPluginLoader *plugin_loader)
        gboolean ret;
        g_autoptr(GError) error = NULL;
        g_autoptr(GsApp) app = NULL;
-       g_autoptr(GsReview) review = NULL;
-       g_autoptr(GsReview) review2 = NULL;
+       g_autoptr(AsReview) review = NULL;
+       g_autoptr(AsReview) review2 = NULL;
 
        /* check initial state */
        auth = gs_plugin_loader_get_auth_by_id (plugin_loader, "dummy");
@@ -889,9 +889,9 @@ gs_plugin_loader_authentication_func (GsPluginLoader *plugin_loader)
 
        /* do an action that requires a login */
        app = gs_app_new (NULL);
-       review = gs_review_new ();
+       review = as_review_new ();
        ret = gs_plugin_loader_review_action (plugin_loader, app, review,
-                                             GS_REVIEW_ACTION_REMOVE,
+                                             GS_PLUGIN_REVIEW_ACTION_REMOVE,
                                              NULL, &error);
        g_assert_error (error, GS_PLUGIN_ERROR, GS_PLUGIN_ERROR_AUTH_REQUIRED);
        g_assert (!ret);
@@ -917,9 +917,9 @@ gs_plugin_loader_authentication_func (GsPluginLoader *plugin_loader)
        g_assert (gs_auth_has_flag (auth, GS_AUTH_FLAG_VALID));
 
        /* do the action that requires a login */
-       review2 = gs_review_new ();
+       review2 = as_review_new ();
        ret = gs_plugin_loader_review_action (plugin_loader, app, review2,
-                                             GS_REVIEW_ACTION_REMOVE,
+                                             GS_PLUGIN_REVIEW_ACTION_REMOVE,
                                              NULL, &error);
        g_assert_no_error (error);
        g_assert (ret);
diff --git a/src/gs-shell-details.c b/src/gs-shell-details.c
index 68bf27d..d74e203 100644
--- a/src/gs-shell-details.c
+++ b/src/gs-shell-details.c
@@ -1066,9 +1066,9 @@ static void gs_shell_details_refresh_reviews (GsShellDetails *self);
 
 typedef struct {
        GsShellDetails          *self;
-       GsReview                *review;
+       AsReview                *review;
        GsApp                   *app;
-       GsReviewAction           action;
+       GsPluginReviewAction             action;
 } GsShellDetailsReviewHelper;
 
 static void
@@ -1147,7 +1147,7 @@ gs_shell_details_app_set_review_cb (GObject *source,
 
 static void
 gs_shell_details_review_button_clicked_cb (GsReviewRow *row,
-                                          GsReviewAction action,
+                                          GsPluginReviewAction action,
                                           GsShellDetails *self)
 {
        GsShellDetailsReviewHelper *helper = g_new0 (GsShellDetailsReviewHelper, 1);
@@ -1175,15 +1175,15 @@ gs_shell_details_refresh_reviews (GsShellDetails *self)
        guint64 possible_actions = 0;
        guint i;
        struct {
-               GsReviewAction action;
+               GsPluginReviewAction action;
                const gchar *plugin_func;
        } plugin_vfuncs[] = {
-               { GS_REVIEW_ACTION_UPVOTE,      "gs_plugin_review_upvote" },
-               { GS_REVIEW_ACTION_DOWNVOTE,    "gs_plugin_review_downvote" },
-               { GS_REVIEW_ACTION_REPORT,      "gs_plugin_review_report" },
-               { GS_REVIEW_ACTION_SUBMIT,      "gs_plugin_review_submit" },
-               { GS_REVIEW_ACTION_REMOVE,      "gs_plugin_review_remove" },
-               { GS_REVIEW_ACTION_LAST,        NULL }
+               { GS_PLUGIN_REVIEW_ACTION_UPVOTE,       "gs_plugin_review_upvote" },
+               { GS_PLUGIN_REVIEW_ACTION_DOWNVOTE,     "gs_plugin_review_downvote" },
+               { GS_PLUGIN_REVIEW_ACTION_REPORT,       "gs_plugin_review_report" },
+               { GS_PLUGIN_REVIEW_ACTION_SUBMIT,       "gs_plugin_review_submit" },
+               { GS_PLUGIN_REVIEW_ACTION_REMOVE,       "gs_plugin_review_remove" },
+               { GS_PLUGIN_REVIEW_ACTION_LAST, NULL }
        };
 
        /* show or hide the entire reviews section */
@@ -1244,7 +1244,7 @@ gs_shell_details_refresh_reviews (GsShellDetails *self)
                return;
 
        /* find what the plugins support */
-       for (i = 0; plugin_vfuncs[i].action != GS_REVIEW_ACTION_LAST; i++) {
+       for (i = 0; plugin_vfuncs[i].action != GS_PLUGIN_REVIEW_ACTION_LAST; i++) {
                if (gs_plugin_loader_get_plugin_supported (self->plugin_loader,
                                                           plugin_vfuncs[i].plugin_func)) {
                        possible_actions |= 1 << plugin_vfuncs[i].action;
@@ -1259,17 +1259,17 @@ gs_shell_details_refresh_reviews (GsShellDetails *self)
        gs_container_remove_all (GTK_CONTAINER (self->list_box_reviews));
        reviews = gs_app_get_reviews (self->app);
        for (i = 0; i < reviews->len; i++) {
-               GsReview *review = g_ptr_array_index (reviews, i);
+               AsReview *review = g_ptr_array_index (reviews, i);
                GtkWidget *row = gs_review_row_new (review);
                guint64 actions;
 
                g_signal_connect (row, "button-clicked",
                                  G_CALLBACK (gs_shell_details_review_button_clicked_cb), self);
-               if (gs_review_get_flags (review) & GS_REVIEW_FLAG_SELF) {
-                       actions = possible_actions & 1 << GS_REVIEW_ACTION_REMOVE;
+               if (as_review_get_flags (review) & AS_REVIEW_FLAG_SELF) {
+                       actions = possible_actions & 1 << GS_PLUGIN_REVIEW_ACTION_REMOVE;
                        show_review_button = FALSE;
                } else {
-                       actions = possible_actions & ~(1 << GS_REVIEW_ACTION_REMOVE);
+                       actions = possible_actions & ~(1 << GS_PLUGIN_REVIEW_ACTION_REMOVE);
                }
                gs_review_row_set_actions (GS_REVIEW_ROW (row), actions);
                gtk_container_add (GTK_CONTAINER (self->list_box_reviews), row);
@@ -1623,7 +1623,7 @@ gs_shell_details_review_response_cb (GtkDialog *dialog,
 {
        g_autofree gchar *text = NULL;
        g_autoptr(GDateTime) now = NULL;
-       g_autoptr(GsReview) review = NULL;
+       g_autoptr(AsReview) review = NULL;
        GsShellDetailsReviewHelper *helper;
        GsReviewDialog *rdialog = GS_REVIEW_DIALOG (dialog);
 
@@ -1633,21 +1633,21 @@ gs_shell_details_review_response_cb (GtkDialog *dialog,
                return;
        }
 
-       review = gs_review_new ();
-       gs_review_set_summary (review, gs_review_dialog_get_summary (rdialog));
+       review = as_review_new ();
+       as_review_set_summary (review, gs_review_dialog_get_summary (rdialog));
        text = gs_review_dialog_get_text (rdialog);
-       gs_review_set_text (review, text);
-       gs_review_set_rating (review, gs_review_dialog_get_rating (rdialog));
-       gs_review_set_version (review, gs_app_get_version (self->app));
+       as_review_set_description (review, text);
+       as_review_set_rating (review, gs_review_dialog_get_rating (rdialog));
+       as_review_set_version (review, gs_app_get_version (self->app));
        now = g_date_time_new_now_local ();
-       gs_review_set_date (review, now);
+       as_review_set_date (review, now);
 
        /* call into the plugins to set the new value */
        helper = g_new0 (GsShellDetailsReviewHelper, 1);
        helper->self = g_object_ref (self);
        helper->app = g_object_ref (self->app);
        helper->review = g_object_ref (review);
-       helper->action = GS_REVIEW_ACTION_SUBMIT;
+       helper->action = GS_PLUGIN_REVIEW_ACTION_SUBMIT;
        gs_plugin_loader_review_action_async (self->plugin_loader,
                                              helper->app,
                                              helper->review,
diff --git a/src/gs-shell-moderate.c b/src/gs-shell-moderate.c
index 9eb5460..febbfde 100644
--- a/src/gs-shell-moderate.c
+++ b/src/gs-shell-moderate.c
@@ -67,7 +67,7 @@ gs_shell_moderate_app_set_review_cb (GObject *source,
 
 static void
 gs_shell_moderate_review_clicked_cb (GsReviewRow *row,
-                                    GsReviewAction action,
+                                    GsPluginReviewAction action,
                                     GsShellModerate *self)
 {
        GsApp *app = g_object_get_data (G_OBJECT (row), "GsApp");
@@ -114,15 +114,15 @@ gs_shell_moderate_add_app (GsShellModerate *self, GsApp *app)
        /* add reviews */
        reviews = gs_app_get_reviews (app);
        for (i = 0; i < reviews->len; i++) {
-               GsReview *review = g_ptr_array_index (reviews, i);
+               AsReview *review = g_ptr_array_index (reviews, i);
                GtkWidget *row = gs_review_row_new (review);
                gtk_widget_set_margin_start (row, 250);
                gtk_widget_set_margin_end (row, 250);
                gs_review_row_set_actions (GS_REVIEW_ROW (row),
-                                          1 << GS_REVIEW_ACTION_UPVOTE |
-                                          1 << GS_REVIEW_ACTION_DOWNVOTE |
-                                          1 << GS_REVIEW_ACTION_DISMISS |
-                                          1 << GS_REVIEW_ACTION_REPORT);
+                                          1 << GS_PLUGIN_REVIEW_ACTION_UPVOTE |
+                                          1 << GS_PLUGIN_REVIEW_ACTION_DOWNVOTE |
+                                          1 << GS_PLUGIN_REVIEW_ACTION_DISMISS |
+                                          1 << GS_PLUGIN_REVIEW_ACTION_REPORT);
                g_signal_connect (row, "button-clicked",
                                  G_CALLBACK (gs_shell_moderate_review_clicked_cb), self);
                g_object_set_data_full (G_OBJECT (row), "GsApp",
diff --git a/src/plugins/gs-appstream.c b/src/plugins/gs-appstream.c
index a2a9e1f..891996c 100644
--- a/src/plugins/gs-appstream.c
+++ b/src/plugins/gs-appstream.c
@@ -173,6 +173,23 @@ gs_appstream_refine_add_screenshots (GsApp *app, AsApp *item)
        }
 }
 
+static void
+gs_appstream_refine_add_reviews (GsApp *app, AsApp *item)
+{
+       AsReview *review;
+       GPtrArray *reviews;
+       guint i;
+
+       /* do we have any to add */
+       if (gs_app_get_reviews(app)->len > 0)
+               return;
+       reviews = as_app_get_reviews (item);
+       for (i = 0; i < reviews->len; i++) {
+               review = g_ptr_array_index (reviews, i);
+               gs_app_add_review (app, review);
+       }
+}
+
 static gboolean
 gs_appstream_is_recent_release (AsApp *app)
 {
@@ -613,6 +630,9 @@ gs_appstream_refine_app (GsPlugin *plugin,
        /* set screenshots */
        gs_appstream_refine_add_screenshots (app, item);
 
+       /* set reviews */
+       gs_appstream_refine_add_reviews (app, item);
+
        /* are the screenshots perfect */
        if (gs_appstream_are_screenshots_perfect (item))
                gs_app_add_kudo (app, GS_APP_KUDO_PERFECT_SCREENSHOTS);
diff --git a/src/plugins/gs-plugin-dummy.c b/src/plugins/gs-plugin-dummy.c
index 67df02b..84b49e1 100644
--- a/src/plugins/gs-plugin-dummy.c
+++ b/src/plugins/gs-plugin-dummy.c
@@ -439,31 +439,31 @@ gs_plugin_refine_app (GsPlugin *plugin,
 
        /* add fake review */
        if (flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_REVIEWS) {
-               g_autoptr(GsReview) review1 = NULL;
-               g_autoptr(GsReview) review2 = NULL;
+               g_autoptr(AsReview) review1 = NULL;
+               g_autoptr(AsReview) review2 = NULL;
                g_autoptr(GDateTime) dt = NULL;
 
                dt = g_date_time_new_now_utc ();
 
                /* set first review */
-               review1 = gs_review_new ();
-               gs_review_set_rating (review1, 50);
-               gs_review_set_reviewer (review1, "Angela Avery");
-               gs_review_set_summary (review1, "Steep learning curve, but worth it");
-               gs_review_set_text (review1, "Best overall 3D application I've ever used overall 3D 
application I've ever used. Best overall 3D application I've ever used overall 3D application I've ever used. 
Best overall 3D application I've ever used overall 3D application I've ever used. Best overall 3D application 
I've ever used overall 3D application I've ever used.");
-               gs_review_set_version (review1, "3.16.4");
-               gs_review_set_date (review1, dt);
+               review1 = as_review_new ();
+               as_review_set_rating (review1, 50);
+               as_review_set_reviewer_name (review1, "Angela Avery");
+               as_review_set_summary (review1, "Steep learning curve, but worth it");
+               as_review_set_description (review1, "Best overall 3D application I've ever used overall 3D 
application I've ever used. Best overall 3D application I've ever used overall 3D application I've ever used. 
Best overall 3D application I've ever used overall 3D application I've ever used. Best overall 3D application 
I've ever used overall 3D application I've ever used.");
+               as_review_set_version (review1, "3.16.4");
+               as_review_set_date (review1, dt);
                gs_app_add_review (app, review1);
 
                /* set self review */
-               review2 = gs_review_new ();
-               gs_review_set_rating (review2, 100);
-               gs_review_set_reviewer (review2, "Just Myself");
-               gs_review_set_summary (review2, "I like this application");
-               gs_review_set_text (review2, "I'm not very wordy myself.");
-               gs_review_set_version (review2, "3.16.3");
-               gs_review_set_date (review2, dt);
-               gs_review_set_flags (review2, GS_REVIEW_FLAG_SELF);
+               review2 = as_review_new ();
+               as_review_set_rating (review2, 100);
+               as_review_set_reviewer_name (review2, "Just Myself");
+               as_review_set_summary (review2, "I like this application");
+               as_review_set_description (review2, "I'm not very wordy myself.");
+               as_review_set_version (review2, "3.16.3");
+               as_review_set_date (review2, dt);
+               as_review_set_flags (review2, AS_REVIEW_FLAG_SELF);
                gs_app_add_review (app, review2);
        }
 
@@ -621,7 +621,7 @@ gs_plugin_update_cancel (GsPlugin *plugin, GsApp *app,
 gboolean
 gs_plugin_review_submit (GsPlugin *plugin,
                         GsApp *app,
-                        GsReview *review,
+                        AsReview *review,
                         GCancellable *cancellable,
                         GError **error)
 {
@@ -632,43 +632,43 @@ gs_plugin_review_submit (GsPlugin *plugin,
 gboolean
 gs_plugin_review_report (GsPlugin *plugin,
                         GsApp *app,
-                        GsReview *review,
+                        AsReview *review,
                         GCancellable *cancellable,
                         GError **error)
 {
        g_debug ("Reporting dummy review");
-       gs_review_add_flags (review, GS_REVIEW_FLAG_VOTED);
+       as_review_add_flags (review, AS_REVIEW_FLAG_VOTED);
        return TRUE;
 }
 
 gboolean
 gs_plugin_review_upvote (GsPlugin *plugin,
                         GsApp *app,
-                        GsReview *review,
+                        AsReview *review,
                         GCancellable *cancellable,
                         GError **error)
 {
        g_debug ("Upvoting dummy review");
-       gs_review_add_flags (review, GS_REVIEW_FLAG_VOTED);
+       as_review_add_flags (review, AS_REVIEW_FLAG_VOTED);
        return TRUE;
 }
 
 gboolean
 gs_plugin_review_downvote (GsPlugin *plugin,
                           GsApp *app,
-                          GsReview *review,
+                          AsReview *review,
                           GCancellable *cancellable,
                           GError **error)
 {
        g_debug ("Downvoting dummy review");
-       gs_review_add_flags (review, GS_REVIEW_FLAG_VOTED);
+       as_review_add_flags (review, AS_REVIEW_FLAG_VOTED);
        return TRUE;
 }
 
 gboolean
 gs_plugin_review_remove (GsPlugin *plugin,
                         GsApp *app,
-                        GsReview *review,
+                        AsReview *review,
                         GCancellable *cancellable,
                         GError **error)
 {
diff --git a/src/plugins/gs-plugin-odrs.c b/src/plugins/gs-plugin-odrs.c
index 9c67bc6..d3fcd08 100644
--- a/src/plugins/gs-plugin-odrs.c
+++ b/src/plugins/gs-plugin-odrs.c
@@ -223,10 +223,10 @@ gs_plugin_destroy (GsPlugin *plugin)
        g_object_unref (priv->settings);
 }
 
-static GsReview *
+static AsReview *
 gs_plugin_odrs_parse_review_object (GsPlugin *plugin, JsonObject *item)
 {
-       GsReview *rev = gs_review_new ();
+       AsReview *rev = as_review_new ();
 
        /* date */
        if (json_object_has_member (item, "date_created")) {
@@ -234,48 +234,46 @@ gs_plugin_odrs_parse_review_object (GsPlugin *plugin, JsonObject *item)
                g_autoptr(GDateTime) dt = NULL;
                timestamp = json_object_get_int_member (item, "date_created");
                dt = g_date_time_new_from_unix_utc (timestamp);
-               gs_review_set_date (rev, dt);
+               as_review_set_date (rev, dt);
        }
 
        /* assemble review */
        if (json_object_has_member (item, "rating"))
-               gs_review_set_rating (rev, json_object_get_int_member (item, "rating"));
+               as_review_set_rating (rev, json_object_get_int_member (item, "rating"));
        if (json_object_has_member (item, "score"))
-               gs_review_set_score (rev, json_object_get_int_member (item, "score"));
+               as_review_set_score (rev, json_object_get_int_member (item, "score"));
+       if (json_object_has_member (item, "user_hash"))
+               as_review_set_reviewer_id (rev, json_object_get_string_member (item, "user_hash"));
        if (json_object_has_member (item, "user_display"))
-               gs_review_set_reviewer (rev, json_object_get_string_member (item, "user_display"));
+               as_review_set_reviewer_name (rev, json_object_get_string_member (item, "user_display"));
        if (json_object_has_member (item, "summary"))
-               gs_review_set_summary (rev, json_object_get_string_member (item, "summary"));
+               as_review_set_summary (rev, json_object_get_string_member (item, "summary"));
        if (json_object_has_member (item, "description"))
-               gs_review_set_text (rev, json_object_get_string_member (item, "description"));
+               as_review_set_description (rev, json_object_get_string_member (item, "description"));
        if (json_object_has_member (item, "version"))
-               gs_review_set_version (rev, json_object_get_string_member (item, "version"));
+               as_review_set_version (rev, json_object_get_string_member (item, "version"));
        if (json_object_has_member (item, "karma"))
-               gs_review_set_karma (rev, json_object_get_int_member (item, "karma"));
+               as_review_set_karma (rev, json_object_get_int_member (item, "karma"));
 
        /* add extra metadata for the plugin */
-       if (json_object_has_member (item, "user_hash")) {
-               gs_review_add_metadata (rev, "user_hash",
-                                       json_object_get_string_member (item, "user_hash"));
-       }
        if (json_object_has_member (item, "user_skey")) {
-               gs_review_add_metadata (rev, "user_skey",
+               as_review_add_metadata (rev, "user_skey",
                                        json_object_get_string_member (item, "user_skey"));
        }
        if (json_object_has_member (item, "app_id")) {
-               gs_review_add_metadata (rev, "app_id",
+               as_review_add_metadata (rev, "app_id",
                                        json_object_get_string_member (item, "app_id"));
        }
        if (json_object_has_member (item, "review_id")) {
                g_autofree gchar *review_id = NULL;
                review_id = g_strdup_printf ("%" G_GINT64_FORMAT,
                                        json_object_get_int_member (item, "review_id"));
-               gs_review_add_metadata (rev, "review_id", review_id);
+               as_review_set_id (rev, review_id);
        }
 
        /* don't allow multiple votes */
        if (json_object_has_member (item, "vote_id"))
-               gs_review_add_flags (rev, GS_REVIEW_FLAG_VOTED);
+               as_review_add_flags (rev, AS_REVIEW_FLAG_VOTED);
 
        return rev;
 }
@@ -327,7 +325,7 @@ gs_plugin_odrs_parse_reviews (GsPlugin *plugin,
        for (i = 0; i < json_array_get_length (json_reviews); i++) {
                JsonNode *json_review;
                JsonObject *json_item;
-               g_autoptr(GsReview) review = NULL;
+               g_autoptr(AsReview) review = NULL;
 
                /* extract the data */
                json_review = json_array_get_element (json_reviews, i);
@@ -595,7 +593,7 @@ gs_plugin_refine_reviews (GsPlugin *plugin,
                          GError **error)
 {
        GsPluginData *priv = gs_plugin_get_data (plugin);
-       GsReview *review;
+       AsReview *review;
        guint i;
        g_autoptr(GPtrArray) reviews = NULL;
 
@@ -610,19 +608,19 @@ gs_plugin_refine_reviews (GsPlugin *plugin,
                 * submitting a new review */
                if (i == 0) {
                        gs_app_set_metadata (app, "ODRS::user_skey",
-                                            gs_review_get_metadata_item (review, "user_skey"));
+                                            as_review_get_metadata_item (review, "user_skey"));
                }
 
                /* ignore invalid reviews */
-               if (gs_review_get_rating (review) == 0)
+               if (as_review_get_rating (review) == 0)
                        continue;
-               if (gs_review_get_reviewer (review) == NULL)
+               if (as_review_get_reviewer_name (review) == NULL)
                        continue;
 
                /* the user_hash matches, so mark this as our own review */
-               if (g_strcmp0 (gs_review_get_metadata_item (review, "user_hash"),
+               if (g_strcmp0 (as_review_get_reviewer_id (review),
                               priv->user_hash) == 0) {
-                       gs_review_set_flags (review, GS_REVIEW_FLAG_SELF);
+                       as_review_set_flags (review, AS_REVIEW_FLAG_SELF);
                }
                gs_app_add_review (app, review);
        }
@@ -692,7 +690,7 @@ gs_plugin_odrs_sanitize_version (const gchar *version)
 }
 
 static gboolean
-gs_plugin_odrs_invalidate_cache (GsReview *review, GError **error)
+gs_plugin_odrs_invalidate_cache (AsReview *review, GError **error)
 {
        g_autofree gchar *cachefn_basename = NULL;
        g_autofree gchar *cachefn = NULL;
@@ -700,7 +698,7 @@ gs_plugin_odrs_invalidate_cache (GsReview *review, GError **error)
 
        /* look in the cache */
        cachefn_basename = g_strdup_printf ("%s.json",
-                                           gs_review_get_metadata_item (review, "app_id"));
+                                           as_review_get_metadata_item (review, "app_id"));
        cachefn = gs_utils_get_cache_filename ("reviews",
                                               cachefn_basename,
                                               GS_UTILS_CACHE_FLAG_WRITEABLE,
@@ -716,7 +714,7 @@ gs_plugin_odrs_invalidate_cache (GsReview *review, GError **error)
 gboolean
 gs_plugin_review_submit (GsPlugin *plugin,
                         GsApp *app,
-                        GsReview *review,
+                        AsReview *review,
                         GCancellable *cancellable,
                         GError **error)
 {
@@ -729,9 +727,9 @@ gs_plugin_review_submit (GsPlugin *plugin,
        g_autoptr(JsonNode) json_root = NULL;
 
        /* save as we don't re-request the review from the server */
-       gs_review_set_reviewer (review, g_get_real_name ());
-       gs_review_add_metadata (review, "app_id", gs_app_get_id_no_prefix (app));
-       gs_review_add_metadata (review, "user_skey",
+       as_review_set_reviewer_name (review, g_get_real_name ());
+       as_review_add_metadata (review, "app_id", gs_app_get_id_no_prefix (app));
+       as_review_add_metadata (review, "user_skey",
                                gs_app_get_metadata_item (app, "ODRS::user_skey"));
 
        /* create object with review data */
@@ -741,25 +739,25 @@ gs_plugin_review_submit (GsPlugin *plugin,
        json_builder_add_string_value (builder, priv->user_hash);
        json_builder_set_member_name (builder, "user_skey");
        json_builder_add_string_value (builder,
-                                      gs_review_get_metadata_item (review, "user_skey"));
+                                      as_review_get_metadata_item (review, "user_skey"));
        json_builder_set_member_name (builder, "app_id");
        json_builder_add_string_value (builder,
-                                      gs_review_get_metadata_item (review, "app_id"));
+                                      as_review_get_metadata_item (review, "app_id"));
        json_builder_set_member_name (builder, "locale");
        json_builder_add_string_value (builder, gs_plugin_get_locale (plugin));
        json_builder_set_member_name (builder, "distro");
        json_builder_add_string_value (builder, priv->distro);
        json_builder_set_member_name (builder, "version");
-       version = gs_plugin_odrs_sanitize_version (gs_review_get_version (review));
+       version = gs_plugin_odrs_sanitize_version (as_review_get_version (review));
        json_builder_add_string_value (builder, version);
        json_builder_set_member_name (builder, "user_display");
-       json_builder_add_string_value (builder, gs_review_get_reviewer (review));
+       json_builder_add_string_value (builder, as_review_get_reviewer_name (review));
        json_builder_set_member_name (builder, "summary");
-       json_builder_add_string_value (builder, gs_review_get_summary (review));
+       json_builder_add_string_value (builder, as_review_get_summary (review));
        json_builder_set_member_name (builder, "description");
-       json_builder_add_string_value (builder, gs_review_get_text (review));
+       json_builder_add_string_value (builder, as_review_get_description (review));
        json_builder_set_member_name (builder, "rating");
-       json_builder_add_int_value (builder, gs_review_get_rating (review));
+       json_builder_add_int_value (builder, as_review_get_rating (review));
        json_builder_end_object (builder);
 
        /* export as a string */
@@ -780,7 +778,7 @@ gs_plugin_review_submit (GsPlugin *plugin,
 }
 
 static gboolean
-gs_plugin_odrs_vote (GsPlugin *plugin, GsReview *review,
+gs_plugin_odrs_vote (GsPlugin *plugin, AsReview *review,
                     const gchar *uri, GError **error)
 {
        GsPluginData *priv = gs_plugin_get_data (plugin);
@@ -798,11 +796,11 @@ gs_plugin_odrs_vote (GsPlugin *plugin, GsReview *review,
        json_builder_add_string_value (builder, priv->user_hash);
        json_builder_set_member_name (builder, "user_skey");
        json_builder_add_string_value (builder,
-                                      gs_review_get_metadata_item (review, "user_skey"));
+                                      as_review_get_metadata_item (review, "user_skey"));
        json_builder_set_member_name (builder, "app_id");
        json_builder_add_string_value (builder,
-                                      gs_review_get_metadata_item (review, "app_id"));
-       tmp = gs_review_get_metadata_item (review, "review_id");
+                                      as_review_get_metadata_item (review, "app_id"));
+       tmp = as_review_get_id (review);
        if (tmp != NULL) {
                guint64 review_id;
                json_builder_set_member_name (builder, "review_id");
@@ -830,7 +828,7 @@ gs_plugin_odrs_vote (GsPlugin *plugin, GsReview *review,
                return FALSE;
 
        /* mark as voted */
-       gs_review_add_flags (review, GS_REVIEW_FLAG_VOTED);
+       as_review_add_flags (review, AS_REVIEW_FLAG_VOTED);
 
        /* success */
        return TRUE;
@@ -839,7 +837,7 @@ gs_plugin_odrs_vote (GsPlugin *plugin, GsReview *review,
 gboolean
 gs_plugin_review_report (GsPlugin *plugin,
                         GsApp *app,
-                        GsReview *review,
+                        AsReview *review,
                         GCancellable *cancellable,
                         GError **error)
 {
@@ -852,7 +850,7 @@ gs_plugin_review_report (GsPlugin *plugin,
 gboolean
 gs_plugin_review_upvote (GsPlugin *plugin,
                         GsApp *app,
-                        GsReview *review,
+                        AsReview *review,
                         GCancellable *cancellable,
                         GError **error)
 {
@@ -865,7 +863,7 @@ gs_plugin_review_upvote (GsPlugin *plugin,
 gboolean
 gs_plugin_review_downvote (GsPlugin *plugin,
                           GsApp *app,
-                          GsReview *review,
+                          AsReview *review,
                           GCancellable *cancellable,
                           GError **error)
 {
@@ -878,7 +876,7 @@ gs_plugin_review_downvote (GsPlugin *plugin,
 gboolean
 gs_plugin_review_dismiss (GsPlugin *plugin,
                          GsApp *app,
-                         GsReview *review,
+                         AsReview *review,
                          GCancellable *cancellable,
                          GError **error)
 {
@@ -891,7 +889,7 @@ gs_plugin_review_dismiss (GsPlugin *plugin,
 gboolean
 gs_plugin_review_remove (GsPlugin *plugin,
                         GsApp *app,
-                        GsReview *review,
+                        AsReview *review,
                         GCancellable *cancellable,
                         GError **error)
 {
@@ -961,12 +959,12 @@ gs_plugin_add_unvoted_reviews (GsPlugin *plugin,
                                      g_free, (GDestroyNotify) g_object_unref);
        for (i = 0; i < reviews->len; i++) {
                GsApp *app;
-               GsReview *review;
+               AsReview *review;
                const gchar *app_id;
 
                /* same app? */
                review = g_ptr_array_index (reviews, i);
-               app_id = gs_review_get_metadata_item (review, "app_id");
+               app_id = as_review_get_metadata_item (review, "app_id");
                app = g_hash_table_lookup (hash, app_id);
                if (app == NULL) {
                        app = gs_plugin_create_app_dummy (app_id);
diff --git a/src/plugins/gs-plugin-ubuntu-reviews.c b/src/plugins/gs-plugin-ubuntu-reviews.c
index e0385aa..b69c4bb 100644
--- a/src/plugins/gs-plugin-ubuntu-reviews.c
+++ b/src/plugins/gs-plugin-ubuntu-reviews.c
@@ -645,7 +645,7 @@ parse_date_time (const gchar *text)
 }
 
 static gboolean
-parse_review (GsReview *review, const gchar *our_username, JsonNode *node)
+parse_review (AsReview *review, const gchar *our_username, JsonNode *node)
 {
        JsonObject *object;
        gint64 star_rating;
@@ -657,17 +657,17 @@ parse_review (GsReview *review, const gchar *our_username, JsonNode *node)
        object = json_node_get_object (node);
 
        if (g_strcmp0 (our_username, json_object_get_string_member (object, "reviewer_username")) == 0)
-               gs_review_add_flags (review, GS_REVIEW_FLAG_SELF);
-       gs_review_set_reviewer (review, json_object_get_string_member (object, "reviewer_displayname"));
-       gs_review_set_summary (review, json_object_get_string_member (object, "summary"));
-       gs_review_set_text (review, json_object_get_string_member (object, "review_text"));
-       gs_review_set_version (review, json_object_get_string_member (object, "version"));
+               as_review_add_flags (review, AS_REVIEW_FLAG_SELF);
+       as_review_set_reviewer_name (review, json_object_get_string_member (object, "reviewer_displayname"));
+       as_review_set_summary (review, json_object_get_string_member (object, "summary"));
+       as_review_set_description (review, json_object_get_string_member (object, "review_text"));
+       as_review_set_version (review, json_object_get_string_member (object, "version"));
        star_rating = json_object_get_int_member (object, "rating");
        if (star_rating > 0)
-               gs_review_set_rating (review, star_rating * 20 - 10);
-       gs_review_set_date (review, parse_date_time (json_object_get_string_member (object, "date_created")));
+               as_review_set_rating (review, star_rating * 20 - 10);
+       as_review_set_date (review, parse_date_time (json_object_get_string_member (object, "date_created")));
        id_string = g_strdup_printf ("%" G_GINT64_FORMAT, json_object_get_int_member (object, "id"));
-       gs_review_add_metadata (review, "ubuntu-id", id_string);
+       as_review_add_metadata (review, "ubuntu-id", id_string);
 
        return TRUE;
 }
@@ -688,10 +688,10 @@ parse_reviews (GsPlugin *plugin, JsonParser *parser, GsApp *app, GCancellable *c
                return FALSE;
        array = json_node_get_array (json_parser_get_root (parser));
        for (i = 0; i < json_array_get_length (array); i++) {
-               g_autoptr(GsReview) review = NULL;
+               g_autoptr(AsReview) review = NULL;
 
                /* Read in from JSON... (skip bad entries) */
-               review = gs_review_new ();
+               review = as_review_new ();
                if (parse_review (review, consumer_key, json_array_get_element (array, i)))
                        gs_app_add_review (app, review);
        }
@@ -842,7 +842,7 @@ add_int_member (JsonBuilder *builder, const gchar *name, gint64 value)
 gboolean
 gs_plugin_review_submit (GsPlugin *plugin,
                         GsApp *app,
-                        GsReview *review,
+                        AsReview *review,
                         GCancellable *cancellable,
                         GError **error)
 {
@@ -858,7 +858,7 @@ gs_plugin_review_submit (GsPlugin *plugin,
        g_autoptr(JsonParser) result = NULL;
 
        /* Ubuntu reviews require a summary and description - just make one up for now */
-       rating = gs_review_get_rating (review);
+       rating = as_review_get_rating (review);
        if (rating > 80)
                n_stars = 5;
        else if (rating > 60)
@@ -879,12 +879,12 @@ gs_plugin_review_submit (GsPlugin *plugin,
        request = json_builder_new ();
        json_builder_begin_object (request);
        add_string_member (request, "package_name", gs_app_get_source_default (app));
-       add_string_member (request, "summary", gs_review_get_summary (review));
-       add_string_member (request, "review_text", gs_review_get_text (review));
+       add_string_member (request, "summary", as_review_get_summary (review));
+       add_string_member (request, "review_text", as_review_get_description (review));
        add_string_member (request, "language", language);
        add_string_member (request, "origin", priv->origin);
        add_string_member (request, "distroseries", priv->distroseries);
-       add_string_member (request, "version", gs_review_get_version (review));
+       add_string_member (request, "version", as_review_get_version (review));
        add_int_member (request, "rating", n_stars);
        add_string_member (request, "arch_tag", architecture);
        json_builder_end_object (request);
@@ -915,7 +915,7 @@ gs_plugin_review_submit (GsPlugin *plugin,
 gboolean
 gs_plugin_review_report (GsPlugin *plugin,
                         GsApp *app,
-                        GsReview *review,
+                        AsReview *review,
                         GCancellable *cancellable,
                         GError **error)
 {
@@ -926,7 +926,7 @@ gs_plugin_review_report (GsPlugin *plugin,
        guint status_code;
 
        /* Can only modify Ubuntu reviews */
-       review_id = gs_review_get_metadata_item (review, "ubuntu-id");
+       review_id = as_review_get_metadata_item (review, "ubuntu-id");
        if (review_id == NULL)
                return TRUE;
 
@@ -949,7 +949,7 @@ gs_plugin_review_report (GsPlugin *plugin,
                return FALSE;
        }
 
-       gs_review_add_flags (review, GS_REVIEW_FLAG_VOTED);
+       as_review_add_flags (review, AS_REVIEW_FLAG_VOTED);
        return TRUE;
 }
 
@@ -986,49 +986,49 @@ set_review_usefulness (GsPlugin *plugin,
 gboolean
 gs_plugin_review_upvote (GsPlugin *plugin,
                         GsApp *app,
-                        GsReview *review,
+                        AsReview *review,
                         GCancellable *cancellable,
                         GError **error)
 {
        const gchar *review_id;
 
        /* Can only modify Ubuntu reviews */
-       review_id = gs_review_get_metadata_item (review, "ubuntu-id");
+       review_id = as_review_get_metadata_item (review, "ubuntu-id");
        if (review_id == NULL)
                return TRUE;
 
        if (!set_review_usefulness (plugin, review_id, TRUE, cancellable, error))
                return FALSE;
 
-       gs_review_add_flags (review, GS_REVIEW_FLAG_VOTED);
+       as_review_add_flags (review, AS_REVIEW_FLAG_VOTED);
        return TRUE;
 }
 
 gboolean
 gs_plugin_review_downvote (GsPlugin *plugin,
                           GsApp *app,
-                          GsReview *review,
+                          AsReview *review,
                           GCancellable *cancellable,
                           GError **error)
 {
        const gchar *review_id;
 
        /* Can only modify Ubuntu reviews */
-       review_id = gs_review_get_metadata_item (review, "ubuntu-id");
+       review_id = as_review_get_metadata_item (review, "ubuntu-id");
        if (review_id == NULL)
                return TRUE;
 
        if (!set_review_usefulness (plugin, review_id, FALSE, cancellable, error))
                return FALSE;
 
-       gs_review_add_flags (review, GS_REVIEW_FLAG_VOTED);
+       as_review_add_flags (review, AS_REVIEW_FLAG_VOTED);
        return TRUE;
 }
 
 gboolean
 gs_plugin_review_remove (GsPlugin *plugin,
                         GsApp *app,
-                        GsReview *review,
+                        AsReview *review,
                         GCancellable *cancellable,
                         GError **error)
 {
@@ -1037,7 +1037,7 @@ gs_plugin_review_remove (GsPlugin *plugin,
        guint status_code;
 
        /* Can only modify Ubuntu reviews */
-       review_id = gs_review_get_metadata_item (review, "ubuntu-id");
+       review_id = as_review_get_metadata_item (review, "ubuntu-id");
        if (review_id == NULL)
                return TRUE;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]