[gnome-software: 1/6] snap: Fix use of outdated GsApp pixbuf API




commit b5e04d24927c9c15938e190dd43288935944a5fb
Author: Philip Withnall <pwithnall endlessos org>
Date:   Sun Mar 14 15:54:48 2021 +0000

    snap: Fix use of outdated GsApp pixbuf API
    
    This port should have been done as part of f49a7403256.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>
    
    Helps: #1170

 plugins/snap/gs-plugin-snap.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)
---
diff --git a/plugins/snap/gs-plugin-snap.c b/plugins/snap/gs-plugin-snap.c
index 18596d143..c49544d7b 100644
--- a/plugins/snap/gs-plugin-snap.c
+++ b/plugins/snap/gs-plugin-snap.c
@@ -721,8 +721,7 @@ load_snap_icon (GsApp *app, SnapdClient *client, SnapdSnap *snap, GCancellable *
 {
        const gchar *icon_url;
        g_autoptr(SnapdIcon) icon = NULL;
-       g_autoptr(GInputStream) input_stream = NULL;
-       g_autoptr(GdkPixbuf) pixbuf = NULL;
+       g_autoptr(GIcon) gicon = NULL;
        g_autoptr(GError) error = NULL;
 
        icon_url = snapd_snap_get_icon (snap);
@@ -736,13 +735,8 @@ load_snap_icon (GsApp *app, SnapdClient *client, SnapdSnap *snap, GCancellable *
                return FALSE;
        }
 
-       input_stream = g_memory_input_stream_new_from_bytes (snapd_icon_get_data (icon));
-       pixbuf = gdk_pixbuf_new_from_stream_at_scale (input_stream, 64, 64, TRUE, cancellable, &error);
-       if (pixbuf == NULL) {
-               g_warning ("Failed to decode snap icon %s: %s", icon_url, error->message);
-               return FALSE;
-       }
-       gs_app_add_pixbuf (app, pixbuf);
+       gicon = g_bytes_icon_new (snapd_icon_get_data (icon));
+       gs_app_add_icon (app, gicon);
 
        return TRUE;
 }


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