gdk/directfb: convert gdkgc-directfb to using G_DEFINE_TYPE

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=609199

Signed-off-by: Javier Jardón <jjardon@gnome.org>
This commit is contained in:
André Draszik 2009-09-13 14:08:21 +01:00 committed by Tristan Van Berkom
parent 9bc658f6ed
commit 987256968b
2 changed files with 25 additions and 51 deletions

View File

@ -57,49 +57,22 @@ static void gdk_directfb_gc_set_dashes (GdkGC *gc,
gint8 dash_list[],
gint n);
static void gdk_gc_directfb_class_init (GdkGCDirectFBClass *klass);
static void gdk_gc_directfb_finalize (GObject *object);
G_DEFINE_TYPE (GdkGCDirectFB, _gdk_gc_directfb, GDK_TYPE_GC)
static gpointer parent_class = NULL;
GType
gdk_gc_directfb_get_type (void)
static void
_gdk_gc_directfb_init (GdkGCDirectFB *directfb_gc)
{
static GType object_type = 0;
if (!object_type)
{
const GTypeInfo object_info =
{
sizeof (GdkGCDirectFBClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gdk_gc_directfb_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GdkGCDirectFB),
0, /* n_preallocs */
(GInstanceInitFunc) NULL,
};
object_type = g_type_register_static (GDK_TYPE_GC,
"GdkGCDirectFB",
&object_info, 0);
}
return object_type;
}
static void
gdk_gc_directfb_class_init (GdkGCDirectFBClass *klass)
_gdk_gc_directfb_class_init (GdkGCDirectFBClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GdkGCClass *gc_class = GDK_GC_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->finalize = gdk_gc_directfb_finalize;
gc_class->get_values = gdk_directfb_gc_get_values;
@ -110,23 +83,22 @@ gdk_gc_directfb_class_init (GdkGCDirectFBClass *klass)
static void
gdk_gc_directfb_finalize (GObject *object)
{
GdkGC *gc = GDK_GC (object);
GdkGCDirectFB *private = GDK_GC_DIRECTFB (gc);
GdkGCDirectFB *directfb_gc = GDK_GC_DIRECTFB (object);
if (private->clip_region.numRects)
temp_region_deinit (&private->clip_region);
if (private->values.clip_mask)
g_object_unref (private->values.clip_mask);
if (private->values.stipple)
g_object_unref (private->values.stipple);
if (private->values.tile)
g_object_unref (private->values.tile);
if (directfb_gc->clip_region.numRects)
temp_region_deinit (&directfb_gc->clip_region);
if (directfb_gc->values.clip_mask)
g_object_unref (directfb_gc->values.clip_mask);
if (directfb_gc->values.stipple)
g_object_unref (directfb_gc->values.stipple);
if (directfb_gc->values.tile)
g_object_unref (directfb_gc->values.tile);
if (G_OBJECT_CLASS (parent_class)->finalize)
G_OBJECT_CLASS (parent_class)->finalize (object);
G_OBJECT_CLASS (_gdk_gc_directfb_parent_class)->finalize (object);
}
GdkGC*
GdkGC *
_gdk_directfb_gc_new (GdkDrawable *drawable,
GdkGCValues *values,
GdkGCValuesMask values_mask)
@ -134,9 +106,11 @@ _gdk_directfb_gc_new (GdkDrawable *drawable,
GdkGC *gc;
GdkGCDirectFB *private;
/* NOTICE that the drawable here has to be the impl drawable, not the
publicly visible drawable. */
g_return_val_if_fail (GDK_IS_DRAWABLE_IMPL_DIRECTFB (drawable), NULL);
gc = GDK_GC (g_object_new (gdk_gc_directfb_get_type (), NULL));
gc = GDK_GC (g_object_new (_gdk_gc_directfb_get_type (), NULL));
_gdk_gc_init (gc, drawable, values, values_mask);

View File

@ -205,7 +205,7 @@ typedef struct
} GdkImageDirectFB;
#define GDK_TYPE_GC_DIRECTFB (gdk_gc_directfb_get_type ())
#define GDK_TYPE_GC_DIRECTFB (_gdk_gc_directfb_get_type ())
#define GDK_GC_DIRECTFB(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_GC_DIRECTFB, GdkGCDirectFB))
#define GDK_IS_GC_DIRECTFB(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_GC_DIRECTFB))
@ -224,11 +224,11 @@ typedef struct
GdkGCClass parent_class;
} GdkGCDirectFBClass;
GType gdk_gc_directfb_get_type (void);
GType _gdk_gc_directfb_get_type (void);
GdkGC * _gdk_directfb_gc_new (GdkDrawable *drawable,
GdkGCValues *values,
GdkGCValuesMask values_mask);
GdkGC * _gdk_directfb_gc_new (GdkDrawable *drawable,
GdkGCValues *values,
GdkGCValuesMask values_mask);
GdkImage* _gdk_directfb_copy_to_image (GdkDrawable *drawable,
GdkImage *image,