After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 608679 - GdkPixbufFormat needs a registered GType
GdkPixbufFormat needs a registered GType
Status: RESOLVED FIXED
Product: gdk-pixbuf
Classification: Platform
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2010-02-01 13:53 UTC by Johan (not receiving bugmail) Dahlin
Modified: 2010-07-10 04:05 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add a GType for GdkPixbufFormat (4.53 KB, patch)
2010-06-26 14:29 UTC, Emmanuele Bassi (:ebassi)
none Details | Review

Description Johan (not receiving bugmail) Dahlin 2010-02-01 13:53:50 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;
}
Comment 1 Matthias Clasen 2010-02-01 17:58:06 UTC
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) ?
Comment 2 Emmanuele Bassi (:ebassi) 2010-06-26 14:29:59 UTC
Created attachment 164679 [details] [review]
Add a GType for GdkPixbufFormat

A simple boxed type, for use in language bindings.