From e32268e1812a49c6480d079e81239cc23d66316e Mon Sep 17 00:00:00 2001 From: Bilal Elmoussaoui Date: Fri, 10 Nov 2023 14:54:06 +0100 Subject: [PATCH] constraint: Use macros for subclassing boilerplate Part-of: --- clutter/clutter/clutter-autocleanups.h | 1 - clutter/clutter/clutter-constraint.h | 21 ++++++--------------- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/clutter/clutter/clutter-autocleanups.h b/clutter/clutter/clutter-autocleanups.h index a37486f32..7f65cd6d7 100644 --- a/clutter/clutter/clutter-autocleanups.h +++ b/clutter/clutter/clutter-autocleanups.h @@ -40,7 +40,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBrightnessContrastEffect, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterCanvas, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterClone, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterColorizeEffect, g_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterConstraint, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterDeformEffect, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterDesaturateEffect, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterFixedLayout, g_object_unref) diff --git a/clutter/clutter/clutter-constraint.h b/clutter/clutter/clutter-constraint.h index 875611400..dbe1ace31 100644 --- a/clutter/clutter/clutter-constraint.h +++ b/clutter/clutter/clutter-constraint.h @@ -33,19 +33,13 @@ G_BEGIN_DECLS #define CLUTTER_TYPE_CONSTRAINT (clutter_constraint_get_type ()) -#define CLUTTER_CONSTRAINT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_CONSTRAINT, ClutterConstraint)) -#define CLUTTER_IS_CONSTRAINT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_CONSTRAINT)) -#define CLUTTER_CONSTRAINT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_CONSTRAINT, ClutterConstraintClass)) -#define CLUTTER_IS_CONSTRAINT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_CONSTRAINT)) -#define CLUTTER_CONSTRAINT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_CONSTRAINT, ClutterConstraintClass)) -typedef struct _ClutterConstraintClass ClutterConstraintClass; - -struct _ClutterConstraint -{ - /*< private >*/ - ClutterActorMeta parent_instance; -}; +CLUTTER_EXPORT +G_DECLARE_DERIVABLE_TYPE (ClutterConstraint, + clutter_constraint, + CLUTTER, + CONSTRAINT, + ClutterActorMeta) /** * ClutterConstraintClass: @@ -76,9 +70,6 @@ struct _ClutterConstraintClass float *natural_size); }; -CLUTTER_EXPORT -GType clutter_constraint_get_type (void) G_GNUC_CONST; - CLUTTER_EXPORT void clutter_constraint_update_preferred_size (ClutterConstraint *constraint, ClutterActor *actor,