snap-constraint: 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:30:01 +01:00
parent 7e7e9795fe
commit d79f0ab9f3
3 changed files with 6 additions and 19 deletions

View File

@ -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 (ClutterRotateAction, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterScrollActor, 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 (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 (ClutterStage, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterSwipeAction, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterSwipeAction, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterTapAction, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterTapAction, g_object_unref)

View File

@ -24,7 +24,7 @@
/** /**
* ClutterSnapConstraint: * ClutterSnapConstraint:
* *
* A constraint snapping two actors together * A constraint snapping two actors together
* *
* #ClutterSnapConstraint is a constraint the snaps the edges of two * #ClutterSnapConstraint is a constraint the snaps the edges of two
@ -45,9 +45,6 @@
#include "clutter/clutter-enum-types.h" #include "clutter/clutter-enum-types.h"
#include "clutter/clutter-private.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 struct _ClutterSnapConstraint
{ {
@ -62,11 +59,6 @@ struct _ClutterSnapConstraint
gfloat offset; gfloat offset;
}; };
struct _ClutterSnapConstraintClass
{
ClutterConstraintClass parent_class;
};
enum enum
{ {
PROP_0, PROP_0,
@ -79,9 +71,9 @@ enum
PROP_LAST PROP_LAST
}; };
G_DEFINE_TYPE (ClutterSnapConstraint, G_DEFINE_FINAL_TYPE (ClutterSnapConstraint,
clutter_snap_constraint, clutter_snap_constraint,
CLUTTER_TYPE_CONSTRAINT); CLUTTER_TYPE_CONSTRAINT);
static GParamSpec *obj_props[PROP_LAST] = { NULL, }; static GParamSpec *obj_props[PROP_LAST] = { NULL, };

View File

@ -33,14 +33,10 @@
G_BEGIN_DECLS G_BEGIN_DECLS
#define CLUTTER_TYPE_SNAP_CONSTRAINT (clutter_snap_constraint_get_type ()) #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 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 CLUTTER_EXPORT
ClutterConstraint * clutter_snap_constraint_new (ClutterActor *source, ClutterConstraint * clutter_snap_constraint_new (ClutterActor *source,