mirror of
				https://gitlab.gnome.org/GNOME/glib.git
				synced 2025-10-28 15:02:17 +01:00 
			
		
		
		
	cocoa: add support for GBytesIcon in notification backend
This commit is contained in:
		| @@ -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"); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user