mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-06-03 11:20:07 +02:00
cocoa: add support for GBytesIcon in notification backend
This commit is contained in:
parent
e237ec6c81
commit
cf44fb0d2a
@ -29,6 +29,7 @@
|
|||||||
#include "giomodule-priv.h"
|
#include "giomodule-priv.h"
|
||||||
#include "gnotification-private.h"
|
#include "gnotification-private.h"
|
||||||
#include "gthemedicon.h"
|
#include "gthemedicon.h"
|
||||||
|
#include "gbytesicon.h"
|
||||||
#include "gfileicon.h"
|
#include "gfileicon.h"
|
||||||
#include "gfile.h"
|
#include "gfile.h"
|
||||||
|
|
||||||
@ -78,6 +79,22 @@ nsimage_from_gicon (GIcon *icon)
|
|||||||
}
|
}
|
||||||
return image;
|
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
|
else
|
||||||
{
|
{
|
||||||
g_warning ("This icon type is not handled by this NotificationBackend");
|
g_warning ("This icon type is not handled by this NotificationBackend");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user