[gnome-software] Show screenshots for snaps (requires snapd 2.15.2)
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Show screenshots for snaps (requires snapd 2.15.2)
- Date: Wed, 26 Oct 2016 21:49:21 +0000 (UTC)
commit f9cc742b29cb226a24afc7cd28c023b1ec0bffae
Author: Robert Ancell <robert ancell canonical com>
Date: Mon Oct 3 13:15:49 2016 +1300
Show screenshots for snaps (requires snapd 2.15.2)
src/plugins/gs-plugin-snap.c | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/src/plugins/gs-plugin-snap.c b/src/plugins/gs-plugin-snap.c
index 78a9191..5736ff2 100644
--- a/src/plugins/gs-plugin-snap.c
+++ b/src/plugins/gs-plugin-snap.c
@@ -188,6 +188,26 @@ refine_app (GsPlugin *plugin, GsApp *app, JsonObject *package, gboolean from_sea
gs_app_add_icon (app, icon);
}
+ if (json_object_has_member (package, "screenshots") && gs_app_get_screenshots (app)->len <= 0) {
+ JsonArray *screenshots;
+ guint i;
+
+ screenshots = json_object_get_array_member (package, "screenshots");
+ for (i = 0; i < json_array_get_length (screenshots); i++) {
+ JsonObject *screenshot = json_array_get_object_element (screenshots, i);
+ g_autoptr(AsScreenshot) ss = NULL;
+ g_autoptr(AsImage) image = NULL;
+
+ ss = as_screenshot_new ();
+ as_screenshot_set_kind (ss, AS_SCREENSHOT_KIND_NORMAL);
+ image = as_image_new ();
+ as_image_set_url (image, json_object_get_string_member (screenshot, "url"));
+ as_image_set_kind (image, AS_IMAGE_KIND_SOURCE);
+ as_screenshot_add_image (ss, image);
+ gs_app_add_screenshot (app, ss);
+ }
+ }
+
if (!from_search) {
JsonArray *apps;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]