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>
* 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>
* gdk/gdkrgb.c: Get rid of a duplicate copy of the visual names.
......
......@@ -35,8 +35,6 @@ enum {
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_finalize (GObject *object);
......@@ -65,7 +63,6 @@ static GdkWindow* singlehead_default_window_at_pointer (GdkScreen *screen
static guint signals[LAST_SIGNAL] = { 0 };
static GObjectClass *parent_class;
static char *gdk_sm_client_id;
static const GdkDisplayPointerHooks 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;
GType
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;
}
G_DEFINE_TYPE (GdkDisplay, gdk_display, G_TYPE_OBJECT);
static void
gdk_display_class_init (GdkDisplayClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
parent_class = g_type_class_peek_parent (class);
object_class->finalize = gdk_display_finalize;
object_class->dispose = gdk_display_dispose;
......@@ -184,13 +155,13 @@ gdk_display_dispose (GObject *object)
NULL);
}
G_OBJECT_CLASS (parent_class)->dispose (object);
G_OBJECT_CLASS (gdk_display_parent_class)->dispose (object);
}
static void
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 };
static GdkDisplay *default_display = NULL;
GType
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;
}
G_DEFINE_TYPE (GdkDisplayManager, gdk_display_manager, G_TYPE_OBJECT);
static void
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));
}
static void
gdk_display_manager_init (GdkDisplayManager *manager)
{
}
static void
gdk_display_manager_set_property (GObject *object,
guint prop_id,
......
......@@ -62,36 +62,8 @@ static void gdk_drawable_real_draw_pixbuf (GdkDrawable *draw
gint x_dither,
gint y_dither);
static void gdk_drawable_class_init (GdkDrawableClass *klass);
GType
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;
}
G_DEFINE_ABSTRACT_TYPE (GdkDrawable, gdk_drawable, G_TYPE_OBJECT);
static void
gdk_drawable_class_init (GdkDrawableClass *klass)
......@@ -104,6 +76,11 @@ gdk_drawable_class_init (GdkDrawableClass *klass)
klass->draw_pixbuf = gdk_drawable_real_draw_pixbuf;
}
static void
gdk_drawable_init (GdkDrawable *drawable)
{
}
/* Manipulation of drawables
*/
......
......@@ -36,37 +36,9 @@ enum {
LAST_SIGNAL
};
static void gdk_keymap_class_init (GdkKeymapClass *klass);
static guint signals[LAST_SIGNAL] = { 0 };
GType
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;
}
G_DEFINE_TYPE (GdkKeymap, gdk_keymap, G_TYPE_OBJECT);
static void
gdk_keymap_class_init (GdkKeymapClass *klass)
......@@ -111,6 +83,11 @@ gdk_keymap_class_init (GdkKeymapClass *klass)
0);
}
static void
gdk_keymap_init (GdkKeymap *keymap)
{
}
/* Other key-handling stuff
*/
......
......@@ -153,39 +153,9 @@ static void gdk_pixmap_real_set_colormap (GdkDrawable *drawable,
static GdkColormap* gdk_pixmap_real_get_colormap (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 gpointer parent_class = NULL;
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;
}
G_DEFINE_TYPE (GdkPixmapObject, gdk_pixmap, GDK_TYPE_DRAWABLE);
static void
gdk_pixmap_init (GdkPixmapObject *pixmap)
......@@ -200,8 +170,6 @@ gdk_pixmap_class_init (GdkPixmapObjectClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->finalize = gdk_pixmap_finalize;
drawable_class->create_gc = gdk_pixmap_create_gc;
......@@ -237,7 +205,7 @@ gdk_pixmap_finalize (GObject *object)
g_object_unref (obj->impl);
obj->impl = NULL;
G_OBJECT_CLASS (parent_class)->finalize (object);
G_OBJECT_CLASS (gdk_pixmap_parent_class)->finalize (object);
}
static GdkGC *
......
......@@ -29,8 +29,6 @@
#include "gdkintl.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_finalize (GObject *object);
static void gdk_screen_set_property (GObject *object,
......@@ -57,42 +55,13 @@ enum
static guint signals[LAST_SIGNAL] = { 0 };
static gpointer parent_class = NULL;
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;
}
G_DEFINE_TYPE(GdkScreen, gdk_screen, G_TYPE_OBJECT);
static void
gdk_screen_class_init (GdkScreenClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->dispose = gdk_screen_dispose;
object_class->finalize = gdk_screen_finalize;
object_class->set_property = gdk_screen_set_property;
......@@ -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
......@@ -175,7 +144,7 @@ gdk_screen_finalize (GObject *object)
if (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
......
......@@ -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_init (GdkWindowObject *window);
static void gdk_window_class_init (GdkWindowObjectClass *klass);
static void gdk_window_finalize (GObject *object);
static void gdk_window_clear_backing_rect (GdkWindow *window,
gint x,
......@@ -192,38 +190,10 @@ static void gdk_window_clear_backing_rect (GdkWindow *window,
gint width,
gint height);
static gpointer parent_class = NULL;
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;
}
G_DEFINE_TYPE (GdkWindowObject, gdk_window_object, GDK_TYPE_DRAWABLE);
static void
gdk_window_init (GdkWindowObject *window)
gdk_window_object_init (GdkWindowObject *window)
{
/* 0-initialization is good for all other fields. */
......@@ -235,13 +205,11 @@ gdk_window_init (GdkWindowObject *window)
}
static void
gdk_window_class_init (GdkWindowObjectClass *klass)
gdk_window_object_class_init (GdkWindowObjectClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->finalize = gdk_window_finalize;
drawable_class->create_gc = gdk_window_create_gc;
......@@ -295,7 +263,7 @@ gdk_window_finalize (GObject *object)
g_object_unref (obj->impl);
obj->impl = NULL;
G_OBJECT_CLASS (parent_class)->finalize (object);
G_OBJECT_CLASS (gdk_window_object_parent_class)->finalize (object);
}
static void
......
......@@ -66,46 +66,17 @@ static gboolean gdk_colormap_equal (Colormap *a,
static void gdk_colormap_sync (GdkColormap *colormap,
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 gpointer parent_class = NULL;
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),
0, /* n_preallocs */
(GInstanceInitFunc) gdk_colormap_init,
};
object_type = g_type_register_static (G_TYPE_OBJECT,
g_intern_static_string ("GdkColormap"),
&object_info, 0);
}
return object_type;
}
G_DEFINE_TYPE (GdkColormap, gdk_colormap, G_TYPE_OBJECT);
static void
gdk_colormap_init (GdkColormap *colormap)
{
GdkColormapPrivateX11 *private;
private = g_new (GdkColormapPrivateX11, 1);
private = G_TYPE_INSTANCE_GET_PRIVATE (colormap, GDK_TYPE_COLORMAP,
GdkColormapPrivateX11);
colormap->windowing_data = private;
......@@ -123,9 +94,9 @@ gdk_colormap_class_init (GdkColormapClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->finalize = gdk_colormap_finalize;
g_type_class_add_private (object_class, sizeof (GdkColormapPrivateX11));
}
static void
......@@ -144,9 +115,8 @@ gdk_colormap_finalize (GObject *object)
g_free (private->info);
g_free (colormap->colors);
g_free (private);
G_OBJECT_CLASS (parent_class)->finalize (object);
G_OBJECT_CLASS (gdk_colormap_parent_class)->finalize (object);
}
/**
......
......@@ -55,7 +55,6 @@
#endif
static void gdk_display_x11_class_init (GdkDisplayX11Class *class);
static void gdk_display_x11_dispose (GObject *object);
static void gdk_display_x11_finalize (GObject *object);
......@@ -67,8 +66,6 @@ static void gdk_internal_connection_watch (Display *display,
XPointer *watch_data);
#endif /* HAVE_X11R6 */
static gpointer parent_class = NULL;
/* Note that we never *directly* use WM_LOCALE_NAME, WM_PROTOCOLS,
* but including them here has the side-effect of getting them
* into the internal Xlib cache
......@@ -99,45 +96,21 @@ static const char *const precache_atoms[] = {
"_NET_VIRTUAL_ROOTS"
};
GType
_gdk_display_x11_get_type (void)
{
static GType object_type = 0;
if (!object_type)
{
static const GTypeInfo object_info =
{
sizeof (GdkDisplayX11Class),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gdk_display_x11_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GdkDisplayX11),
0, /* n_preallocs */
(GInstanceInitFunc) NULL,
};
object_type = g_type_register_static (GDK_TYPE_DISPLAY,
g_intern_static_string ("GdkDisplayX11"),
&object_info, 0);
}
return object_type;
}
G_DEFINE_TYPE (GdkDisplayX11, _gdk_display_x11, GDK_TYPE_DISPLAY);
static void
gdk_display_x11_class_init (GdkDisplayX11Class * class)
_gdk_display_x11_class_init (GdkDisplayX11Class * class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
object_class->dispose = gdk_display_x11_dispose;
object_class->finalize = gdk_display_x11_finalize;
parent_class = g_type_class_peek_parent (class);
}
static void
_gdk_display_x11_init (GdkDisplayX11 *display)
{
}
/**
* gdk_display_open:
......@@ -747,7 +720,7 @@ gdk_display_x11_dispose (GObject *object)
_gdk_events_uninit (GDK_DISPLAY_OBJECT (object));
G_OBJECT_CLASS (parent_class)->dispose (object);
G_OBJECT_CLASS (_gdk_display_x11_parent_class)->dispose (object);
}
static void
......@@ -806,7 +779,7 @@ gdk_display_x11_finalize (GObject *object)
XCloseDisplay (display_x11->xdisplay);
G_OBJECT_CLASS (parent_class)->finalize (object);
G_OBJECT_CLASS (_gdk_display_x11_parent_class)->finalize (object);
}
/**
......