From 7e7e9795fe5eef194c9009f0bd3596197a150ad8 Mon Sep 17 00:00:00 2001 From: Bilal Elmoussaoui Date: Fri, 10 Nov 2023 15:28:19 +0100 Subject: [PATCH] bind-constraint: Use macros for subclassing boilerplate Part-of: --- clutter/clutter/clutter-autocleanups.h | 1 - clutter/clutter/clutter-bind-constraint.c | 17 ++++------------- clutter/clutter/clutter-bind-constraint.h | 8 ++------ 3 files changed, 6 insertions(+), 20 deletions(-) diff --git a/clutter/clutter/clutter-autocleanups.h b/clutter/clutter/clutter-autocleanups.h index 6f2b941d0..0910e140d 100644 --- a/clutter/clutter/clutter-autocleanups.h +++ b/clutter/clutter/clutter-autocleanups.h @@ -31,7 +31,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterActor, 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) G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBoxLayout, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBrightnessContrastEffect, g_object_unref) diff --git a/clutter/clutter/clutter-bind-constraint.c b/clutter/clutter/clutter-bind-constraint.c index 1cd5a3e02..6e8e105b9 100644 --- a/clutter/clutter/clutter-bind-constraint.c +++ b/clutter/clutter/clutter-bind-constraint.c @@ -24,7 +24,7 @@ /** * ClutterBindConstraint: - * + * * A constraint binding the position or size of an actor * * #ClutterBindConstraint is a [class@Constraint] that binds the @@ -94,10 +94,6 @@ #include "clutter/clutter-enum-types.h" #include "clutter/clutter-private.h" -#define CLUTTER_BIND_CONSTRAINT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_BIND_CONSTRAINT, ClutterBindConstraintClass)) -#define CLUTTER_IS_BIND_CONSTRAINT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_BIND_CONSTRAINT)) -#define CLUTTER_BIND_CONSTRAINT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_BIND_CONSTRAINT, ClutterBindConstraintClass)) - struct _ClutterBindConstraint { ClutterConstraint parent_instance; @@ -108,11 +104,6 @@ struct _ClutterBindConstraint gfloat offset; }; -struct _ClutterBindConstraintClass -{ - ClutterConstraintClass parent_class; -}; - enum { PROP_0, @@ -126,9 +117,9 @@ enum static GParamSpec *obj_props[PROP_LAST]; -G_DEFINE_TYPE (ClutterBindConstraint, - clutter_bind_constraint, - CLUTTER_TYPE_CONSTRAINT); +G_DEFINE_FINAL_TYPE (ClutterBindConstraint, + clutter_bind_constraint, + CLUTTER_TYPE_CONSTRAINT); static void source_queue_relayout (ClutterActor *source, diff --git a/clutter/clutter/clutter-bind-constraint.h b/clutter/clutter/clutter-bind-constraint.h index 8118f9cd8..5cf25f315 100644 --- a/clutter/clutter/clutter-bind-constraint.h +++ b/clutter/clutter/clutter-bind-constraint.h @@ -33,14 +33,10 @@ G_BEGIN_DECLS #define CLUTTER_TYPE_BIND_CONSTRAINT (clutter_bind_constraint_get_type ()) -#define CLUTTER_BIND_CONSTRAINT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BIND_CONSTRAINT, ClutterBindConstraint)) -#define CLUTTER_IS_BIND_CONSTRAINT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_BIND_CONSTRAINT)) - -typedef struct _ClutterBindConstraint ClutterBindConstraint; -typedef struct _ClutterBindConstraintClass ClutterBindConstraintClass; CLUTTER_EXPORT -GType clutter_bind_constraint_get_type (void) G_GNUC_CONST; +G_DECLARE_FINAL_TYPE (ClutterBindConstraint, clutter_bind_constraint, + CLUTTER, BIND_CONSTRAINT, ClutterConstraint) CLUTTER_EXPORT ClutterConstraint * clutter_bind_constraint_new (ClutterActor *source,