settings: Use macros for subclassing boilerplate

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3387>
This commit is contained in:
Bilal Elmoussaoui 2023-11-10 15:04:21 +01:00
parent d6b4c3a5d1
commit e729e63963
3 changed files with 5 additions and 18 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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);