[gnome-software/wip/rancell/reviews] Only show reviews in your language
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/wip/rancell/reviews] Only show reviews in your language
- Date: Wed, 24 Feb 2016 02:56:10 +0000 (UTC)
commit 982774e3a97c779fe5c0eb3643cfdc7070b4e6fc
Author: Robert Ancell <robert ancell canonical com>
Date: Wed Feb 24 15:55:52 2016 +1300
Only show reviews in your language
src/plugins/gs-plugin-ubuntu-reviews.c | 26 ++++++++++++++++++--------
1 files changed, 18 insertions(+), 8 deletions(-)
---
diff --git a/src/plugins/gs-plugin-ubuntu-reviews.c b/src/plugins/gs-plugin-ubuntu-reviews.c
index 3712182..ee6a4e0 100644
--- a/src/plugins/gs-plugin-ubuntu-reviews.c
+++ b/src/plugins/gs-plugin-ubuntu-reviews.c
@@ -607,16 +607,31 @@ parse_reviews (GsPlugin *plugin, JsonParser *parser, GsApp *app, GError **error)
return TRUE;
}
+static gchar *
+get_language (GsPlugin *plugin)
+{
+ gchar *language, *c;
+
+ /* Convert locale into language */
+ language = g_strdup (plugin->locale);
+ c = strchr (language, '_');
+ if (c)
+ *c = '\0';
+
+ return language;
+}
+
static gboolean
download_reviews (GsPlugin *plugin, GsApp *app, const gchar *package_name, GError **error)
{
- g_autofree gchar *path = NULL;
+ g_autofree gchar *language = NULL, *path = NULL;
JsonParser *result;
gboolean ret;
/* Get the review stats using HTTP */
// FIXME: This will only get the first page of reviews
- path = g_strdup_printf ("/api/1.0/reviews/filter/any/any/any/any/%s/", package_name);
+ language = get_language (plugin);
+ path = g_strdup_printf ("/api/1.0/reviews/filter/%s/any/any/any/%s/", language, package_name);
if (!send_review_request (plugin, SOUP_METHOD_GET, path, NULL, FALSE, &result, error))
return FALSE;
@@ -750,7 +765,6 @@ set_package_review (GsPlugin *plugin,
gint rating;
gint n_stars;
g_autofree gchar *os_id = NULL, *os_ubuntu_codename = NULL, *language = NULL, *architecture = NULL;
- gchar *c;
JsonBuilder *request;
gboolean ret;
@@ -774,11 +788,7 @@ set_package_review (GsPlugin *plugin,
if (os_ubuntu_codename == NULL)
return FALSE;
- /* Convert locale into language */
- language = g_strdup (plugin->locale);
- c = strchr (language, '_');
- if (c)
- *c = '\0';
+ language = get_language (plugin);
// FIXME: Need to get Apt::Architecture configuration value from APT
architecture = g_strdup ("amd64");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]