[libdazzle] animation: add convenience API for stopping animation



commit 76ed337440a3de7fba89e9084485cff06c61534a
Author: Christian Hergert <chergert redhat com>
Date:   Tue Jul 4 16:23:21 2017 -0700

    animation: add convenience API for stopping animation
    
    This can be useful to keep calling code a bit cleaner.

 src/animation/dzl-animation.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/src/animation/dzl-animation.c b/src/animation/dzl-animation.c
index b848dec..7e74bf0 100644
--- a/src/animation/dzl-animation.c
+++ b/src/animation/dzl-animation.c
@@ -662,17 +662,19 @@ dzl_animation_notify (DzlAnimation *self)
 
 /**
  * dzl_animation_stop:
- * @animation: (in): A #DzlAnimation.
+ * @animation: (nullable): A #DzlAnimation.
  *
  * Stops a running animation. The internal reference to the animation is
  * dropped and therefore may cause the object to finalize.
  *
- * Side effects: None.
+ * As a convenience, this function accepts %NULL for @animation but
+ * does nothing if that should occur.
  */
 void
 dzl_animation_stop (DzlAnimation *animation)
 {
-  g_return_if_fail (DZL_IS_ANIMATION (animation));
+  if (animation == NULL)
+    return;
 
   if (animation->tween_handler)
     {


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