Commit 10f0736a authored by Matthias Clasen's avatar Matthias Clasen Committed by Matthias Clasen

Use G_DEFINE_TYPE.

2006-04-04  Matthias Clasen  <mclasen@redhat.com>

	* gdk/gdkdisplay.c:
	* gdk/gdkdisplaymanager.c:
	* gdk/gdkdraw.c:
	* gdk/gdkkeys.c:
	* gdk/gdkpixmap.c:
	* gdk/gdkscreen.c:
	* gdk/gdkwindow.c:
	* gdk/x11/gdkcolor-x11.c:
	* gdk/x11/gdkdisplay-x11.c:
	* gdk/x11/gdkdnd-x11.c:
	* gdk/x11/gdkdrawable-x11.c:
	* gdk/x11/gdkgc-x11.c:
	* gdk/x11/gdkimage-x11.c:
	* gdk/x11/gdkinput.c:
	* gdk/x11/gdkpixmap-x11.c:
	* gdk/x11/gdkscreen-x11.c:
	* gdk/x11/gdkwindow-x11.c: Use G_DEFINE_TYPE.

	* gdk/x11/gdkcolor-x11.c:
	* gdk/x11/gdkdnd-x11.c:
	* gdk/x11/gdkimage-x11.c: Use instance private data.
parent 7d49b31a
2006-04-04 Matthias Clasen <mclasen@redhat.com>
* gdk/gdkdisplay.c:
* gdk/gdkdisplaymanager.c:
* gdk/gdkdraw.c:
* gdk/gdkkeys.c:
* gdk/gdkpixmap.c:
* gdk/gdkscreen.c:
* gdk/gdkwindow.c:
* gdk/x11/gdkcolor-x11.c:
* gdk/x11/gdkdisplay-x11.c:
* gdk/x11/gdkdnd-x11.c:
* gdk/x11/gdkdrawable-x11.c:
* gdk/x11/gdkgc-x11.c:
* gdk/x11/gdkimage-x11.c:
* gdk/x11/gdkinput.c:
* gdk/x11/gdkpixmap-x11.c:
* gdk/x11/gdkscreen-x11.c:
* gdk/x11/gdkwindow-x11.c: Use G_DEFINE_TYPE.
* gdk/x11/gdkcolor-x11.c:
* gdk/x11/gdkdnd-x11.c:
* gdk/x11/gdkimage-x11.c: Use instance private data.
2006-04-03 Matthias Clasen <mclasen@redhat.com> 2006-04-03 Matthias Clasen <mclasen@redhat.com>
* gdk/gdkrgb.c: Get rid of a duplicate copy of the visual names. * gdk/gdkrgb.c: Get rid of a duplicate copy of the visual names.
......
2006-04-04 Matthias Clasen <mclasen@redhat.com>
* gdk/gdkdisplay.c:
* gdk/gdkdisplaymanager.c:
* gdk/gdkdraw.c:
* gdk/gdkkeys.c:
* gdk/gdkpixmap.c:
* gdk/gdkscreen.c:
* gdk/gdkwindow.c:
* gdk/x11/gdkcolor-x11.c:
* gdk/x11/gdkdisplay-x11.c:
* gdk/x11/gdkdnd-x11.c:
* gdk/x11/gdkdrawable-x11.c:
* gdk/x11/gdkgc-x11.c:
* gdk/x11/gdkimage-x11.c:
* gdk/x11/gdkinput.c:
* gdk/x11/gdkpixmap-x11.c:
* gdk/x11/gdkscreen-x11.c:
* gdk/x11/gdkwindow-x11.c: Use G_DEFINE_TYPE.
* gdk/x11/gdkcolor-x11.c:
* gdk/x11/gdkdnd-x11.c:
* gdk/x11/gdkimage-x11.c: Use instance private data.
2006-04-03 Matthias Clasen <mclasen@redhat.com> 2006-04-03 Matthias Clasen <mclasen@redhat.com>
* gdk/gdkrgb.c: Get rid of a duplicate copy of the visual names. * gdk/gdkrgb.c: Get rid of a duplicate copy of the visual names.
......
...@@ -35,8 +35,6 @@ enum { ...@@ -35,8 +35,6 @@ enum {
LAST_SIGNAL LAST_SIGNAL
}; };
static void gdk_display_class_init (GdkDisplayClass *class);
static void gdk_display_init (GdkDisplay *display);
static void gdk_display_dispose (GObject *object); static void gdk_display_dispose (GObject *object);
static void gdk_display_finalize (GObject *object); static void gdk_display_finalize (GObject *object);
...@@ -65,7 +63,6 @@ static GdkWindow* singlehead_default_window_at_pointer (GdkScreen *screen ...@@ -65,7 +63,6 @@ static GdkWindow* singlehead_default_window_at_pointer (GdkScreen *screen
static guint signals[LAST_SIGNAL] = { 0 }; static guint signals[LAST_SIGNAL] = { 0 };
static GObjectClass *parent_class;
static char *gdk_sm_client_id; static char *gdk_sm_client_id;
static const GdkDisplayPointerHooks default_pointer_hooks = { static const GdkDisplayPointerHooks default_pointer_hooks = {
...@@ -87,39 +84,13 @@ static const GdkPointerHooks singlehead_default_pointer_hooks = { ...@@ -87,39 +84,13 @@ static const GdkPointerHooks singlehead_default_pointer_hooks = {
static const GdkPointerHooks *singlehead_current_pointer_hooks = &singlehead_default_pointer_hooks; static const GdkPointerHooks *singlehead_current_pointer_hooks = &singlehead_default_pointer_hooks;
GType G_DEFINE_TYPE (GdkDisplay, gdk_display, G_TYPE_OBJECT);
gdk_display_get_type (void)
{
static GType object_type = 0;
if (!object_type)
{
static const GTypeInfo object_info = {
sizeof (GdkDisplayClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gdk_display_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GdkDisplay),
0, /* n_preallocs */
(GInstanceInitFunc) gdk_display_init
};
object_type = g_type_register_static (G_TYPE_OBJECT,
g_intern_static_string ("GdkDisplay"), &object_info, 0);
}
return object_type;
}
static void static void
gdk_display_class_init (GdkDisplayClass *class) gdk_display_class_init (GdkDisplayClass *class)
{ {
GObjectClass *object_class = G_OBJECT_CLASS (class); GObjectClass *object_class = G_OBJECT_CLASS (class);
parent_class = g_type_class_peek_parent (class);
object_class->finalize = gdk_display_finalize; object_class->finalize = gdk_display_finalize;
object_class->dispose = gdk_display_dispose; object_class->dispose = gdk_display_dispose;
...@@ -184,13 +155,13 @@ gdk_display_dispose (GObject *object) ...@@ -184,13 +155,13 @@ gdk_display_dispose (GObject *object)
NULL); NULL);
} }
G_OBJECT_CLASS (parent_class)->dispose (object); G_OBJECT_CLASS (gdk_display_parent_class)->dispose (object);
} }
static void static void
gdk_display_finalize (GObject *object) gdk_display_finalize (GObject *object)
{ {
G_OBJECT_CLASS (parent_class)->finalize (object); G_OBJECT_CLASS (gdk_display_parent_class)->finalize (object);
} }
/** /**
......
...@@ -67,33 +67,7 @@ static guint signals[LAST_SIGNAL] = { 0 }; ...@@ -67,33 +67,7 @@ static guint signals[LAST_SIGNAL] = { 0 };
static GdkDisplay *default_display = NULL; static GdkDisplay *default_display = NULL;
GType G_DEFINE_TYPE (GdkDisplayManager, gdk_display_manager, G_TYPE_OBJECT);
gdk_display_manager_get_type (void)
{
static GType object_type = 0;
if (!object_type)
{
static const GTypeInfo object_info =
{
sizeof (GdkDisplayManagerClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gdk_display_manager_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GdkDisplayManager),
0, /* n_preallocs */
(GInstanceInitFunc) NULL,
};
object_type = g_type_register_static (G_TYPE_OBJECT,
g_intern_static_string ("GdkDisplayManager"),
&object_info, 0);
}
return object_type;
}
static void static void
gdk_display_manager_class_init (GdkDisplayManagerClass *klass) gdk_display_manager_class_init (GdkDisplayManagerClass *klass)
...@@ -133,6 +107,11 @@ gdk_display_manager_class_init (GdkDisplayManagerClass *klass) ...@@ -133,6 +107,11 @@ gdk_display_manager_class_init (GdkDisplayManagerClass *klass)
G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB)); G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB));
} }
static void
gdk_display_manager_init (GdkDisplayManager *manager)
{
}
static void static void
gdk_display_manager_set_property (GObject *object, gdk_display_manager_set_property (GObject *object,
guint prop_id, guint prop_id,
......
...@@ -62,36 +62,8 @@ static void gdk_drawable_real_draw_pixbuf (GdkDrawable *draw ...@@ -62,36 +62,8 @@ static void gdk_drawable_real_draw_pixbuf (GdkDrawable *draw
gint x_dither, gint x_dither,
gint y_dither); gint y_dither);
static void gdk_drawable_class_init (GdkDrawableClass *klass);
GType G_DEFINE_ABSTRACT_TYPE (GdkDrawable, gdk_drawable, G_TYPE_OBJECT);
gdk_drawable_get_type (void)
{
static GType object_type = 0;
if (!object_type)
{
static const GTypeInfo object_info =
{
sizeof (GdkDrawableClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gdk_drawable_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GdkDrawable),
0, /* n_preallocs */
(GInstanceInitFunc) NULL,
};
object_type = g_type_register_static (G_TYPE_OBJECT,
g_intern_static_string ("GdkDrawable"),
&object_info,
G_TYPE_FLAG_ABSTRACT);
}
return object_type;
}
static void static void
gdk_drawable_class_init (GdkDrawableClass *klass) gdk_drawable_class_init (GdkDrawableClass *klass)
...@@ -104,6 +76,11 @@ gdk_drawable_class_init (GdkDrawableClass *klass) ...@@ -104,6 +76,11 @@ gdk_drawable_class_init (GdkDrawableClass *klass)
klass->draw_pixbuf = gdk_drawable_real_draw_pixbuf; klass->draw_pixbuf = gdk_drawable_real_draw_pixbuf;
} }
static void
gdk_drawable_init (GdkDrawable *drawable)
{
}
/* Manipulation of drawables /* Manipulation of drawables
*/ */
......
...@@ -36,37 +36,9 @@ enum { ...@@ -36,37 +36,9 @@ enum {
LAST_SIGNAL LAST_SIGNAL
}; };
static void gdk_keymap_class_init (GdkKeymapClass *klass);
static guint signals[LAST_SIGNAL] = { 0 }; static guint signals[LAST_SIGNAL] = { 0 };
GType G_DEFINE_TYPE (GdkKeymap, gdk_keymap, G_TYPE_OBJECT);
gdk_keymap_get_type (void)
{
static GType object_type = 0;
if (!object_type)
{
static const GTypeInfo object_info =
{
sizeof (GdkKeymapClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gdk_keymap_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GdkKeymap),
0, /* n_preallocs */
(GInstanceInitFunc) NULL,
};
object_type = g_type_register_static (G_TYPE_OBJECT,
g_intern_static_string ("GdkKeymap"),
&object_info, 0);
}
return object_type;
}
static void static void
gdk_keymap_class_init (GdkKeymapClass *klass) gdk_keymap_class_init (GdkKeymapClass *klass)
...@@ -111,6 +83,11 @@ gdk_keymap_class_init (GdkKeymapClass *klass) ...@@ -111,6 +83,11 @@ gdk_keymap_class_init (GdkKeymapClass *klass)
0); 0);
} }
static void
gdk_keymap_init (GdkKeymap *keymap)
{
}
/* Other key-handling stuff /* Other key-handling stuff
*/ */
......
...@@ -153,39 +153,9 @@ static void gdk_pixmap_real_set_colormap (GdkDrawable *drawable, ...@@ -153,39 +153,9 @@ static void gdk_pixmap_real_set_colormap (GdkDrawable *drawable,
static GdkColormap* gdk_pixmap_real_get_colormap (GdkDrawable *drawable); static GdkColormap* gdk_pixmap_real_get_colormap (GdkDrawable *drawable);
static GdkScreen* gdk_pixmap_real_get_screen (GdkDrawable *drawable); static GdkScreen* gdk_pixmap_real_get_screen (GdkDrawable *drawable);
static void gdk_pixmap_init (GdkPixmapObject *pixmap);
static void gdk_pixmap_class_init (GdkPixmapObjectClass *klass);
static void gdk_pixmap_finalize (GObject *object); static void gdk_pixmap_finalize (GObject *object);
static gpointer parent_class = NULL; G_DEFINE_TYPE (GdkPixmapObject, gdk_pixmap, GDK_TYPE_DRAWABLE);
GType
gdk_pixmap_get_type (void)
{
static GType object_type = 0;
if (!object_type)
{
static const GTypeInfo object_info =
{
sizeof (GdkPixmapObjectClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gdk_pixmap_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GdkPixmapObject),
0, /* n_preallocs */
(GInstanceInitFunc) gdk_pixmap_init,
};
object_type = g_type_register_static (GDK_TYPE_DRAWABLE,
g_intern_static_string ("GdkPixmap"),
&object_info, 0);
}
return object_type;
}
static void static void
gdk_pixmap_init (GdkPixmapObject *pixmap) gdk_pixmap_init (GdkPixmapObject *pixmap)
...@@ -200,8 +170,6 @@ gdk_pixmap_class_init (GdkPixmapObjectClass *klass) ...@@ -200,8 +170,6 @@ gdk_pixmap_class_init (GdkPixmapObjectClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass); GObjectClass *object_class = G_OBJECT_CLASS (klass);
GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass); GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->finalize = gdk_pixmap_finalize; object_class->finalize = gdk_pixmap_finalize;
drawable_class->create_gc = gdk_pixmap_create_gc; drawable_class->create_gc = gdk_pixmap_create_gc;
...@@ -237,7 +205,7 @@ gdk_pixmap_finalize (GObject *object) ...@@ -237,7 +205,7 @@ gdk_pixmap_finalize (GObject *object)
g_object_unref (obj->impl); g_object_unref (obj->impl);
obj->impl = NULL; obj->impl = NULL;
G_OBJECT_CLASS (parent_class)->finalize (object); G_OBJECT_CLASS (gdk_pixmap_parent_class)->finalize (object);
} }
static GdkGC * static GdkGC *
......
...@@ -29,8 +29,6 @@ ...@@ -29,8 +29,6 @@
#include "gdkintl.h" #include "gdkintl.h"
#include "gdkalias.h" #include "gdkalias.h"
static void gdk_screen_class_init (GdkScreenClass *klass);
static void gdk_screen_init (GdkScreen *screen);
static void gdk_screen_dispose (GObject *object); static void gdk_screen_dispose (GObject *object);
static void gdk_screen_finalize (GObject *object); static void gdk_screen_finalize (GObject *object);
static void gdk_screen_set_property (GObject *object, static void gdk_screen_set_property (GObject *object,
...@@ -57,42 +55,13 @@ enum ...@@ -57,42 +55,13 @@ enum
static guint signals[LAST_SIGNAL] = { 0 }; static guint signals[LAST_SIGNAL] = { 0 };
static gpointer parent_class = NULL; G_DEFINE_TYPE(GdkScreen, gdk_screen, G_TYPE_OBJECT);
GType
gdk_screen_get_type (void)
{
static GType object_type = 0;
if (!object_type)
{
static const GTypeInfo object_info =
{
sizeof (GdkScreenClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gdk_screen_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GdkScreen),
0, /* n_preallocs */
(GInstanceInitFunc) gdk_screen_init,
};
object_type = g_type_register_static (G_TYPE_OBJECT,
g_intern_static_string ("GdkScreen"), &object_info, 0);
}
return object_type;
}
static void static void
gdk_screen_class_init (GdkScreenClass *klass) gdk_screen_class_init (GdkScreenClass *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->dispose = gdk_screen_dispose; object_class->dispose = gdk_screen_dispose;
object_class->finalize = gdk_screen_finalize; object_class->finalize = gdk_screen_finalize;
object_class->set_property = gdk_screen_set_property; object_class->set_property = gdk_screen_set_property;
...@@ -164,7 +133,7 @@ gdk_screen_dispose (GObject *object) ...@@ -164,7 +133,7 @@ gdk_screen_dispose (GObject *object)
} }
} }
G_OBJECT_CLASS (parent_class)->dispose (object); G_OBJECT_CLASS (gdk_screen_parent_class)->dispose (object);
} }
static void static void
...@@ -175,7 +144,7 @@ gdk_screen_finalize (GObject *object) ...@@ -175,7 +144,7 @@ gdk_screen_finalize (GObject *object)
if (screen->font_options) if (screen->font_options)
cairo_font_options_destroy (screen->font_options); cairo_font_options_destroy (screen->font_options);
G_OBJECT_CLASS (parent_class)->finalize (object); G_OBJECT_CLASS (gdk_screen_parent_class)->finalize (object);
} }
void void
......
...@@ -183,8 +183,6 @@ static GdkRegion* gdk_window_get_visible_region (GdkDrawable *drawable); ...@@ -183,8 +183,6 @@ static GdkRegion* gdk_window_get_visible_region (GdkDrawable *drawable);
static void gdk_window_free_paint_stack (GdkWindow *window); static void gdk_window_free_paint_stack (GdkWindow *window);
static void gdk_window_init (GdkWindowObject *window);
static void gdk_window_class_init (GdkWindowObjectClass *klass);
static void gdk_window_finalize (GObject *object); static void gdk_window_finalize (GObject *object);
static void gdk_window_clear_backing_rect (GdkWindow *window, static void gdk_window_clear_backing_rect (GdkWindow *window,
gint x, gint x,
...@@ -192,38 +190,10 @@ static void gdk_window_clear_backing_rect (GdkWindow *window, ...@@ -192,38 +190,10 @@ static void gdk_window_clear_backing_rect (GdkWindow *window,
gint width, gint width,
gint height); gint height);
static gpointer parent_class = NULL; G_DEFINE_TYPE (GdkWindowObject, gdk_window_object, GDK_TYPE_DRAWABLE);
GType
gdk_window_object_get_type (void)
{
static GType object_type = 0;
if (!object_type)
{
static const GTypeInfo object_info =
{
sizeof (GdkWindowObjectClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gdk_window_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GdkWindowObject),
0, /* n_preallocs */
(GInstanceInitFunc) gdk_window_init,
};
object_type = g_type_register_static (GDK_TYPE_DRAWABLE,
g_intern_static_string ("GdkWindow"),
&object_info, 0);
}
return object_type;
}
static void static void
gdk_window_init (GdkWindowObject *window) gdk_window_object_init (GdkWindowObject *window)
{ {
/* 0-initialization is good for all other fields. */ /* 0-initialization is good for all other fields. */
...@@ -235,13 +205,11 @@ gdk_window_init (GdkWindowObject *window) ...@@ -235,13 +205,11 @@ gdk_window_init (GdkWindowObject *window)
} }
static void static void
gdk_window_class_init (GdkWindowObjectClass *klass) gdk_window_object_class_init (GdkWindowObjectClass *klass)
{ {
GObjectClass *object_class = G_OBJECT_CLASS (klass); GObjectClass *object_class = G_OBJECT_CLASS (klass);
GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass); GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->finalize = gdk_window_finalize; object_class->finalize = gdk_window_finalize;
drawable_class->create_gc = gdk_window_create_gc; drawable_class->create_gc = gdk_window_create_gc;
...@@ -295,7 +263,7 @@ gdk_window_finalize (GObject *object) ...@@ -295,7 +263,7 @@ gdk_window_finalize (GObject *object)
g_object_unref (obj->impl); g_object_unref (obj->impl);
obj->impl = NULL; obj->impl = NULL;
G_OBJECT_CLASS (parent_class)->finalize (object); G_OBJECT_CLASS (gdk_window_object_parent_class)->finalize (object);
} }
static void static void
......
...@@ -66,46 +66,17 @@ static gboolean gdk_colormap_equal (Colormap *a, ...@@ -66,46 +66,17 @@ static gboolean gdk_colormap_equal (Colormap *a,
static void gdk_colormap_sync (GdkColormap *colormap, static void gdk_colormap_sync (GdkColormap *colormap,
gboolean force); gboolean force);
static void gdk_colormap_init (GdkColormap *colormap);
static void gdk_colormap_class_init (GdkColormapClass *klass);
static void gdk_colormap_finalize (GObject *object); static void gdk_colormap_finalize (GObject *object);
static gpointer parent_class = NULL; G_DEFINE_TYPE (GdkColormap, gdk_colormap, G_TYPE_OBJECT);
GType
gdk_colormap_get_type (void)
{
static GType object_type = 0;
if (!object_type)
{
static const GTypeInfo object_info =
{
sizeof (GdkColormapClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gdk_colormap_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GdkColormap),