[libadwaita] Fixes
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libadwaita] Fixes
- Date: Mon, 26 Jul 2021 19:56:41 +0000 (UTC)
commit 943fb62e93034172d45988fcf058861d273863b3
Author: Manuel Genovés <manuel genoves gmail com>
Date: Wed Jul 21 21:41:53 2021 +0200
Fixes
src/adw-animation-private.h | 57 +++++++++++++++++--------------
src/adw-animation-util-private.h | 2 ++
src/adw-animation-util.c | 3 +-
src/adw-animation-util.h | 1 +
src/adw-animation.c | 27 ++++++++++-----
src/adw-carousel-indicator-dots.c | 7 ++--
src/adw-carousel-indicator-lines.c | 7 ++--
src/adw-carousel.c | 14 ++++----
src/adw-flap.c | 15 ++++----
src/adw-tab-box.c | 70 ++++++++++++++++----------------------
src/adw-tab.c | 7 ++--
11 files changed, 106 insertions(+), 104 deletions(-)
---
diff --git a/src/adw-animation-private.h b/src/adw-animation-private.h
index 51b66b2b..34db2b51 100644
--- a/src/adw-animation-private.h
+++ b/src/adw-animation-private.h
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2019 Purism SPC
+ * Copyright (C) 2021 Manuel Genovés <manuel genoves gmail com>
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
@@ -22,10 +23,12 @@ typedef void (*AdwAnimationTargetFunc) (double value,
G_DECLARE_FINAL_TYPE (AdwAnimationTarget, adw_animation_target, ADW, ANIMATION_TARGET, GObject)
-
AdwAnimationTarget *adw_animation_target_new (AdwAnimationTargetFunc callback,
gpointer data);
+void adw_animation_target_set_value (AdwAnimationTarget *target,
+ double value);
+
#define ADW_TYPE_ANIMATION (adw_animation_get_type())
G_DECLARE_DERIVABLE_TYPE (AdwAnimation, adw_animation, ADW, ANIMATION, GObject)
@@ -59,12 +62,12 @@ struct _AdwAnimationClass
gpointer padding[4];
};
-AdwAnimation *adw_animation_new (GtkWidget *widget,
- double from,
- double to,
- gint64 duration,
- AdwAnimationTargetFunc value_cb,
- gpointer user_data) G_GNUC_WARN_UNUSED_RESULT;
+AdwAnimation *adw_animation_new (GtkWidget *widget,
+ double from,
+ double to,
+ gint64 duration,
+ AdwAnimationTargetFunc value_cb,
+ gpointer user_data) G_GNUC_WARN_UNUSED_RESULT;
void adw_animation_start (AdwAnimation *self);
void adw_animation_stop (AdwAnimation *self);
@@ -72,24 +75,26 @@ void adw_animation_stop (AdwAnimation *self);
GtkWidget *adw_animation_get_widget (AdwAnimation *self);
double adw_animation_get_value (AdwAnimation *self);
-double adw_animation_get_value_from (AdwAnimation *self);
-double adw_animation_get_value_to (AdwAnimation *self);
-gint64 adw_animation_get_duration (AdwAnimation *self);
-AdwAnimationInterpolator adw_animation_get_interpolator (AdwAnimation *self);
-AdwAnimationTarget *adw_animation_get_target (AdwAnimation *self);
-AdwAnimationStatus adw_animation_get_status (AdwAnimation *self);
-
-void adw_animation_set_value_from (AdwAnimation *self,
- double value);
-void adw_animation_set_value_to (AdwAnimation *self,
- double value);
-void adw_animation_set_duration (AdwAnimation *self,
- gint64 duration);
-void adw_animation_set_interpolator (AdwAnimation *self,
- AdwAnimationInterpolator interpolator);
-void adw_animation_target_set_value (AdwAnimationTarget *target,
- double value);
-void adw_animation_set_status (AdwAnimation *self,
- AdwAnimationStatus status);
+double adw_animation_get_value_from (AdwAnimation *self);
+void adw_animation_set_value_from (AdwAnimation *self,
+ double value);
+
+double adw_animation_get_value_to (AdwAnimation *self);
+void adw_animation_set_value_to (AdwAnimation *self,
+ double value);
+
+gint64 adw_animation_get_duration (AdwAnimation *self);
+void adw_animation_set_duration (AdwAnimation *self,
+ gint64 duration);
+
+AdwAnimationInterpolator adw_animation_get_interpolator (AdwAnimation *self);
+void adw_animation_set_interpolator (AdwAnimation *self,
+ AdwAnimationInterpolator interpolator);
+
+AdwAnimationTarget *adw_animation_get_target (AdwAnimation *self);
+
+AdwAnimationStatus adw_animation_get_status (AdwAnimation *self);
+void adw_animation_set_status (AdwAnimation *self,
+ AdwAnimationStatus status);
G_END_DECLS
diff --git a/src/adw-animation-util-private.h b/src/adw-animation-util-private.h
index cd9a975e..f6647361 100644
--- a/src/adw-animation-util-private.h
+++ b/src/adw-animation-util-private.h
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2019 Purism SPC
+ * Copyright (C) 2021 Manuel Genovés <manuel genoves gmail com>
*
* SPDX-License-Identifier: LGPL-2.1+
*/
@@ -17,6 +18,7 @@ G_BEGIN_DECLS
double adw_ease_in_cubic (double t);
double adw_ease_in_out_cubic (double t);
+
double adw_lerp (double a,
double b,
double t);
diff --git a/src/adw-animation-util.c b/src/adw-animation-util.c
index 48cd7abb..b4a32d35 100644
--- a/src/adw-animation-util.c
+++ b/src/adw-animation-util.c
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2019-2020 Purism SPC
+ * Copyright (C) 2021 Manuel Genovés <manuel genoves gmail com>
*
* SPDX-License-Identifier: LGPL-2.1+
*/
@@ -85,7 +86,7 @@ adw_get_enable_animations (GtkWidget *widget)
{
gboolean enable_animations = TRUE;
- g_assert (GTK_IS_WIDGET (widget));
+ g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
g_object_get (gtk_widget_get_settings (widget),
"gtk-enable-animations", &enable_animations,
diff --git a/src/adw-animation-util.h b/src/adw-animation-util.h
index 742c40eb..e97a2e88 100644
--- a/src/adw-animation-util.h
+++ b/src/adw-animation-util.h
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2019 Purism SPC
+ * Copyright (C) 2021 Manuel Genovés <manuel genoves gmail com>
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
diff --git a/src/adw-animation.c b/src/adw-animation.c
index d59eadc6..d33784d2 100644
--- a/src/adw-animation.c
+++ b/src/adw-animation.c
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2019-2020 Purism SPC
+ * Copyright (C) 2021 Manuel Genovés <manuel genoves gmail com>
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
@@ -260,7 +261,6 @@ adw_animation_init (AdwAnimation *self)
{
}
-
static void
done (AdwAnimation *self)
{
@@ -270,6 +270,8 @@ done (AdwAnimation *self)
return;
priv->status = ADW_ANIMATION_STATUS_COMPLETED;
+ g_object_notify_by_pspec (G_OBJECT (self), props[PROP_STATUS]);
+
g_signal_emit (self, signals[SIGNAL_DONE], 0);
}
@@ -326,22 +328,19 @@ adw_animation_new (GtkWidget *widget,
AdwAnimationTargetFunc target_func,
gpointer user_data)
{
- AdwAnimation *self;
AdwAnimationTarget *target;
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
g_return_val_if_fail (target_func != NULL, NULL);
target = adw_animation_target_new(target_func, user_data);
- self = g_object_new (ADW_TYPE_ANIMATION,
+ return g_object_new (ADW_TYPE_ANIMATION,
"widget", widget,
"value-from", from,
"value-to", to,
"duration", duration,
"target", target,
NULL);
-
- return self;
}
@@ -448,7 +447,7 @@ adw_animation_get_interpolator (AdwAnimation *self)
{
AdwAnimationPrivate *priv = adw_animation_get_instance_private (self);
- g_return_val_if_fail (ADW_IS_ANIMATION (self), 0);
+ g_return_val_if_fail (ADW_IS_ANIMATION (self), ADW_ANIMATION_INTERPOLATOR_EASE_OUT);
return priv->interpolator;
}
@@ -466,9 +465,11 @@ adw_animation_get_target (AdwAnimation *self)
AdwAnimationStatus
adw_animation_get_status (AdwAnimation *self)
{
- AdwAnimationPrivate *priv = adw_animation_get_instance_private (self);
+ AdwAnimationPrivate *priv;
- g_return_val_if_fail (ADW_IS_ANIMATION (self), 0);
+ g_return_val_if_fail (ADW_IS_ANIMATION (self), ADW_ANIMATION_STATUS_NONE);
+
+ priv = adw_animation_get_instance_private (self);
return priv->status;
}
@@ -485,6 +486,8 @@ adw_animation_set_value_from (AdwAnimation *self,
return;
priv->value_from = value;
+
+ g_object_notify_by_pspec (G_OBJECT (self), props[PROP_VALUE_FROM]);
}
void
@@ -499,6 +502,8 @@ adw_animation_set_value_to (AdwAnimation *self,
return;
priv->value_to = value;
+
+ g_object_notify_by_pspec (G_OBJECT (self), props[PROP_VALUE_TO]);
}
void
@@ -513,6 +518,8 @@ adw_animation_set_duration (AdwAnimation *self,
return;
priv->duration = duration;
+
+ g_object_notify_by_pspec (G_OBJECT (self), props[PROP_DURATION]);
}
void
@@ -528,6 +535,8 @@ adw_animation_set_interpolator (AdwAnimation *self,
return;
priv->interpolator = interpolator;
+
+ g_object_notify_by_pspec (G_OBJECT (self), props[PROP_INTERPOLATOR]);
}
void
@@ -543,6 +552,8 @@ adw_animation_set_status (AdwAnimation *self,
return;
priv->status = status;
+
+ g_object_notify_by_pspec (G_OBJECT (self), props[PROP_STATUS]);
}
struct _AdwAnimationTarget
diff --git a/src/adw-carousel-indicator-dots.c b/src/adw-carousel-indicator-dots.c
index 2c43500b..f4ec4a8e 100644
--- a/src/adw-carousel-indicator-dots.c
+++ b/src/adw-carousel-indicator-dots.c
@@ -91,11 +91,10 @@ animate (AdwCarouselIndicatorDots *self,
(AdwAnimationTargetFunc) value_cb,
self);
- g_object_set (self->animation,
- "interpolator", ADW_ANIMATION_INTERPOLATOR_EASE_OUT,
- NULL);
+ adw_animation_set_interpolator (self->animation,
+ ADW_ANIMATION_INTERPOLATOR_EASE_OUT);
- g_signal_connect_swapped(self->animation, "done", G_CALLBACK (done_cb), self);
+ g_signal_connect_swapped (self->animation, "done", G_CALLBACK (done_cb), self);
adw_animation_start (self->animation);
}
diff --git a/src/adw-carousel-indicator-lines.c b/src/adw-carousel-indicator-lines.c
index a4a9e9d3..1e360114 100644
--- a/src/adw-carousel-indicator-lines.c
+++ b/src/adw-carousel-indicator-lines.c
@@ -89,11 +89,10 @@ animate (AdwCarouselIndicatorLines *self,
(AdwAnimationTargetFunc) value_cb,
self);
- g_object_set (self->animation,
- "interpolator", ADW_ANIMATION_INTERPOLATOR_EASE_OUT,
- NULL);
+ adw_animation_set_interpolator (self->animation,
+ ADW_ANIMATION_INTERPOLATOR_EASE_OUT);
- g_signal_connect_swapped(self->animation, "done", G_CALLBACK (done_cb), self);
+ g_signal_connect_swapped (self->animation, "done", G_CALLBACK (done_cb), self);
adw_animation_start (self->animation);
}
diff --git a/src/adw-carousel.c b/src/adw-carousel.c
index c12742d8..2d22cc02 100644
--- a/src/adw-carousel.c
+++ b/src/adw-carousel.c
@@ -329,11 +329,10 @@ animate_child_resize (AdwCarousel *self,
(AdwAnimationTargetFunc) resize_animation_value_cb,
child);
- g_object_set (child->resize_animation,
- "interpolator", ADW_ANIMATION_INTERPOLATOR_EASE_OUT,
- NULL);
+ adw_animation_set_interpolator (child->resize_animation,
+ ADW_ANIMATION_INTERPOLATOR_EASE_OUT);
- g_signal_connect_swapped(child->resize_animation, "done", G_CALLBACK (resize_animation_done_cb), child);
+ g_signal_connect_swapped (child->resize_animation, "done", G_CALLBACK (resize_animation_done_cb), child);
adw_animation_start (child->resize_animation);
}
@@ -391,11 +390,10 @@ scroll_to (AdwCarousel *self,
(AdwAnimationTargetFunc) scroll_animation_value_cb,
self);
- g_object_set (self->animation,
- "interpolator", ADW_ANIMATION_INTERPOLATOR_EASE_OUT,
- NULL);
+ adw_animation_set_interpolator (self->animation,
+ ADW_ANIMATION_INTERPOLATOR_EASE_OUT);
- g_signal_connect_swapped(self->animation, "done", G_CALLBACK (scroll_animation_done_cb), self);
+ g_signal_connect_swapped (self->animation, "done", G_CALLBACK (scroll_animation_done_cb), self);
adw_animation_start (self->animation);
}
diff --git a/src/adw-flap.c b/src/adw-flap.c
index bbdb3261..35b3c8ad 100644
--- a/src/adw-flap.c
+++ b/src/adw-flap.c
@@ -10,7 +10,6 @@
#include <math.h>
-#include "adw-animation-util.h"
#include "adw-animation-util-private.h"
#include "adw-animation-private.h"
#include "adw-gizmo-private.h"
@@ -305,11 +304,10 @@ animate_fold (AdwFlap *self)
(AdwAnimationTargetFunc) fold_animation_value_cb,
self);
- g_object_set (self->fold_animation,
- "interpolator", ADW_ANIMATION_INTERPOLATOR_EASE_OUT,
- NULL);
+ adw_animation_set_interpolator (self->fold_animation,
+ ADW_ANIMATION_INTERPOLATOR_EASE_OUT);
- g_signal_connect_swapped(self->fold_animation, "done", G_CALLBACK (fold_animation_done_cb), self);
+ g_signal_connect_swapped (self->fold_animation, "done", G_CALLBACK (fold_animation_done_cb), self);
adw_animation_start (self->fold_animation);
}
@@ -350,11 +348,10 @@ animate_reveal (AdwFlap *self,
(AdwAnimationTargetFunc) reveal_animation_value_cb,
self);
- g_object_set (self->reveal_animation,
- "interpolator", ADW_ANIMATION_INTERPOLATOR_EASE_OUT,
- NULL);
+ adw_animation_set_interpolator (self->reveal_animation,
+ ADW_ANIMATION_INTERPOLATOR_EASE_OUT);
- g_signal_connect_swapped(self->reveal_animation, "done", G_CALLBACK (reveal_animation_done_cb), self);
+ g_signal_connect_swapped (self->reveal_animation, "done", G_CALLBACK (reveal_animation_done_cb), self);
adw_animation_start (self->reveal_animation);
}
diff --git a/src/adw-tab-box.c b/src/adw-tab-box.c
index 6d77a5ec..3c211f9f 100644
--- a/src/adw-tab-box.c
+++ b/src/adw-tab-box.c
@@ -470,11 +470,10 @@ set_tab_resize_mode (AdwTabBox *self,
resize_animation_value_cb,
self);
- g_object_set (self->resize_animation,
- "interpolator", ADW_ANIMATION_INTERPOLATOR_EASE_OUT,
- NULL);
+ adw_animation_set_interpolator (self->resize_animation,
+ ADW_ANIMATION_INTERPOLATOR_EASE_OUT);
- g_signal_connect_swapped(self->resize_animation, "done", G_CALLBACK (resize_animation_done_cb), self);
+ g_signal_connect_swapped (self->resize_animation, "done", G_CALLBACK (resize_animation_done_cb), self);
adw_animation_start (self->resize_animation);
}
@@ -819,11 +818,10 @@ animate_scroll (AdwTabBox *self,
scroll_animation_value_cb,
self);
- g_object_set (self->scroll_animation,
- "interpolator", ADW_ANIMATION_INTERPOLATOR_EASE_OUT,
- NULL);
+ adw_animation_set_interpolator (self->scroll_animation,
+ ADW_ANIMATION_INTERPOLATOR_EASE_OUT);
- g_signal_connect_swapped(self->scroll_animation, "done", G_CALLBACK (scroll_animation_done_cb), self);
+ g_signal_connect_swapped (self->scroll_animation, "done", G_CALLBACK (scroll_animation_done_cb), self);
adw_animation_start (self->scroll_animation);
}
@@ -1056,11 +1054,10 @@ animate_reordering (AdwTabBox *self,
reorder_animation_value_cb,
dest_tab);
- g_object_set (self->reorder_animation,
- "interpolator", ADW_ANIMATION_INTERPOLATOR_EASE_OUT,
- NULL);
+ adw_animation_set_interpolator (self->reorder_animation,
+ ADW_ANIMATION_INTERPOLATOR_EASE_OUT);
- g_signal_connect_swapped(self->reorder_animation, "done", G_CALLBACK (reorder_animation_done_cb),
dest_tab);
+ g_signal_connect_swapped (self->reorder_animation, "done", G_CALLBACK (reorder_animation_done_cb),
dest_tab);
adw_animation_start (self->reorder_animation);
@@ -1112,11 +1109,10 @@ animate_reorder_offset (AdwTabBox *self,
reorder_offset_animation_value_cb,
info);
- g_object_set (info->reorder_animation,
- "interpolator", ADW_ANIMATION_INTERPOLATOR_EASE_OUT,
- NULL);
+ adw_animation_set_interpolator (info->reorder_animation,
+ ADW_ANIMATION_INTERPOLATOR_EASE_OUT);
- g_signal_connect_swapped(info->reorder_animation, "done", G_CALLBACK (reorder_offset_animation_done_cb),
info);
+ g_signal_connect_swapped (info->reorder_animation, "done", G_CALLBACK (reorder_offset_animation_done_cb),
info);
adw_animation_start (info->reorder_animation);
}
@@ -1697,11 +1693,10 @@ page_attached_cb (AdwTabBox *self,
appear_animation_value_cb,
info);
- g_object_set (info->appear_animation,
- "interpolator", ADW_ANIMATION_INTERPOLATOR_EASE_OUT,
- NULL);
+ adw_animation_set_interpolator (info->appear_animation,
+ ADW_ANIMATION_INTERPOLATOR_EASE_OUT);
- g_signal_connect_swapped(info->appear_animation, "done", G_CALLBACK (open_animation_done_cb), info);
+ g_signal_connect_swapped (info->appear_animation, "done", G_CALLBACK (open_animation_done_cb), info);
l = find_nth_alive_tab (self, position);
self->tabs = g_list_insert_before (self->tabs, l, info);
@@ -1808,11 +1803,10 @@ page_detached_cb (AdwTabBox *self,
appear_animation_value_cb,
info);
- g_object_set (info->appear_animation,
- "interpolator", ADW_ANIMATION_INTERPOLATOR_EASE_OUT,
- NULL);
+ adw_animation_set_interpolator (info->appear_animation,
+ ADW_ANIMATION_INTERPOLATOR_EASE_OUT);
- g_signal_connect_swapped(info->appear_animation, "done", G_CALLBACK (close_animation_done_cb), info);
+ g_signal_connect_swapped (info->appear_animation, "done", G_CALLBACK (close_animation_done_cb), info);
adw_animation_start (info->appear_animation);
}
@@ -2005,11 +1999,10 @@ insert_placeholder (AdwTabBox *self,
insert_animation_value_cb,
info);
- g_object_set (info->appear_animation,
- "interpolator", ADW_ANIMATION_INTERPOLATOR_EASE_OUT,
- NULL);
+ adw_animation_set_interpolator (info->appear_animation,
+ ADW_ANIMATION_INTERPOLATOR_EASE_OUT);
- g_signal_connect_swapped(info->appear_animation, "done", G_CALLBACK (open_animation_done_cb), info);
+ g_signal_connect_swapped (info->appear_animation, "done", G_CALLBACK (open_animation_done_cb), info);
adw_animation_start (info->appear_animation);
}
@@ -2058,11 +2051,10 @@ replace_placeholder (AdwTabBox *self,
appear_animation_value_cb,
info);
- g_object_set (info->appear_animation,
- "interpolator", ADW_ANIMATION_INTERPOLATOR_EASE_OUT,
- NULL);
+ adw_animation_set_interpolator (info->appear_animation,
+ ADW_ANIMATION_INTERPOLATOR_EASE_OUT);
- g_signal_connect_swapped(info->appear_animation, "done", G_CALLBACK (replace_animation_done_cb), info);
+ g_signal_connect_swapped (info->appear_animation, "done", G_CALLBACK (replace_animation_done_cb), info);
adw_animation_start (info->appear_animation);
}
@@ -2135,11 +2127,10 @@ remove_placeholder (AdwTabBox *self)
appear_animation_value_cb,
info);
- g_object_set (info->appear_animation,
- "interpolator", ADW_ANIMATION_INTERPOLATOR_EASE_OUT,
- NULL);
+ adw_animation_set_interpolator (info->appear_animation,
+ ADW_ANIMATION_INTERPOLATOR_EASE_OUT);
- g_signal_connect_swapped(info->appear_animation, "done", G_CALLBACK (remove_animation_done_cb), info);
+ g_signal_connect_swapped (info->appear_animation, "done", G_CALLBACK (remove_animation_done_cb), info);
adw_animation_start (info->appear_animation);
}
@@ -2362,11 +2353,10 @@ resize_drag_icon (AdwTabBox *self,
icon_resize_animation_value_cb,
icon);
- g_object_set (icon->resize_animation,
- "interpolator", ADW_ANIMATION_INTERPOLATOR_EASE_OUT,
- NULL);
+ adw_animation_set_interpolator (icon->resize_animation,
+ ADW_ANIMATION_INTERPOLATOR_EASE_OUT);
- g_signal_connect_swapped(icon->resize_animation, "done", G_CALLBACK (icon_resize_animation_done_cb), icon);
+ g_signal_connect_swapped (icon->resize_animation, "done", G_CALLBACK (icon_resize_animation_done_cb),
icon);
adw_animation_start (icon->resize_animation);
}
diff --git a/src/adw-tab.c b/src/adw-tab.c
index 6ea82b32..12a029d6 100644
--- a/src/adw-tab.c
+++ b/src/adw-tab.c
@@ -139,11 +139,10 @@ update_state (AdwTab *self)
(AdwAnimationTargetFunc) close_btn_animation_value_cb,
self);
- g_object_set (self->close_btn_animation,
- "interpolator", ADW_ANIMATION_INTERPOLATOR_EASE_IN_OUT,
- NULL);
+ adw_animation_set_interpolator (self->close_btn_animation,
+ ADW_ANIMATION_INTERPOLATOR_EASE_IN_OUT);
- g_signal_connect_swapped(self->close_btn_animation, "done", G_CALLBACK (close_btn_animation_done_cb),
self);
+ g_signal_connect_swapped (self->close_btn_animation, "done", G_CALLBACK (close_btn_animation_done_cb),
self);
adw_animation_start (self->close_btn_animation);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]