From 45344cdf7c0ded79b6f4f642a0b0f501e1da4679 Mon Sep 17 00:00:00 2001 From: Hans Breuer Date: Sun, 26 Jul 2009 19:10:13 +0200 Subject: [PATCH] Use G_DEFINE_TYPE (GdkDrawableImplWin32, ...) --- gdk/win32/gdkdrawable-win32.c | 41 +++++++---------------------------- gdk/win32/gdkdrawable-win32.h | 4 ++-- 2 files changed, 10 insertions(+), 35 deletions(-) diff --git a/gdk/win32/gdkdrawable-win32.c b/gdk/win32/gdkdrawable-win32.c index 8975c9cb78..77b0206f57 100644 --- a/gdk/win32/gdkdrawable-win32.c +++ b/gdk/win32/gdkdrawable-win32.c @@ -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); } /***************************************************** diff --git a/gdk/win32/gdkdrawable-win32.h b/gdk/win32/gdkdrawable-win32.h index 72082705af..32649d8403 100644 --- a/gdk/win32/gdkdrawable-win32.h +++ b/gdk/win32/gdkdrawable-win32.h @@ -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);