[gnome-software] Allow loading remote icons specified with file://



commit 33c042f2f10e1abdbd78f139eb3ecec5b12d6116
Author: Richard Hughes <richard hughsie com>
Date:   Sat Apr 16 20:21:32 2016 +0100

    Allow loading remote icons specified with file://
    
    Somewhat of an edge-case, but allows us to write unit tests.

 src/plugins/gs-plugin-icons.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/src/plugins/gs-plugin-icons.c b/src/plugins/gs-plugin-icons.c
index 16fd3b6..e16b0c5 100644
--- a/src/plugins/gs-plugin-icons.c
+++ b/src/plugins/gs-plugin-icons.c
@@ -138,6 +138,13 @@ gs_plugin_refine_app (GsPlugin *plugin,
        if (as_icon_get_filename (ic) == NULL)
                return TRUE;
 
+       /* local */
+       if (g_str_has_prefix (as_icon_get_url (ic), "file://")) {
+               as_icon_set_filename (ic, as_icon_get_url (ic) + 7);
+               as_icon_set_kind (ic, AS_ICON_KIND_LOCAL);
+               return gs_app_load_icon (app, plugin->scale, error);
+       }
+
        /* convert filename from jpg to png */
        fn = as_icon_get_filename (ic);
        found = g_strstr_len (fn, -1, ".jpg");


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]