[gnome-control-center] shell: Make it possible to not animate transitions



commit 56bd29ebf3f49b8e53d37817ba6ca99b82fb7e66
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Jun 11 14:26:20 2012 +0100

    shell: Make it possible to not animate transitions
    
    In CcNotebook.

 shell/cc-notebook.c |   20 +++++++++++++-------
 shell/cc-notebook.h |    3 ++-
 2 files changed, 15 insertions(+), 8 deletions(-)
---
diff --git a/shell/cc-notebook.c b/shell/cc-notebook.c
index d1bf7c1..bc75c64 100644
--- a/shell/cc-notebook.c
+++ b/shell/cc-notebook.c
@@ -98,7 +98,7 @@ cc_notebook_set_property (GObject      *gobject,
 
         switch (prop_id) {
         case PROP_CURRENT_PAGE:
-                cc_notebook_select_page (self, g_value_get_pointer (value));
+                cc_notebook_select_page (self, g_value_get_pointer (value), TRUE);
                 break;
 
         default:
@@ -368,7 +368,8 @@ cc_notebook_new (void)
 static void
 _cc_notebook_select_page (CcNotebook *self,
 			  GtkWidget  *widget,
-			  int         index)
+			  int         index,
+			  gboolean    animate)
 {
         ClutterPoint pos;
 
@@ -384,9 +385,13 @@ _cc_notebook_select_page (CcNotebook *self,
         }
 
         clutter_actor_save_easing_state (self->priv->scroll);
-        clutter_actor_set_easing_duration (self->priv->scroll, 500);
+        if (animate)
+		clutter_actor_set_easing_duration (self->priv->scroll, 500);
+	else
+		clutter_actor_set_easing_duration (self->priv->scroll, 0);
 
-        g_debug ("Scrolling to (%lf,%lf) in page selection", pos.x, pos.y);
+        g_debug ("Scrolling to (%lf,%lf) %s animation in page selection", pos.x, pos.y,
+		 animate ? "with" : "without");
         clutter_scroll_actor_scroll_to_point (CLUTTER_SCROLL_ACTOR (self->priv->scroll), &pos);
 
 	clutter_actor_restore_easing_state (self->priv->scroll);
@@ -399,7 +404,8 @@ _cc_notebook_select_page (CcNotebook *self,
 
 void
 cc_notebook_select_page (CcNotebook *self,
-                         GtkWidget  *widget)
+                         GtkWidget  *widget,
+                         gboolean    animate)
 {
 	int i, n_children;
 	GList *children, *l;
@@ -416,7 +422,7 @@ cc_notebook_select_page (CcNotebook *self,
         children = clutter_actor_get_children (self->priv->bin);
         for (i = 0, l = children; i < n_children; i++, l = l->next) {
 		if (frame == l->data) {
-			_cc_notebook_select_page (self, widget, i);
+			_cc_notebook_select_page (self, widget, i, animate);
 			found = TRUE;
 			break;
 		}
@@ -452,7 +458,7 @@ cc_notebook_add_page (CcNotebook *self,
         self->priv->pages = g_list_prepend (self->priv->pages, widget);
 
         if (self->priv->selected_page == NULL)
-		_cc_notebook_select_page (self, widget, res);
+		_cc_notebook_select_page (self, widget, res, FALSE);
 
         gtk_widget_queue_resize (GTK_WIDGET (self));
 }
diff --git a/shell/cc-notebook.h b/shell/cc-notebook.h
index 508d54a..19dbbf1 100644
--- a/shell/cc-notebook.h
+++ b/shell/cc-notebook.h
@@ -60,7 +60,8 @@ void            cc_notebook_remove_page                 (CcNotebook *self,
                                                          GtkWidget  *widget);
 
 void            cc_notebook_select_page                 (CcNotebook *self,
-                                                         GtkWidget  *widget);
+                                                         GtkWidget  *widget,
+                                                         gboolean    animate);
 
 GtkWidget *     cc_notebook_get_selected_page           (CcNotebook *self);
 



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