Commit 330f9555 authored by Emmanuele Bassi's avatar Emmanuele Bassi Committed by Matthias Clasen

Add a GType for GdkPixbufFormat

A simple boxed type, for use in language bindings.

http://bugzilla.gnome.org/show_bug.cgi?id=608679
parent ff29ffcd
......@@ -2672,6 +2672,55 @@ gdk_pixbuf_get_formats (void)
return result;
}
/**
* gdk_pixbuf_format_copy:
* @format: a #GdkPixbufFormat
*
* Creates a copy of @format
*
* Return value: the newly allocated copy of a #GdkPixbufFormat. Use
* gdk_pixbuf_format_free() to free the resources when done
*
* Since: 2.22
*/
GdkPixbufFormat *
gdk_pixbuf_format_copy (const GdkPixbufFormat *format)
{
if (G_LIKELY (format != NULL))
return g_slice_dup (GdkPixbufFormat, format);
return NULL;
}
/**
* gdk_pixbuf_format_free:
* @format: a #GdkPixbufFormat
*
* Frees the resources allocated when copying a #GdkPixbufFormat
* using gdk_pixbuf_format_copy()
*
* Since: 2.22
*/
void
gdk_pixbuf_format_free (GdkPixbufFormat *format)
{
if (G_LIKELY (format != NULL))
g_slice_free (GdkPixbufFormat, format);
}
GType
gdk_pixbuf_format_get_type (void)
{
static volatile gsize format_id__volatile = 0;
if (g_once_init_enter (&format_id__volatile)) {
GType format_id =
g_boxed_type_register_static (g_intern_static_string ("GdkPixbufFormat"),
(GBoxedCopyFunc) gdk_pixbuf_format_copy,
(GBoxedFreeFunc) gdk_pixbuf_format_free);
g_once_init_leave (&format_id__volatile, format_id);
}
return format_id__volatile;
}
#define __GDK_PIXBUF_IO_C__
#include "gdk-pixbuf-aliasdef.c"
......@@ -43,6 +43,8 @@ G_BEGIN_DECLS
typedef struct _GdkPixbufFormat GdkPixbufFormat;
GType gdk_pixbuf_format_get_type (void) G_GNUC_CONST;
GSList *gdk_pixbuf_get_formats (void);
gchar *gdk_pixbuf_format_get_name (GdkPixbufFormat *format);
gchar *gdk_pixbuf_format_get_description (GdkPixbufFormat *format);
......@@ -59,6 +61,9 @@ GdkPixbufFormat *gdk_pixbuf_get_file_info (const gchar *filename,
gint *width,
gint *height);
GdkPixbufFormat *gdk_pixbuf_format_copy (const GdkPixbufFormat *format);
void gdk_pixbuf_format_free (GdkPixbufFormat *format);
#ifdef GDK_PIXBUF_ENABLE_BACKEND
......@@ -164,7 +169,6 @@ struct _GdkPixbufFormat {
gchar *license;
};
#endif /* GDK_PIXBUF_ENABLE_BACKEND */
G_END_DECLS
......
......@@ -146,6 +146,9 @@ gdk_pixbuf_scaled_anim_iter_get_type G_GNUC_CONST
#if IN_HEADER(GDK_PIXBUF_IO_H)
#if IN_FILE(__GDK_PIXBUF_IO_C__)
gdk_pixbuf_get_formats
gdk_pixbuf_format_get_type G_GNUC_CONST;
gdk_pixbuf_format_copy
gdk_pixbuf_format_free
gdk_pixbuf_format_get_description
gdk_pixbuf_format_get_extensions
gdk_pixbuf_format_get_license
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment