[libadwaita/wip/exalm/animation-cleanups: 1/8] easing: Move to a separate file




commit 0210b65589c085335cf580191c7d71cc60c1f5aa
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Mon Nov 22 18:40:26 2021 +0500

    easing: Move to a separate file

 src/adw-easing.c          | 26 ++++++++++++++++++++++++++
 src/adw-easing.h          | 27 +++++++++++++++++++++++++++
 src/adw-timed-animation.c | 17 -----------------
 src/adw-timed-animation.h |  8 +-------
 src/adwaita.h             |  1 +
 src/meson.build           |  4 +++-
 6 files changed, 58 insertions(+), 25 deletions(-)
---
diff --git a/src/adw-easing.c b/src/adw-easing.c
new file mode 100644
index 00000000..94be65e6
--- /dev/null
+++ b/src/adw-easing.c
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2021 Manuel Genovés <manuel genoves gmail com>
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#include "config.h"
+
+#include "adw-easing.h"
+
+/**
+ * AdwEasing:
+ * @ADW_EASING_EASE_IN_CUBIC: Starts slowly and accelerates, cubic curve.
+ * @ADW_EASING_EASE_OUT_CUBIC: Starts quickly and decelerates, cubic curve.
+ *   This is an inverse of `ADW_EASING_EASE_IN_CUBIC`.
+ * @ADW_EASING_EASE_IN_OUT_CUBIC: Starts slowly, accelerates, decelerates and
+ *   ends slowly again, combines `ADW_EASING_EASE_IN_CUBIC` and
+ *   `ADW_EASING_EASE_OUT_CUBIC`.
+ *
+ * Describes the available easing functions for use with
+ * [class@Adw.TimedAnimation].
+ *
+ * New values may be added to this enumeration over time.
+ *
+ * Since: 1.0
+ */
diff --git a/src/adw-easing.h b/src/adw-easing.h
new file mode 100644
index 00000000..5dc640b5
--- /dev/null
+++ b/src/adw-easing.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2021 Manuel Genovés <manuel genoves gmail com>
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#pragma once
+
+#if !defined(_ADWAITA_INSIDE) && !defined(ADWAITA_COMPILATION)
+#error "Only <adwaita.h> can be included directly."
+#endif
+
+#include "adw-version.h"
+
+#include <glib.h>
+
+#include "adw-enums.h"
+
+G_BEGIN_DECLS
+
+typedef enum {
+  ADW_EASING_EASE_IN_CUBIC,
+  ADW_EASING_EASE_OUT_CUBIC,
+  ADW_EASING_EASE_IN_OUT_CUBIC,
+} AdwEasing;
+
+G_END_DECLS
diff --git a/src/adw-timed-animation.c b/src/adw-timed-animation.c
index 2ff752eb..b40fc6f7 100644
--- a/src/adw-timed-animation.c
+++ b/src/adw-timed-animation.c
@@ -36,23 +36,6 @@
  * Since: 1.0
  */
 
-/**
- * AdwEasing:
- * @ADW_EASING_EASE_IN_CUBIC: Starts slowly and accelerates, cubic curve.
- * @ADW_EASING_EASE_OUT_CUBIC: Starts quickly and decelerates, cubic curve.
- *   This is an inverse of `ADW_EASING_EASE_IN_CUBIC`.
- * @ADW_EASING_EASE_IN_OUT_CUBIC: Starts slowly, accelerates, decelerates and
- *   ends slowly again, combines `ADW_EASING_EASE_IN_CUBIC` and
- *   `ADW_EASING_EASE_OUT_CUBIC`.
- *
- * Describes the available easing functions for use with
- * [class@Adw.TimedAnimation].
- *
- * New values may be added to this enumeration over time.
- *
- * Since: 1.0
- */
-
 struct _AdwTimedAnimation
 {
   AdwAnimation parent_instance;
diff --git a/src/adw-timed-animation.h b/src/adw-timed-animation.h
index 9f8b35dd..83715e04 100644
--- a/src/adw-timed-animation.h
+++ b/src/adw-timed-animation.h
@@ -15,7 +15,7 @@
 #include <gtk/gtk.h>
 
 #include "adw-animation.h"
-#include "adw-enums.h"
+#include "adw-easing.h"
 
 G_BEGIN_DECLS
 
@@ -24,12 +24,6 @@ G_BEGIN_DECLS
 ADW_AVAILABLE_IN_ALL
 GDK_DECLARE_INTERNAL_TYPE (AdwTimedAnimation, adw_timed_animation, ADW, TIMED_ANIMATION, AdwAnimation)
 
-typedef enum {
-  ADW_EASING_EASE_IN_CUBIC,
-  ADW_EASING_EASE_OUT_CUBIC,
-  ADW_EASING_EASE_IN_OUT_CUBIC,
-} AdwEasing;
-
 ADW_AVAILABLE_IN_ALL
 AdwAnimation *adw_timed_animation_new (GtkWidget          *widget,
                                        double              from,
diff --git a/src/adwaita.h b/src/adwaita.h
index 6b366528..62e2e154 100644
--- a/src/adwaita.h
+++ b/src/adwaita.h
@@ -38,6 +38,7 @@ G_BEGIN_DECLS
 #include "adw-clamp-scrollable.h"
 #include "adw-combo-row.h"
 #include "adw-deprecation-macros.h"
+#include "adw-easing.h"
 #include "adw-enum-list-model.h"
 #include "adw-expander-row.h"
 #include "adw-flap.h"
diff --git a/src/meson.build b/src/meson.build
index 88563433..041e4df5 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -13,12 +13,12 @@ adw_public_enum_headers = [
   'adw-animation.h',
   'adw-flap.h',
   'adw-fold-threshold-policy.h',
+  'adw-easing.h',
   'adw-header-bar.h',
   'adw-leaflet.h',
   'adw-navigation-direction.h',
   'adw-style-manager.h',
   'adw-squeezer.h',
-  'adw-timed-animation.h',
   'adw-toast.h',
   'adw-view-switcher.h',
 ]
@@ -97,6 +97,7 @@ src_headers = [
   'adw-clamp-scrollable.h',
   'adw-combo-row.h',
   'adw-deprecation-macros.h',
+  'adw-easing.h',
   'adw-enum-list-model.h',
   'adw-expander-row.h',
   'adw-flap.h',
@@ -157,6 +158,7 @@ src_sources = [
   'adw-clamp-layout.c',
   'adw-clamp-scrollable.c',
   'adw-combo-row.c',
+  'adw-easing.c',
   'adw-enum-list-model.c',
   'adw-expander-row.c',
   'adw-fading-label.c',


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]