[mutter/wip/nielsdg/use-g-declare-interface: 4/4] clutter: Animatable: Use G_DECLARE_INTERFACE()



commit 19c1ea740d2a05bad1d5054738399a0cec6748a3
Author: Niels De Graef <niels degraef barco com>
Date:   Thu Jan 10 16:42:08 2019 +0100

    clutter: Animatable: Use G_DECLARE_INTERFACE()
    
    It cuts away a bit of the GObject boilerplate, gives us support for
    `g_autoptr`, and removes the typedef hack inside clutter-scroll-actor.c.
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/380

 clutter/clutter/clutter-actor.c        |  4 ++--
 clutter/clutter/clutter-animatable.c   | 13 ++++++-------
 clutter/clutter/clutter-animatable.h   | 26 +++++++-------------------
 clutter/clutter/clutter-autocleanups.h |  1 -
 clutter/clutter/clutter-scroll-actor.c |  6 +++---
 clutter/clutter/clutter-text.c         |  6 +++---
 6 files changed, 21 insertions(+), 35 deletions(-)
---
diff --git a/clutter/clutter/clutter-actor.c b/clutter/clutter/clutter-actor.c
index 4701daab7..342137754 100644
--- a/clutter/clutter/clutter-actor.c
+++ b/clutter/clutter/clutter-actor.c
@@ -1022,7 +1022,7 @@ typedef struct _TransitionClosure
 
 static void clutter_container_iface_init  (ClutterContainerIface  *iface);
 static void clutter_scriptable_iface_init (ClutterScriptableIface *iface);
-static void clutter_animatable_iface_init (ClutterAnimatableIface *iface);
+static void clutter_animatable_iface_init (ClutterAnimatableInterface *iface);
 static void atk_implementor_iface_init    (AtkImplementorIface    *iface);
 
 /* These setters are all static for now, maybe they should be in the
@@ -15159,7 +15159,7 @@ clutter_actor_set_final_state (ClutterAnimatable *animatable,
 }
 
 static void
-clutter_animatable_iface_init (ClutterAnimatableIface *iface)
+clutter_animatable_iface_init (ClutterAnimatableInterface *iface)
 {
   iface->find_property = clutter_actor_find_property;
   iface->get_initial_state = clutter_actor_get_initial_state;
diff --git a/clutter/clutter/clutter-animatable.c b/clutter/clutter/clutter-animatable.c
index 175f57dbd..0bb3409ca 100644
--- a/clutter/clutter/clutter-animatable.c
+++ b/clutter/clutter/clutter-animatable.c
@@ -30,7 +30,7 @@
  * to control how a #ClutterAnimation will animate a property.
  *
  * Each #ClutterAnimatable should implement the
- * #ClutterAnimatableIface.interpolate_property() virtual function of the
+ * #ClutterAnimatableInterface.interpolate_property() virtual function of the
  * interface to compute the animation state between two values of an interval
  * depending on a progress factor, expressed as a floating point value.
  *
@@ -57,7 +57,6 @@
 #include "deprecated/clutter-animatable.h"
 #include "deprecated/clutter-animation.h"
 
-typedef ClutterAnimatableIface  ClutterAnimatableInterface;
 G_DEFINE_INTERFACE (ClutterAnimatable, clutter_animatable, G_TYPE_OBJECT);
 
 static void
@@ -101,7 +100,7 @@ clutter_animatable_animate_property (ClutterAnimatable *animatable,
                                      gdouble            progress,
                                      GValue            *value)
 {
-  ClutterAnimatableIface *iface;
+  ClutterAnimatableInterface *iface;
   gboolean res;
 
   g_return_val_if_fail (CLUTTER_IS_ANIMATABLE (animatable), FALSE);
@@ -155,7 +154,7 @@ GParamSpec *
 clutter_animatable_find_property (ClutterAnimatable *animatable,
                                   const gchar       *property_name)
 {
-  ClutterAnimatableIface *iface;
+  ClutterAnimatableInterface *iface;
 
   g_return_val_if_fail (CLUTTER_IS_ANIMATABLE (animatable), NULL);
   g_return_val_if_fail (property_name != NULL, NULL);
@@ -185,7 +184,7 @@ clutter_animatable_get_initial_state (ClutterAnimatable *animatable,
                                       const gchar       *property_name,
                                       GValue            *value)
 {
-  ClutterAnimatableIface *iface;
+  ClutterAnimatableInterface *iface;
 
   g_return_if_fail (CLUTTER_IS_ANIMATABLE (animatable));
   g_return_if_fail (property_name != NULL);
@@ -214,7 +213,7 @@ clutter_animatable_set_final_state (ClutterAnimatable *animatable,
                                     const gchar       *property_name,
                                     const GValue      *value)
 {
-  ClutterAnimatableIface *iface;
+  ClutterAnimatableInterface *iface;
 
   g_return_if_fail (CLUTTER_IS_ANIMATABLE (animatable));
   g_return_if_fail (property_name != NULL);
@@ -260,7 +259,7 @@ clutter_animatable_interpolate_value (ClutterAnimatable *animatable,
                                       gdouble            progress,
                                       GValue            *value)
 {
-  ClutterAnimatableIface *iface;
+  ClutterAnimatableInterface *iface;
 
   g_return_val_if_fail (CLUTTER_IS_ANIMATABLE (animatable), FALSE);
   g_return_val_if_fail (property_name != NULL, FALSE);
diff --git a/clutter/clutter/clutter-animatable.h b/clutter/clutter/clutter-animatable.h
index 951fdd7ac..0b194514a 100644
--- a/clutter/clutter/clutter-animatable.h
+++ b/clutter/clutter/clutter-animatable.h
@@ -33,24 +33,15 @@
 
 G_BEGIN_DECLS
 
-#define CLUTTER_TYPE_ANIMATABLE                 (clutter_animatable_get_type ())
-#define CLUTTER_ANIMATABLE(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_ANIMATABLE, 
ClutterAnimatable))
-#define CLUTTER_IS_ANIMATABLE(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_ANIMATABLE))
-#define CLUTTER_ANIMATABLE_GET_IFACE(obj)       (G_TYPE_INSTANCE_GET_INTERFACE ((obj), 
CLUTTER_TYPE_ANIMATABLE, ClutterAnimatableIface))
+#define CLUTTER_TYPE_ANIMATABLE (clutter_animatable_get_type ())
 
-typedef struct _ClutterAnimatableIface          ClutterAnimatableIface;
-
-/**
- * ClutterAnimatable:
- *
- * #ClutterAnimatable is an opaque structure whose members cannot be directly
- * accessed
- *
- * Since: 1.0
- */
+CLUTTER_EXPORT
+G_DECLARE_INTERFACE (ClutterAnimatable, clutter_animatable,
+                     CLUTTER, ANIMATABLE,
+                     GObject)
 
 /**
- * ClutterAnimatableIface:
+ * ClutterAnimatableInterface:
  * @animate_property: virtual function for custom interpolation of a
  *   property. This virtual function is deprecated
  * @find_property: virtual function for retrieving the #GParamSpec of
@@ -67,7 +58,7 @@ typedef struct _ClutterAnimatableIface          ClutterAnimatableIface;
  *
  * Since: 1.0
  */
-struct _ClutterAnimatableIface
+struct _ClutterAnimatableInterface
 {
   /*< private >*/
   GTypeInterface parent_iface;
@@ -95,9 +86,6 @@ struct _ClutterAnimatableIface
                                      GValue            *value);
 };
 
-CLUTTER_EXPORT
-GType clutter_animatable_get_type (void) G_GNUC_CONST;
-
 CLUTTER_EXPORT
 GParamSpec *clutter_animatable_find_property     (ClutterAnimatable *animatable,
                                                   const gchar       *property_name);
diff --git a/clutter/clutter/clutter-autocleanups.h b/clutter/clutter/clutter-autocleanups.h
index 86aa399df..dfb371541 100644
--- a/clutter/clutter/clutter-autocleanups.h
+++ b/clutter/clutter/clutter-autocleanups.h
@@ -34,7 +34,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterAction, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterActor, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterActorMeta, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterAlignConstraint, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterAnimatable, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBackend, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBindConstraint, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBindingPool, g_object_unref)
diff --git a/clutter/clutter/clutter-scroll-actor.c b/clutter/clutter/clutter-scroll-actor.c
index 8d76a0f4c..a6cf6d54e 100644
--- a/clutter/clutter/clutter-scroll-actor.c
+++ b/clutter/clutter/clutter-scroll-actor.c
@@ -84,9 +84,9 @@ enum
 static GParamSpec *obj_props[PROP_LAST] = { NULL, };
 static GParamSpec *animatable_props[ANIM_PROP_LAST] = { NULL, };
 
-static ClutterAnimatableIface *parent_animatable_iface = NULL;
+static ClutterAnimatableInterface *parent_animatable_iface = NULL;
 
-static void     clutter_animatable_iface_init   (ClutterAnimatableIface *iface);
+static void clutter_animatable_iface_init (ClutterAnimatableInterface *iface);
 
 G_DEFINE_TYPE_WITH_CODE (ClutterScrollActor, clutter_scroll_actor, CLUTTER_TYPE_ACTOR,
                          G_ADD_PRIVATE (ClutterScrollActor)
@@ -240,7 +240,7 @@ clutter_scroll_actor_get_initial_state (ClutterAnimatable *animatable,
 }
 
 static void
-clutter_animatable_iface_init (ClutterAnimatableIface *iface)
+clutter_animatable_iface_init (ClutterAnimatableInterface *iface)
 {
   parent_animatable_iface = g_type_interface_peek_parent (iface);
 
diff --git a/clutter/clutter/clutter-text.c b/clutter/clutter/clutter-text.c
index 2c7c10203..3f2423703 100644
--- a/clutter/clutter/clutter-text.c
+++ b/clutter/clutter/clutter-text.c
@@ -279,7 +279,7 @@ static const ClutterColor default_selected_text_color = {   0,   0,   0, 255 };
 
 static CoglPipeline *default_color_pipeline = NULL;
 
-static ClutterAnimatableIface *parent_animatable_iface = NULL;
+static ClutterAnimatableInterface *parent_animatable_iface = NULL;
 static ClutterScriptableIface *parent_scriptable_iface = NULL;
 
 /* ClutterTextInputFocus */
@@ -389,7 +389,7 @@ clutter_text_input_focus_new (ClutterText *text)
 
 /* ClutterText */
 static void clutter_scriptable_iface_init (ClutterScriptableIface *iface);
-static void clutter_animatable_iface_init (ClutterAnimatableIface *iface);
+static void clutter_animatable_iface_init (ClutterAnimatableInterface *iface);
 
 G_DEFINE_TYPE_WITH_CODE (ClutterText,
                          clutter_text,
@@ -3547,7 +3547,7 @@ clutter_text_set_final_state (ClutterAnimatable *animatable,
 }
 
 static void
-clutter_animatable_iface_init (ClutterAnimatableIface *iface)
+clutter_animatable_iface_init (ClutterAnimatableInterface *iface)
 {
   parent_animatable_iface = g_type_interface_peek_parent (iface);
 


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