[gnome-software/wip/temp/ubuntu-xenial-rebased-corrected: 294/331] Download three pages of reviews
- From: William Hua <williamhua src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/wip/temp/ubuntu-xenial-rebased-corrected: 294/331] Download three pages of reviews
- Date: Wed, 4 May 2016 14:23:14 +0000 (UTC)
commit 4bd0e11c35d39725f0c1cf31cef692fa765e9eed
Author: Robert Ancell <robert ancell canonical com>
Date: Mon Apr 25 15:48:28 2016 +0200
Download three pages of reviews
src/plugins/gs-plugin-ubuntu-reviews.c | 18 ++++++++++++------
1 files changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/src/plugins/gs-plugin-ubuntu-reviews.c b/src/plugins/gs-plugin-ubuntu-reviews.c
index bb20d8b..6f2e8e6 100644
--- a/src/plugins/gs-plugin-ubuntu-reviews.c
+++ b/src/plugins/gs-plugin-ubuntu-reviews.c
@@ -59,6 +59,9 @@ gs_plugin_get_name (void)
// FIXME: Much shorter time?
#define REVIEW_STATS_AGE_MAX (60 * 60 * 24 * 7 * 4 * 3)
+/* Number of pages of reviews to download */
+#define N_PAGES 3
+
void
gs_plugin_initialize (GsPlugin *plugin)
{
@@ -1042,7 +1045,7 @@ get_language (GsPlugin *plugin)
}
static gboolean
-download_reviews (GsPlugin *plugin, GsApp *app, const gchar *package_name, GError **error)
+download_reviews (GsPlugin *plugin, GsApp *app, const gchar *package_name, gint page_number, GError **error)
{
g_autofree gchar *language = NULL, *path = NULL;
g_autoptr(JsonParser) result = NULL;
@@ -1143,7 +1146,7 @@ static gboolean
refine_reviews (GsPlugin *plugin, GsApp *app, GError **error)
{
GPtrArray *sources;
- guint i;
+ guint i, j;
if (!get_ubuntuone_credentials (plugin, FALSE, error))
return FALSE;
@@ -1155,12 +1158,15 @@ refine_reviews (GsPlugin *plugin, GsApp *app, GError **error)
sources = gs_app_get_sources (app);
for (i = 0; i < sources->len; i++) {
const gchar *package_name;
- gboolean ret;
package_name = g_ptr_array_index (sources, i);
- ret = download_reviews (plugin, app, package_name, error);
- if (!ret)
- return FALSE;
+ for (j = 0; j < N_PAGES; j++) {
+ gboolean ret;
+
+ ret = download_reviews (plugin, app, package_name, j, error);
+ if (!ret)
+ return FALSE;
+ }
}
return TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]