From d79f0ab9f38140ee067051fb2fa004410e040336 Mon Sep 17 00:00:00 2001 From: Bilal Elmoussaoui Date: Fri, 10 Nov 2023 15:30:01 +0100 Subject: [PATCH] snap-constraint: Use macros for subclassing boilerplate Part-of: --- clutter/clutter/clutter-autocleanups.h | 1 - clutter/clutter/clutter-snap-constraint.c | 16 ++++------------ clutter/clutter/clutter-snap-constraint.h | 8 ++------ 3 files changed, 6 insertions(+), 19 deletions(-) diff --git a/clutter/clutter/clutter-autocleanups.h b/clutter/clutter/clutter-autocleanups.h index 0910e140d..c3b6b1e4a 100644 --- a/clutter/clutter/clutter-autocleanups.h +++ b/clutter/clutter/clutter-autocleanups.h @@ -51,7 +51,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPropertyTransition, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterRotateAction, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterScrollActor, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterShaderEffect, g_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterSnapConstraint, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterStage, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterSwipeAction, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterTapAction, g_object_unref) diff --git a/clutter/clutter/clutter-snap-constraint.c b/clutter/clutter/clutter-snap-constraint.c index d7faca340..2f594421c 100644 --- a/clutter/clutter/clutter-snap-constraint.c +++ b/clutter/clutter/clutter-snap-constraint.c @@ -24,7 +24,7 @@ /** * ClutterSnapConstraint: - * + * * A constraint snapping two actors together * * #ClutterSnapConstraint is a constraint the snaps the edges of two @@ -45,9 +45,6 @@ #include "clutter/clutter-enum-types.h" #include "clutter/clutter-private.h" -#define CLUTTER_SNAP_CONSTRAINT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_SNAP_CONSTRAINT, ClutterSnapConstraintClass)) -#define CLUTTER_IS_SNAP_CONSTRAINT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_SNAP_CONSTRAINT)) -#define CLUTTER_SNAP_CONSTRAINT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_SNAP_CONSTRAINT, ClutterSnapConstraintClass)) struct _ClutterSnapConstraint { @@ -62,11 +59,6 @@ struct _ClutterSnapConstraint gfloat offset; }; -struct _ClutterSnapConstraintClass -{ - ClutterConstraintClass parent_class; -}; - enum { PROP_0, @@ -79,9 +71,9 @@ enum PROP_LAST }; -G_DEFINE_TYPE (ClutterSnapConstraint, - clutter_snap_constraint, - CLUTTER_TYPE_CONSTRAINT); +G_DEFINE_FINAL_TYPE (ClutterSnapConstraint, + clutter_snap_constraint, + CLUTTER_TYPE_CONSTRAINT); static GParamSpec *obj_props[PROP_LAST] = { NULL, }; diff --git a/clutter/clutter/clutter-snap-constraint.h b/clutter/clutter/clutter-snap-constraint.h index fa22be492..4f35fca9b 100644 --- a/clutter/clutter/clutter-snap-constraint.h +++ b/clutter/clutter/clutter-snap-constraint.h @@ -33,14 +33,10 @@ G_BEGIN_DECLS #define CLUTTER_TYPE_SNAP_CONSTRAINT (clutter_snap_constraint_get_type ()) -#define CLUTTER_SNAP_CONSTRAINT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_SNAP_CONSTRAINT, ClutterSnapConstraint)) -#define CLUTTER_IS_SNAP_CONSTRAINT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_SNAP_CONSTRAINT)) - -typedef struct _ClutterSnapConstraint ClutterSnapConstraint; -typedef struct _ClutterSnapConstraintClass ClutterSnapConstraintClass; CLUTTER_EXPORT -GType clutter_snap_constraint_get_type (void) G_GNUC_CONST; +G_DECLARE_FINAL_TYPE (ClutterSnapConstraint, clutter_snap_constraint, + CLUTTER, SNAP_CONSTRAINT, ClutterConstraint) CLUTTER_EXPORT ClutterConstraint * clutter_snap_constraint_new (ClutterActor *source,