From e729e63963b4cc91c28f48b9e795e25b765f6cfa Mon Sep 17 00:00:00 2001 From: Bilal Elmoussaoui Date: Fri, 10 Nov 2023 15:04:21 +0100 Subject: [PATCH] settings: Use macros for subclassing boilerplate Part-of: --- clutter/clutter/clutter-autocleanups.h | 1 - clutter/clutter/clutter-settings.c | 13 ++----------- clutter/clutter/clutter-settings.h | 9 +++------ 3 files changed, 5 insertions(+), 18 deletions(-) diff --git a/clutter/clutter/clutter-autocleanups.h b/clutter/clutter/clutter-autocleanups.h index 441bf050f..3aaf6db7e 100644 --- a/clutter/clutter/clutter-autocleanups.h +++ b/clutter/clutter/clutter-autocleanups.h @@ -53,7 +53,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPanAction, g_object_unref) 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 (ClutterSettings, 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) diff --git a/clutter/clutter/clutter-settings.c b/clutter/clutter/clutter-settings.c index 4d82671e8..d542b15cc 100644 --- a/clutter/clutter/clutter-settings.c +++ b/clutter/clutter/clutter-settings.c @@ -1,6 +1,6 @@ /** * ClutterSettings: - * + * * Settings configuration * * Clutter depends on some settings to perform operations like detecting @@ -35,10 +35,6 @@ #define DEFAULT_FONT_NAME "Sans 12" -#define CLUTTER_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_SETTINGS, ClutterSettingsClass)) -#define CLUTTER_IS_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_SETTINGS)) -#define CLUTTER_SETTINGS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_SETTINGS, ClutterSettingsClass)) - typedef struct { cairo_antialias_t cairo_antialias; @@ -84,11 +80,6 @@ struct _ClutterSettings gint unscaled_font_dpi; }; -struct _ClutterSettingsClass -{ - GObjectClass parent_class; -}; - enum { PROP_0, @@ -119,7 +110,7 @@ enum static GParamSpec *obj_props[PROP_LAST]; -G_DEFINE_TYPE (ClutterSettings, clutter_settings, G_TYPE_OBJECT); +G_DEFINE_FINAL_TYPE (ClutterSettings, clutter_settings, G_TYPE_OBJECT); static inline void settings_update_font_options (ClutterSettings *self) diff --git a/clutter/clutter/clutter-settings.h b/clutter/clutter/clutter-settings.h index 2b3a46fb4..0516ddfaf 100644 --- a/clutter/clutter/clutter-settings.h +++ b/clutter/clutter/clutter-settings.h @@ -9,14 +9,11 @@ G_BEGIN_DECLS #define CLUTTER_TYPE_SETTINGS (clutter_settings_get_type ()) -#define CLUTTER_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_SETTINGS, ClutterSettings)) -#define CLUTTER_IS_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_SETTINGS)) - -typedef struct _ClutterSettings ClutterSettings; -typedef struct _ClutterSettingsClass ClutterSettingsClass; CLUTTER_EXPORT -GType clutter_settings_get_type (void) G_GNUC_CONST; +G_DECLARE_FINAL_TYPE (ClutterSettings, clutter_settings, + CLUTTER, SETTINGS, + GObject) CLUTTER_EXPORT ClutterSettings *clutter_settings_get_default (void);