[gnome-software] Load screenshots directly if their URLs point to local files
- From: Joaquim Manuel Pereira Rocha <jrocha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Load screenshots directly if their URLs point to local files
- Date: Wed, 6 Apr 2016 15:49:15 +0000 (UTC)
commit f482eba95ccce61a84f7fdba3c0d4b2e63b833df
Author: Joaquim Rocha <jrocha endlessm com>
Date: Wed Apr 6 16:44:46 2016 +0100
Load screenshots directly if their URLs point to local files
src/gs-screenshot-image.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/src/gs-screenshot-image.c b/src/gs-screenshot-image.c
index e2f3b76..b72dda1 100644
--- a/src/gs-screenshot-image.c
+++ b/src/gs-screenshot-image.c
@@ -379,7 +379,17 @@ gs_screenshot_image_load_async (GsScreenshotImage *ssimg,
gs_screenshot_image_set_error (ssimg, _("Screenshot size not found"));
return;
}
+
+ /* check if the URL points to a local file */
url = as_image_get_url (im);
+ if (g_str_has_prefix (url, "file://")) {
+ ssimg->filename = g_strdup (url + 7);
+ if (g_file_test (ssimg->filename, G_FILE_TEST_EXISTS)) {
+ as_screenshot_show_image (ssimg);
+ return;
+ }
+ }
+
basename = gs_screenshot_get_cachefn_for_url (url);
if (ssimg->width == G_MAXUINT || ssimg->height == G_MAXUINT) {
sizedir = g_strdup ("unknown");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]