[gnome-software] Only show Ubuntu reviews in your language
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Only show Ubuntu reviews in your language
- Date: Wed, 24 Feb 2016 03:12:21 +0000 (UTC)
commit 961f0c56e7c914f3babcbfbf6e665ec7ccc23c99
Author: Robert Ancell <robert ancell canonical com>
Date: Wed Feb 24 16:11:47 2016 +1300
Only show Ubuntu reviews in your language
src/plugins/gs-plugin-ubuntu-reviews.c | 19 +++++++++++++++++--
1 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/src/plugins/gs-plugin-ubuntu-reviews.c b/src/plugins/gs-plugin-ubuntu-reviews.c
index 13927c7..35e40f6 100644
--- a/src/plugins/gs-plugin-ubuntu-reviews.c
+++ b/src/plugins/gs-plugin-ubuntu-reviews.c
@@ -557,16 +557,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, &result, error))
return FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]