From 1565756fea6be47ab930a850b4b42a536dc78b03 Mon Sep 17 00:00:00 2001 From: Bilal Elmoussaoui Date: Tue, 2 Jan 2024 08:48:36 +0100 Subject: [PATCH] align-constraint: Use macros for subclassing boilerplate Part-of: --- clutter/clutter/clutter-align-constraint.c | 17 ++++------------- clutter/clutter/clutter-align-constraint.h | 8 ++------ clutter/clutter/clutter-autocleanups.h | 1 - 3 files changed, 6 insertions(+), 20 deletions(-) diff --git a/clutter/clutter/clutter-align-constraint.c b/clutter/clutter/clutter-align-constraint.c index 4866f055d..6c922ba6c 100644 --- a/clutter/clutter/clutter-align-constraint.c +++ b/clutter/clutter/clutter-align-constraint.c @@ -24,7 +24,7 @@ /** * ClutterAlignConstraint: - * + * * A constraint aligning the position of an actor * * #ClutterAlignConstraint is a [class@Constraint] that aligns the position @@ -45,10 +45,6 @@ #include -#define CLUTTER_ALIGN_CONSTRAINT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_ALIGN_CONSTRAINT, ClutterAlignConstraintClass)) -#define CLUTTER_IS_ALIGN_CONSTRAINT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_ALIGN_CONSTRAINT)) -#define CLUTTER_ALIGN_CONSTRAINT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_ALIGN_CONSTRAINT, ClutterAlignConstraintClass)) - struct _ClutterAlignConstraint { ClutterConstraint parent_instance; @@ -60,11 +56,6 @@ struct _ClutterAlignConstraint gfloat factor; }; -struct _ClutterAlignConstraintClass -{ - ClutterConstraintClass parent_class; -}; - enum { PROP_0, @@ -79,9 +70,9 @@ enum static GParamSpec *obj_props[PROP_LAST]; -G_DEFINE_TYPE (ClutterAlignConstraint, - clutter_align_constraint, - CLUTTER_TYPE_CONSTRAINT); +G_DEFINE_FINAL_TYPE (ClutterAlignConstraint, + clutter_align_constraint, + CLUTTER_TYPE_CONSTRAINT); static void source_queue_relayout (ClutterActor *actor, diff --git a/clutter/clutter/clutter-align-constraint.h b/clutter/clutter/clutter-align-constraint.h index f4afb5c17..2b5957fcf 100644 --- a/clutter/clutter/clutter-align-constraint.h +++ b/clutter/clutter/clutter-align-constraint.h @@ -33,14 +33,10 @@ G_BEGIN_DECLS #define CLUTTER_TYPE_ALIGN_CONSTRAINT (clutter_align_constraint_get_type ()) -#define CLUTTER_ALIGN_CONSTRAINT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_ALIGN_CONSTRAINT, ClutterAlignConstraint)) -#define CLUTTER_IS_ALIGN_CONSTRAINT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_ALIGN_CONSTRAINT)) - -typedef struct _ClutterAlignConstraint ClutterAlignConstraint; -typedef struct _ClutterAlignConstraintClass ClutterAlignConstraintClass; CLUTTER_EXPORT -GType clutter_align_constraint_get_type (void) G_GNUC_CONST; +G_DECLARE_FINAL_TYPE (ClutterAlignConstraint, clutter_align_constraint, + CLUTTER, ALIGN_CONSTRAINT, ClutterConstraint) CLUTTER_EXPORT ClutterConstraint *clutter_align_constraint_new (ClutterActor *source, diff --git a/clutter/clutter/clutter-autocleanups.h b/clutter/clutter/clutter-autocleanups.h index ce7b959dd..6f2b941d0 100644 --- a/clutter/clutter/clutter-autocleanups.h +++ b/clutter/clutter/clutter-autocleanups.h @@ -30,7 +30,6 @@ #ifndef __GI_SCANNER__ G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterActor, g_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterAlignConstraint, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBackend, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBindConstraint, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBlurEffect, g_object_unref)