From 5b527ac89bf4498f64f5bc5485a14b5b7a47fb1f Mon Sep 17 00:00:00 2001 From: Bilal Elmoussaoui Date: Sat, 11 Nov 2023 10:58:02 +0100 Subject: [PATCH] fixed-layout: Use macros for subclassing boilerplate Part-of: --- clutter/clutter/clutter-autocleanups.h | 1 - clutter/clutter/clutter-fixed-layout.c | 11 ++++++--- clutter/clutter/clutter-fixed-layout.h | 31 ++++---------------------- 3 files changed, 12 insertions(+), 31 deletions(-) diff --git a/clutter/clutter/clutter-autocleanups.h b/clutter/clutter/clutter-autocleanups.h index ba9fbce4e..fc379fbae 100644 --- a/clutter/clutter/clutter-autocleanups.h +++ b/clutter/clutter/clutter-autocleanups.h @@ -34,7 +34,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBackend, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBrightnessContrastEffect, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterClone, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterDesaturateEffect, g_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterFixedLayout, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterFlowLayout, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterGridLayout, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterInputDevice, g_object_unref) diff --git a/clutter/clutter/clutter-fixed-layout.c b/clutter/clutter/clutter-fixed-layout.c index 2fed3d514..f082a6164 100644 --- a/clutter/clutter/clutter-fixed-layout.c +++ b/clutter/clutter/clutter-fixed-layout.c @@ -39,9 +39,14 @@ #include "clutter/clutter-fixed-layout.h" #include "clutter/clutter-private.h" -G_DEFINE_TYPE (ClutterFixedLayout, - clutter_fixed_layout, - CLUTTER_TYPE_LAYOUT_MANAGER); +struct _ClutterFixedLayout +{ + ClutterLayoutManager parent_instance; +}; + +G_DEFINE_FINAL_TYPE (ClutterFixedLayout, + clutter_fixed_layout, + CLUTTER_TYPE_LAYOUT_MANAGER); static void clutter_fixed_layout_get_preferred_width (ClutterLayoutManager *manager, diff --git a/clutter/clutter/clutter-fixed-layout.h b/clutter/clutter/clutter-fixed-layout.h index 5bf14de8d..789a4732e 100644 --- a/clutter/clutter/clutter-fixed-layout.h +++ b/clutter/clutter/clutter-fixed-layout.h @@ -33,35 +33,12 @@ G_BEGIN_DECLS #define CLUTTER_TYPE_FIXED_LAYOUT (clutter_fixed_layout_get_type ()) -#define CLUTTER_FIXED_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_FIXED_LAYOUT, ClutterFixedLayout)) -#define CLUTTER_IS_FIXED_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_FIXED_LAYOUT)) -#define CLUTTER_FIXED_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_FIXED_LAYOUT, ClutterFixedLayoutClass)) -#define CLUTTER_IS_FIXED_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_FIXED_LAYOUT)) -#define CLUTTER_FIXED_LAYOUT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_FIXED_LAYOUT, ClutterFixedLayoutClass)) - -typedef struct _ClutterFixedLayout ClutterFixedLayout; -typedef struct _ClutterFixedLayoutClass ClutterFixedLayoutClass; - -struct _ClutterFixedLayout -{ - /*< private >*/ - ClutterLayoutManager parent_instance; -}; - -/** - * ClutterFixedLayoutClass: - * - * The #ClutterFixedLayoutClass structure contains only private data - * and it should be accessed using the provided API - */ -struct _ClutterFixedLayoutClass -{ - /*< private >*/ - ClutterLayoutManagerClass parent_class; -}; CLUTTER_EXPORT -GType clutter_fixed_layout_get_type (void) G_GNUC_CONST; +G_DECLARE_FINAL_TYPE (ClutterFixedLayout, + clutter_fixed_layout, + CLUTTER, FIXED_LAYOUT, + ClutterLayoutManager) CLUTTER_EXPORT ClutterLayoutManager *clutter_fixed_layout_new (void);