Use G_DEFINE_TYPE
This commit is contained in:
@ -1,5 +1,8 @@
|
|||||||
2006-04-04 Matthias Clasen <mclasen@redhat.com>
|
2006-04-04 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* gdk-pixbuf-loader.c:
|
||||||
|
* gdk-pixbuf.c: Use G_DEFINE_TYPE.
|
||||||
|
|
||||||
* gdk-pixbuf.c: No point in making the error path fast by
|
* gdk-pixbuf.c: No point in making the error path fast by
|
||||||
caching quarks.
|
caching quarks.
|
||||||
|
|
||||||
|
|||||||
@ -43,11 +43,8 @@ enum {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static void gdk_pixbuf_loader_class_init (GdkPixbufLoaderClass *klass);
|
static void gdk_pixbuf_loader_finalize (GObject *loader);
|
||||||
static void gdk_pixbuf_loader_init (GdkPixbufLoader *loader);
|
|
||||||
static void gdk_pixbuf_loader_finalize (GObject *loader);
|
|
||||||
|
|
||||||
static gpointer parent_class = NULL;
|
|
||||||
static guint pixbuf_loader_signals[LAST_SIGNAL] = { 0 };
|
static guint pixbuf_loader_signals[LAST_SIGNAL] = { 0 };
|
||||||
|
|
||||||
/* Internal data */
|
/* Internal data */
|
||||||
@ -69,42 +66,7 @@ typedef struct
|
|||||||
gboolean needs_scale;
|
gboolean needs_scale;
|
||||||
} GdkPixbufLoaderPrivate;
|
} GdkPixbufLoaderPrivate;
|
||||||
|
|
||||||
|
G_DEFINE_TYPE(GdkPixbufLoader, gdk_pixbuf_loader, G_TYPE_OBJECT);
|
||||||
/**
|
|
||||||
* gdk_pixbuf_loader_get_type:
|
|
||||||
*
|
|
||||||
* Registers the #GdkPixbufLoader class if necessary, and returns the type ID
|
|
||||||
* associated to it.
|
|
||||||
*
|
|
||||||
* Return value: The type ID of the #GdkPixbufLoader class.
|
|
||||||
**/
|
|
||||||
GType
|
|
||||||
gdk_pixbuf_loader_get_type (void)
|
|
||||||
{
|
|
||||||
static GType loader_type = 0;
|
|
||||||
|
|
||||||
if (!loader_type)
|
|
||||||
{
|
|
||||||
static const GTypeInfo loader_info = {
|
|
||||||
sizeof (GdkPixbufLoaderClass),
|
|
||||||
(GBaseInitFunc) NULL,
|
|
||||||
(GBaseFinalizeFunc) NULL,
|
|
||||||
(GClassInitFunc) gdk_pixbuf_loader_class_init,
|
|
||||||
NULL, /* class_finalize */
|
|
||||||
NULL, /* class_data */
|
|
||||||
sizeof (GdkPixbufLoader),
|
|
||||||
0, /* n_preallocs */
|
|
||||||
(GInstanceInitFunc) gdk_pixbuf_loader_init
|
|
||||||
};
|
|
||||||
|
|
||||||
loader_type = g_type_register_static (G_TYPE_OBJECT,
|
|
||||||
g_intern_static_string ("GdkPixbufLoader"),
|
|
||||||
&loader_info,
|
|
||||||
0);
|
|
||||||
}
|
|
||||||
|
|
||||||
return loader_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gdk_pixbuf_loader_class_init (GdkPixbufLoaderClass *class)
|
gdk_pixbuf_loader_class_init (GdkPixbufLoaderClass *class)
|
||||||
@ -113,8 +75,6 @@ gdk_pixbuf_loader_class_init (GdkPixbufLoaderClass *class)
|
|||||||
|
|
||||||
object_class = (GObjectClass *) class;
|
object_class = (GObjectClass *) class;
|
||||||
|
|
||||||
parent_class = g_type_class_peek_parent (class);
|
|
||||||
|
|
||||||
object_class->finalize = gdk_pixbuf_loader_finalize;
|
object_class->finalize = gdk_pixbuf_loader_finalize;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -236,7 +196,7 @@ gdk_pixbuf_loader_finalize (GObject *object)
|
|||||||
|
|
||||||
g_free (priv);
|
g_free (priv);
|
||||||
|
|
||||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
G_OBJECT_CLASS (gdk_pixbuf_loader_parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -32,7 +32,6 @@
|
|||||||
#include "gdk-pixbuf-private.h"
|
#include "gdk-pixbuf-private.h"
|
||||||
#include "gdk-pixbuf-alias.h"
|
#include "gdk-pixbuf-alias.h"
|
||||||
|
|
||||||
static void gdk_pixbuf_class_init (GdkPixbufClass *klass);
|
|
||||||
static void gdk_pixbuf_finalize (GObject *object);
|
static void gdk_pixbuf_finalize (GObject *object);
|
||||||
static void gdk_pixbuf_set_property (GObject *object,
|
static void gdk_pixbuf_set_property (GObject *object,
|
||||||
guint prop_id,
|
guint prop_id,
|
||||||
@ -57,32 +56,11 @@ enum
|
|||||||
PROP_PIXELS
|
PROP_PIXELS
|
||||||
};
|
};
|
||||||
|
|
||||||
static gpointer parent_class;
|
G_DEFINE_TYPE(GdkPixbuf, gdk_pixbuf, G_TYPE_OBJECT)
|
||||||
|
|
||||||
GType
|
static void
|
||||||
gdk_pixbuf_get_type (void)
|
gdk_pixbuf_init (GdkPixbuf *pixbuf)
|
||||||
{
|
{
|
||||||
static GType object_type = 0;
|
|
||||||
|
|
||||||
if (!object_type) {
|
|
||||||
static const GTypeInfo object_info = {
|
|
||||||
sizeof (GdkPixbufClass),
|
|
||||||
(GBaseInitFunc) NULL,
|
|
||||||
(GBaseFinalizeFunc) NULL,
|
|
||||||
(GClassInitFunc) gdk_pixbuf_class_init,
|
|
||||||
NULL, /* class_finalize */
|
|
||||||
NULL, /* class_data */
|
|
||||||
sizeof (GdkPixbuf),
|
|
||||||
0, /* n_preallocs */
|
|
||||||
(GInstanceInitFunc) NULL,
|
|
||||||
};
|
|
||||||
|
|
||||||
object_type = g_type_register_static (G_TYPE_OBJECT,
|
|
||||||
g_intern_static_string ("GdkPixbuf"),
|
|
||||||
&object_info, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
return object_type;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -90,8 +68,6 @@ gdk_pixbuf_class_init (GdkPixbufClass *klass)
|
|||||||
{
|
{
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||||
|
|
||||||
parent_class = g_type_class_peek_parent (klass);
|
|
||||||
|
|
||||||
object_class->finalize = gdk_pixbuf_finalize;
|
object_class->finalize = gdk_pixbuf_finalize;
|
||||||
object_class->set_property = gdk_pixbuf_set_property;
|
object_class->set_property = gdk_pixbuf_set_property;
|
||||||
object_class->get_property = gdk_pixbuf_get_property;
|
object_class->get_property = gdk_pixbuf_get_property;
|
||||||
@ -200,7 +176,7 @@ gdk_pixbuf_finalize (GObject *object)
|
|||||||
if (pixbuf->destroy_fn)
|
if (pixbuf->destroy_fn)
|
||||||
(* pixbuf->destroy_fn) (pixbuf->pixels, pixbuf->destroy_fn_data);
|
(* pixbuf->destroy_fn) (pixbuf->pixels, pixbuf->destroy_fn_data);
|
||||||
|
|
||||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
G_OBJECT_CLASS (gdk_pixbuf_parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user