[gnome-software/mwleeds/hardcoded-pwa-list] WIP



commit 28e59c5ac1bbf3dca179bd7f26f0e6f8bc3187b6
Author: Phaedrus Leeds <mwleeds protonmail com>
Date:   Wed Mar 9 15:56:35 2022 -0800

    WIP

 plugins/epiphany/gs-plugin-epiphany.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/plugins/epiphany/gs-plugin-epiphany.c b/plugins/epiphany/gs-plugin-epiphany.c
index d29e2e05b..5b8333df5 100644
--- a/plugins/epiphany/gs-plugin-epiphany.c
+++ b/plugins/epiphany/gs-plugin-epiphany.c
@@ -710,6 +710,7 @@ get_serialized_icon (GsApp *app,
        g_autoptr(GBytes) bytes = NULL;
        g_autoptr(GIcon) bytes_icon = NULL;
        g_autoptr(GVariant) icon_v = NULL;
+       guint icon_width;
 
        /* Note: GsRemoteIcon will work on this GFileIcon code path.
         * The icons plugin should have called
@@ -728,10 +729,15 @@ get_serialized_icon (GsApp *app,
                return NULL;
        }
 
+       /* Scale down to the portal's size limit if needed */
+       icon_width = gs_icon_get_width (icon);
+       if (icon_width > 512)
+               icon_width = 512;
+
        /* Serialize the icon as a #GBytesIcon since that's
         * what the dynamic launcher portal requires.
         */
-       stream = g_loadable_icon_load (G_LOADABLE_ICON (icon), 0, NULL, NULL, NULL);
+       stream = g_loadable_icon_load (G_LOADABLE_ICON (icon), icon_width, NULL, NULL, NULL);
 
        /* Icons are usually smaller than 1 MiB. Set a 10 MiB
         * limit so we can't use a huge amount of memory or hit


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