GNOME Bugzilla – Bug 608679
GdkPixbufFormat needs a registered GType
Last modified: 2010-07-10 04:05:54 UTC
GdkPixbufFormat needs a registered GType, otherwise it will not be possible to use it cleanly from language bindings. Something like this should work: static GdkPixbufFormat* gdk_pixbuf_format_copy (const GdkPixbufFormat *format) { GdkPixbufFormat *new_format; g_return_val_if_fail (format != NULL, NULL); new_format = g_slice_new (GdkPixbufFormat); *new_format = *format; return new_format; } static void gdk_pixbuf_format_free (GdkPixbufFormat *format) { g_return_if_fail (format != NULL); g_slice_free (GdkPixbufFormat, format); } GType gdk_pixbuf_format_get_type (void) { static GType our_type = 0; if (our_type == 0) our_type = g_boxed_type_register_static (g_intern_static_string "GdkPixbufFormat"), (GBoxedCopyFunc)gdk_pixbuf_format_copy, (GBoxedFreeFunc)gdk_pixbuf_format_free); return our_type; }
Should probably use g_once_init_enter/_leave like other get_type functions, but looks fine otherwise. Can you turn this into a complete patch (with docs and .symbols) ?
Created attachment 164679 [details] [review] Add a GType for GdkPixbufFormat A simple boxed type, for use in language bindings.