From cf44fb0d2aaadfbe37d4513cef36d863d48acf81 Mon Sep 17 00:00:00 2001 From: Marvin W Date: Fri, 18 Apr 2025 14:36:34 +0200 Subject: [PATCH] cocoa: add support for GBytesIcon in notification backend --- gio/gcocoanotificationbackend.m | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/gio/gcocoanotificationbackend.m b/gio/gcocoanotificationbackend.m index 15c4433f4..0598c646f 100644 --- a/gio/gcocoanotificationbackend.m +++ b/gio/gcocoanotificationbackend.m @@ -29,6 +29,7 @@ #include "giomodule-priv.h" #include "gnotification-private.h" #include "gthemedicon.h" +#include "gbytesicon.h" #include "gfileicon.h" #include "gfile.h" @@ -78,6 +79,22 @@ nsimage_from_gicon (GIcon *icon) } return image; } + else if (G_IS_BYTES_ICON (icon)) + { + NSImage *image = nil; + GBytes *bytes; + gconstpointer bytes_data; + gsize bytes_size; + NSData *data; + + bytes = g_bytes_icon_get_bytes (G_BYTES_ICON (icon)); + bytes_data = g_bytes_get_data (bytes, &bytes_size); + data = [[NSData alloc] initWithBytes:bytes_data + length:bytes_size]; + + image = [[NSImage alloc] initWithData:data]; + return image; + } else { g_warning ("This icon type is not handled by this NotificationBackend");