property-transition: Use macros for subclassing boilerplate
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3387>
This commit is contained in:
parent
57fbc304f5
commit
6e3223a0cc
@ -46,7 +46,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterInterval, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterKeyframeTransition, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterOffscreenEffect, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPageTurnEffect, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPropertyTransition, 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 (ClutterStage, g_object_unref)
|
||||
|
@ -38,12 +38,12 @@
|
||||
#include "clutter/clutter-private.h"
|
||||
#include "clutter/clutter-transition.h"
|
||||
|
||||
struct _ClutterPropertyTransitionPrivate
|
||||
typedef struct _ClutterPropertyTransitionPrivate
|
||||
{
|
||||
char *property_name;
|
||||
|
||||
GParamSpec *pspec;
|
||||
};
|
||||
} ClutterPropertyTransitionPrivate;
|
||||
|
||||
enum
|
||||
{
|
||||
@ -63,7 +63,8 @@ clutter_property_transition_ensure_interval (ClutterPropertyTransition *transiti
|
||||
ClutterAnimatable *animatable,
|
||||
ClutterInterval *interval)
|
||||
{
|
||||
ClutterPropertyTransitionPrivate *priv = transition->priv;
|
||||
ClutterPropertyTransitionPrivate *priv =
|
||||
clutter_property_transition_get_instance_private (transition);
|
||||
GValue *value_p;
|
||||
|
||||
if (clutter_interval_is_valid (interval))
|
||||
@ -95,7 +96,8 @@ clutter_property_transition_attached (ClutterTransition *transition,
|
||||
ClutterAnimatable *animatable)
|
||||
{
|
||||
ClutterPropertyTransition *self = CLUTTER_PROPERTY_TRANSITION (transition);
|
||||
ClutterPropertyTransitionPrivate *priv = self->priv;
|
||||
ClutterPropertyTransitionPrivate *priv =
|
||||
clutter_property_transition_get_instance_private (self);
|
||||
ClutterInterval *interval;
|
||||
|
||||
if (priv->property_name == NULL)
|
||||
@ -119,7 +121,8 @@ clutter_property_transition_detached (ClutterTransition *transition,
|
||||
ClutterAnimatable *animatable)
|
||||
{
|
||||
ClutterPropertyTransition *self = CLUTTER_PROPERTY_TRANSITION (transition);
|
||||
ClutterPropertyTransitionPrivate *priv = self->priv;
|
||||
ClutterPropertyTransitionPrivate *priv =
|
||||
clutter_property_transition_get_instance_private (self);
|
||||
|
||||
priv->pspec = NULL;
|
||||
}
|
||||
@ -131,7 +134,8 @@ clutter_property_transition_compute_value (ClutterTransition *transition,
|
||||
gdouble progress)
|
||||
{
|
||||
ClutterPropertyTransition *self = CLUTTER_PROPERTY_TRANSITION (transition);
|
||||
ClutterPropertyTransitionPrivate *priv = self->priv;
|
||||
ClutterPropertyTransitionPrivate *priv =
|
||||
clutter_property_transition_get_instance_private (self);
|
||||
GValue value = G_VALUE_INIT;
|
||||
GType p_type, i_type;
|
||||
gboolean res;
|
||||
@ -214,7 +218,9 @@ clutter_property_transition_get_property (GObject *gobject,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterPropertyTransitionPrivate *priv = CLUTTER_PROPERTY_TRANSITION (gobject)->priv;
|
||||
ClutterPropertyTransition *self = CLUTTER_PROPERTY_TRANSITION (gobject);
|
||||
ClutterPropertyTransitionPrivate *priv =
|
||||
clutter_property_transition_get_instance_private (self);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
@ -230,9 +236,9 @@ clutter_property_transition_get_property (GObject *gobject,
|
||||
static void
|
||||
clutter_property_transition_finalize (GObject *gobject)
|
||||
{
|
||||
ClutterPropertyTransitionPrivate *priv;
|
||||
|
||||
priv = CLUTTER_PROPERTY_TRANSITION (gobject)->priv;
|
||||
ClutterPropertyTransition *self = CLUTTER_PROPERTY_TRANSITION (gobject);
|
||||
ClutterPropertyTransitionPrivate *priv =
|
||||
clutter_property_transition_get_instance_private (self);
|
||||
|
||||
g_free (priv->property_name);
|
||||
|
||||
@ -269,7 +275,6 @@ clutter_property_transition_class_init (ClutterPropertyTransitionClass *klass)
|
||||
static void
|
||||
clutter_property_transition_init (ClutterPropertyTransition *self)
|
||||
{
|
||||
self->priv = clutter_property_transition_get_instance_private (self);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -325,7 +330,7 @@ clutter_property_transition_set_property_name (ClutterPropertyTransition *transi
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_PROPERTY_TRANSITION (transition));
|
||||
|
||||
priv = transition->priv;
|
||||
priv = clutter_property_transition_get_instance_private (transition);
|
||||
|
||||
if (g_strcmp0 (priv->property_name, property_name) == 0)
|
||||
return;
|
||||
@ -360,7 +365,10 @@ clutter_property_transition_set_property_name (ClutterPropertyTransition *transi
|
||||
const char *
|
||||
clutter_property_transition_get_property_name (ClutterPropertyTransition *transition)
|
||||
{
|
||||
ClutterPropertyTransitionPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_PROPERTY_TRANSITION (transition), NULL);
|
||||
|
||||
return transition->priv->property_name;
|
||||
priv = clutter_property_transition_get_instance_private (transition);
|
||||
return priv->property_name;
|
||||
}
|
||||
|
@ -33,22 +33,13 @@
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_TYPE_PROPERTY_TRANSITION (clutter_property_transition_get_type ())
|
||||
#define CLUTTER_PROPERTY_TRANSITION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_PROPERTY_TRANSITION, ClutterPropertyTransition))
|
||||
#define CLUTTER_IS_PROPERTY_TRANSITION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_PROPERTY_TRANSITION))
|
||||
#define CLUTTER_PROPERTY_TRANSITION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_PROPERTY_TRANSITION, ClutterPropertyTransitionClass))
|
||||
#define CLUTTER_IS_PROPERTY_TRANSITION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_PROPERTY_TRANSITION))
|
||||
#define CLUTTER_PROPERTY_TRANSITION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_PROPERTY_TRANSITION, ClutterPropertyTransitionClass))
|
||||
|
||||
typedef struct _ClutterPropertyTransitionPrivate ClutterPropertyTransitionPrivate;
|
||||
typedef struct _ClutterPropertyTransitionClass ClutterPropertyTransitionClass;
|
||||
|
||||
struct _ClutterPropertyTransition
|
||||
{
|
||||
/*< private >*/
|
||||
ClutterTransition parent_instance;
|
||||
|
||||
ClutterPropertyTransitionPrivate *priv;
|
||||
};
|
||||
CLUTTER_EXPORT
|
||||
G_DECLARE_DERIVABLE_TYPE (ClutterPropertyTransition,
|
||||
clutter_property_transition,
|
||||
CLUTTER,
|
||||
PROPERTY_TRANSITION,
|
||||
ClutterTransition)
|
||||
|
||||
/**
|
||||
* ClutterPropertyTransitionClass:
|
||||
@ -62,9 +53,6 @@ struct _ClutterPropertyTransitionClass
|
||||
ClutterTransitionClass parent_class;
|
||||
};
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GType clutter_property_transition_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterTransition * clutter_property_transition_new_for_actor (ClutterActor *actor,
|
||||
const char *property_name);
|
||||
|
Loading…
Reference in New Issue
Block a user