[gnome-software: 1/3] Handle cached AppStream icons not being installed.




commit 6f52f77708ab0137d931a23269c28d7b36f38d29
Author: Robert Ancell <robert ancell canonical com>
Date:   Fri Feb 4 16:22:26 2022 +1300

    Handle cached AppStream icons not being installed.
    
    On Debian/Ubuntu only the 64x64 and 48x48 icons are instaled by default in the apt-config-icons package.
    If the 128x128 icons are required, the apt-config-icons-large package needs to be installed.
    Without this package installed the expected behaviour is for the icon to be downloaded from the URL.

 lib/gs-app.c | 8 ++++++++
 1 file changed, 8 insertions(+)
---
diff --git a/lib/gs-app.c b/lib/gs-app.c
index f03c753f7..8905db05e 100644
--- a/lib/gs-app.c
+++ b/lib/gs-app.c
@@ -1892,6 +1892,14 @@ gs_app_get_icon_for_size (GsApp       *app,
                g_debug ("\tConsidering icon of type %s (%s), width %u×%u",
                         G_OBJECT_TYPE_NAME (icon), icon_str, icon_width, icon_scale);
 
+               /* Ignore icons that aren't in the cache - Appstream doesn't require them to be present */
+               if (G_IS_FILE_ICON (icon)) {
+                       GFile *file = g_file_icon_get_file (G_FILE_ICON (icon));
+                       if (!g_file_query_exists (file, NULL)) {
+                               continue;
+                       }
+               }
+
                /* Ignore icons with unknown width and skip over ones which
                 * are too small. */
                if (icon_width == 0 || icon_width * icon_scale < size * scale)


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