Use G_DEFINE_TYPE (GdkDrawableImplWin32, ...)

This commit is contained in:
Hans Breuer 2009-07-26 19:10:13 +02:00
parent c5c87a918f
commit 45344cdf7c
2 changed files with 10 additions and 35 deletions

View File

@ -129,49 +129,19 @@ static GdkScreen * gdk_win32_get_screen (GdkDrawable *drawable);
static GdkVisual* gdk_win32_get_visual (GdkDrawable *drawable);
static void gdk_drawable_impl_win32_class_init (GdkDrawableImplWin32Class *klass);
static void gdk_drawable_impl_win32_finalize (GObject *object);
static gpointer parent_class = NULL;
static const cairo_user_data_key_t gdk_win32_cairo_key;
GType
gdk_drawable_impl_win32_get_type (void)
{
static GType object_type = 0;
G_DEFINE_TYPE (GdkDrawableImplWin32, _gdk_drawable_impl_win32, GDK_TYPE_DRAWABLE)
if (!object_type)
{
static const GTypeInfo object_info =
{
sizeof (GdkDrawableImplWin32Class),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gdk_drawable_impl_win32_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GdkDrawableImplWin32),
0, /* n_preallocs */
(GInstanceInitFunc) NULL,
};
object_type = g_type_register_static (GDK_TYPE_DRAWABLE,
"GdkDrawableImplWin32",
&object_info, 0);
}
return object_type;
}
static void
gdk_drawable_impl_win32_class_init (GdkDrawableImplWin32Class *klass)
_gdk_drawable_impl_win32_class_init (GdkDrawableImplWin32Class *klass)
{
GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->finalize = gdk_drawable_impl_win32_finalize;
drawable_class->create_gc = _gdk_win32_gc_new;
@ -198,12 +168,17 @@ gdk_drawable_impl_win32_class_init (GdkDrawableImplWin32Class *klass)
drawable_class->_copy_to_image = _gdk_win32_copy_to_image;
}
static void
_gdk_drawable_impl_win32_init (GdkDrawableImplWin32 *impl)
{
}
static void
gdk_drawable_impl_win32_finalize (GObject *object)
{
gdk_drawable_set_colormap (GDK_DRAWABLE (object), NULL);
G_OBJECT_CLASS (parent_class)->finalize (object);
G_OBJECT_CLASS (_gdk_drawable_impl_win32_parent_class)->finalize (object);
}
/*****************************************************

View File

@ -38,7 +38,7 @@ G_BEGIN_DECLS
typedef struct _GdkDrawableImplWin32 GdkDrawableImplWin32;
typedef struct _GdkDrawableImplWin32Class GdkDrawableImplWin32Class;
#define GDK_TYPE_DRAWABLE_IMPL_WIN32 (gdk_drawable_impl_win32_get_type ())
#define GDK_TYPE_DRAWABLE_IMPL_WIN32 (_gdk_drawable_impl_win32_get_type ())
#define GDK_DRAWABLE_IMPL_WIN32(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_DRAWABLE_IMPL_WIN32, GdkDrawableImplWin32))
#define GDK_DRAWABLE_IMPL_WIN32_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DRAWABLE_IMPL_WIN32, GdkDrawableImplWin32Class))
#define GDK_IS_DRAWABLE_IMPL_WIN32(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_DRAWABLE_IMPL_WIN32))
@ -63,7 +63,7 @@ struct _GdkDrawableImplWin32Class
GdkDrawableClass parent_class;
};
GType gdk_drawable_impl_win32_get_type (void);
GType _gdk_drawable_impl_win32_get_type (void);
HDC _gdk_win32_drawable_acquire_dc (GdkDrawable *drawable);
void _gdk_win32_drawable_release_dc (GdkDrawable *drawable);