summaryrefslogtreecommitdiff
path: root/libview/ev-transition-animation.c
diff options
context:
space:
mode:
authorPablo Barciela <[email protected]>2019-08-10 12:18:35 +0200
committerlukefromdc <[email protected]>2019-08-16 20:47:41 +0000
commit520b76a2f8489709e0d35a3f3fe8f8e4c701d9e9 (patch)
tree5196aad0049d49503dfccaa683bb8cf7520adcd4 /libview/ev-transition-animation.c
parent1cf7ae8b89199359fa1f245cacb2844de6c21ba9 (diff)
downloadatril-520b76a2f8489709e0d35a3f3fe8f8e4c701d9e9.tar.bz2
atril-520b76a2f8489709e0d35a3f3fe8f8e4c701d9e9.tar.xz
ev-transition-animation: avoid 'g_type_class_add_private'
Diffstat (limited to 'libview/ev-transition-animation.c')
-rw-r--r--libview/ev-transition-animation.c77
1 files changed, 37 insertions, 40 deletions
diff --git a/libview/ev-transition-animation.c b/libview/ev-transition-animation.c
index c3c825fa..f41aa85c 100644
--- a/libview/ev-transition-animation.c
+++ b/libview/ev-transition-animation.c
@@ -24,12 +24,11 @@
#include "ev-transition-animation.h"
#include "ev-timeline.h"
-#define EV_TRANSITION_ANIMATION_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EV_TYPE_TRANSITION_ANIMATION, EvTransitionAnimationPriv))
#define N_BLINDS 6
-typedef struct EvTransitionAnimationPriv EvTransitionAnimationPriv;
+typedef struct EvTransitionAnimationPrivate EvTransitionAnimationPrivate;
-struct EvTransitionAnimationPriv {
+struct EvTransitionAnimationPrivate {
EvTransitionEffect *effect;
cairo_surface_t *origin_surface;
cairo_surface_t *dest_surface;
@@ -43,7 +42,7 @@ enum {
};
-G_DEFINE_TYPE (EvTransitionAnimation, ev_transition_animation, EV_TYPE_TIMELINE)
+G_DEFINE_TYPE_WITH_PRIVATE (EvTransitionAnimation, ev_transition_animation, EV_TYPE_TIMELINE)
static void
@@ -57,9 +56,9 @@ ev_transition_animation_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec)
{
- EvTransitionAnimationPriv *priv;
+ EvTransitionAnimationPrivate *priv;
- priv = EV_TRANSITION_ANIMATION_GET_PRIVATE (object);
+ priv = ev_transition_animation_get_instance_private (EV_TRANSITION_ANIMATION (object));
switch (prop_id) {
case PROP_EFFECT:
@@ -87,9 +86,9 @@ ev_transition_animation_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
- EvTransitionAnimationPriv *priv;
+ EvTransitionAnimationPrivate *priv;
- priv = EV_TRANSITION_ANIMATION_GET_PRIVATE (object);
+ priv = ev_transition_animation_get_instance_private (EV_TRANSITION_ANIMATION (object));
switch (prop_id) {
case PROP_EFFECT:
@@ -109,9 +108,9 @@ ev_transition_animation_get_property (GObject *object,
static void
ev_transition_animation_finalize (GObject *object)
{
- EvTransitionAnimationPriv *priv;
+ EvTransitionAnimationPrivate *priv;
- priv = EV_TRANSITION_ANIMATION_GET_PRIVATE (object);
+ priv = ev_transition_animation_get_instance_private (EV_TRANSITION_ANIMATION (object));
if (priv->effect)
g_object_unref (priv->effect);
@@ -131,7 +130,7 @@ ev_transition_animation_constructor (GType type,
GObjectConstructParam *construct_params)
{
GObject *object;
- EvTransitionAnimationPriv *priv;
+ EvTransitionAnimationPrivate *priv;
EvTransitionEffect *effect;
gint duration;
@@ -139,7 +138,7 @@ ev_transition_animation_constructor (GType type,
n_construct_properties,
construct_params);
- priv = EV_TRANSITION_ANIMATION_GET_PRIVATE (object);
+ priv = ev_transition_animation_get_instance_private (EV_TRANSITION_ANIMATION (object));
effect = priv->effect;
g_object_get (effect, "duration", &duration, NULL);
@@ -177,8 +176,6 @@ ev_transition_animation_class_init (EvTransitionAnimationClass *klass)
"Destination surface",
"Cairo surface to which the animation will happen",
G_PARAM_READWRITE));
-
- g_type_class_add_private (klass, sizeof (EvTransitionAnimationPriv));
}
static void
@@ -212,12 +209,12 @@ ev_transition_animation_split (cairo_t *cr,
gdouble progress,
GdkRectangle page_area)
{
- EvTransitionAnimationPriv *priv;
+ EvTransitionAnimationPrivate *priv;
EvTransitionEffectAlignment alignment;
EvTransitionEffectDirection direction;
gint width, height;
- priv = EV_TRANSITION_ANIMATION_GET_PRIVATE (animation);
+ priv = ev_transition_animation_get_instance_private (animation);
width = page_area.width;
height = page_area.height;
@@ -276,11 +273,11 @@ ev_transition_animation_blinds (cairo_t *cr,
gdouble progress,
GdkRectangle page_area)
{
- EvTransitionAnimationPriv *priv;
+ EvTransitionAnimationPrivate *priv;
EvTransitionEffectAlignment alignment;
gint width, height, i;
- priv = EV_TRANSITION_ANIMATION_GET_PRIVATE (animation);
+ priv = ev_transition_animation_get_instance_private (animation);
width = page_area.width;
height = page_area.height;
@@ -320,11 +317,11 @@ ev_transition_animation_box (cairo_t *cr,
gdouble progress,
GdkRectangle page_area)
{
- EvTransitionAnimationPriv *priv;
+ EvTransitionAnimationPrivate *priv;
EvTransitionEffectDirection direction;
gint width, height;
- priv = EV_TRANSITION_ANIMATION_GET_PRIVATE (animation);
+ priv = ev_transition_animation_get_instance_private (animation);
width = page_area.width;
height = page_area.height;
@@ -364,11 +361,11 @@ ev_transition_animation_wipe (cairo_t *cr,
gdouble progress,
GdkRectangle page_area)
{
- EvTransitionAnimationPriv *priv;
+ EvTransitionAnimationPrivate *priv;
gint width, height;
gint angle;
- priv = EV_TRANSITION_ANIMATION_GET_PRIVATE (animation);
+ priv = ev_transition_animation_get_instance_private (animation);
width = page_area.width;
height = page_area.height;
@@ -418,9 +415,9 @@ ev_transition_animation_dissolve (cairo_t *cr,
gdouble progress,
GdkRectangle page_area)
{
- EvTransitionAnimationPriv *priv;
+ EvTransitionAnimationPrivate *priv;
- priv = EV_TRANSITION_ANIMATION_GET_PRIVATE (animation);
+ priv = ev_transition_animation_get_instance_private (animation);
paint_surface (cr, priv->dest_surface, 0, 0, 1., page_area);
paint_surface (cr, priv->origin_surface, 0, 0, 1 - progress, page_area);
@@ -433,11 +430,11 @@ ev_transition_animation_push (cairo_t *cr,
gdouble progress,
GdkRectangle page_area)
{
- EvTransitionAnimationPriv *priv;
+ EvTransitionAnimationPrivate *priv;
gint width, height;
gint angle;
- priv = EV_TRANSITION_ANIMATION_GET_PRIVATE (animation);
+ priv = ev_transition_animation_get_instance_private (animation);
width = page_area.width;
height = page_area.height;
@@ -463,11 +460,11 @@ ev_transition_animation_cover (cairo_t *cr,
gdouble progress,
GdkRectangle page_area)
{
- EvTransitionAnimationPriv *priv;
+ EvTransitionAnimationPrivate *priv;
gint width, height;
gint angle;
- priv = EV_TRANSITION_ANIMATION_GET_PRIVATE (animation);
+ priv = ev_transition_animation_get_instance_private (animation);
width = page_area.width;
height = page_area.height;
@@ -493,11 +490,11 @@ ev_transition_animation_uncover (cairo_t *cr,
gdouble progress,
GdkRectangle page_area)
{
- EvTransitionAnimationPriv *priv;
+ EvTransitionAnimationPrivate *priv;
gint width, height;
gint angle;
- priv = EV_TRANSITION_ANIMATION_GET_PRIVATE (animation);
+ priv = ev_transition_animation_get_instance_private (animation);
width = page_area.width;
height = page_area.height;
@@ -523,9 +520,9 @@ ev_transition_animation_fade (cairo_t *cr,
gdouble progress,
GdkRectangle page_area)
{
- EvTransitionAnimationPriv *priv;
+ EvTransitionAnimationPrivate *priv;
- priv = EV_TRANSITION_ANIMATION_GET_PRIVATE (animation);
+ priv = ev_transition_animation_get_instance_private (animation);
paint_surface (cr, priv->origin_surface, 0, 0, 1., page_area);
paint_surface (cr, priv->dest_surface, 0, 0, progress, page_area);
@@ -536,13 +533,13 @@ ev_transition_animation_paint (EvTransitionAnimation *animation,
cairo_t *cr,
GdkRectangle page_area)
{
- EvTransitionAnimationPriv *priv;
+ EvTransitionAnimationPrivate *priv;
EvTransitionEffectType type;
gdouble progress;
g_return_if_fail (EV_IS_TRANSITION_ANIMATION (animation));
- priv = EV_TRANSITION_ANIMATION_GET_PRIVATE (animation);
+ priv = ev_transition_animation_get_instance_private (animation);
if (!priv->dest_surface) {
/* animation is still not ready, paint the origin surface */
@@ -615,12 +612,12 @@ void
ev_transition_animation_set_origin_surface (EvTransitionAnimation *animation,
cairo_surface_t *origin_surface)
{
- EvTransitionAnimationPriv *priv;
+ EvTransitionAnimationPrivate *priv;
cairo_surface_t *surface;
g_return_if_fail (EV_IS_TRANSITION_ANIMATION (animation));
- priv = EV_TRANSITION_ANIMATION_GET_PRIVATE (animation);
+ priv = ev_transition_animation_get_instance_private (animation);
if (priv->origin_surface == origin_surface)
return;
@@ -641,12 +638,12 @@ void
ev_transition_animation_set_dest_surface (EvTransitionAnimation *animation,
cairo_surface_t *dest_surface)
{
- EvTransitionAnimationPriv *priv;
+ EvTransitionAnimationPrivate *priv;
cairo_surface_t *surface;
g_return_if_fail (EV_IS_TRANSITION_ANIMATION (animation));
- priv = EV_TRANSITION_ANIMATION_GET_PRIVATE (animation);
+ priv = ev_transition_animation_get_instance_private (animation);
if (priv->dest_surface == dest_surface)
return;
@@ -666,11 +663,11 @@ ev_transition_animation_set_dest_surface (EvTransitionAnimation *animation,
gboolean
ev_transition_animation_ready (EvTransitionAnimation *animation)
{
- EvTransitionAnimationPriv *priv;
+ EvTransitionAnimationPrivate *priv;
g_return_val_if_fail (EV_IS_TRANSITION_ANIMATION (animation), FALSE);
- priv = EV_TRANSITION_ANIMATION_GET_PRIVATE (animation);
+ priv = ev_transition_animation_get_instance_private (animation);
return (priv->origin_surface != NULL);
}