[baobab/animated-notebook: 3/4] cc-notebook: Remove transition on complete



commit bd4a6fcdc74bfb6f15b1da992e5b6b7510dc19ca
Author: Stefano Facchini <stefano facchini gmail com>
Date:   Sun Oct 21 16:31:38 2012 +0200

    cc-notebook: Remove transition on complete

 src/cc-notebook.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/src/cc-notebook.c b/src/cc-notebook.c
index 0cfbaf2..e16418b 100644
--- a/src/cc-notebook.c
+++ b/src/cc-notebook.c
@@ -377,12 +377,21 @@ cc_notebook_new (void)
 }
 
 static void
+remove_transition_on_complete (ClutterTransition *transition,
+                               gpointer           user_data)
+{
+        ClutterActor *actor = CLUTTER_ACTOR (user_data);
+        clutter_actor_remove_transition (actor, "scroll-to");
+}
+
+static void
 _cc_notebook_select_page (CcNotebook *self,
 			  GtkWidget  *widget,
 			  int         index,
 			  gboolean    animate)
 {
         ClutterPoint pos;
+        ClutterTransition *transition;
 
         g_return_if_fail (CC_IS_NOTEBOOK (self));
         g_return_if_fail (GTK_IS_WIDGET (widget));
@@ -405,6 +414,12 @@ _cc_notebook_select_page (CcNotebook *self,
 		 animate ? "with" : "without");
         clutter_scroll_actor_scroll_to_point (CLUTTER_SCROLL_ACTOR (self->priv->scroll), &pos);
 
+        transition = clutter_actor_get_transition (self->priv->scroll, "scroll-to");
+        if (transition != NULL) {
+                g_signal_connect (transition, "completed",
+                                  G_CALLBACK (remove_transition_on_complete), self->priv->scroll);
+        }
+
 	clutter_actor_restore_easing_state (self->priv->scroll);
 
         /* Remember the last selected page */



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