[gnome-builder] workspace: avoid unnecessary animations if we are not yet realized



commit 13c3a04b2d85e1be5464a8e9f075691966224ca2
Author: Christian Hergert <christian hergert me>
Date:   Thu Jun 11 14:01:40 2015 -0700

    workspace: avoid unnecessary animations if we are not yet realized

 src/workspace/gb-workspace.c |   27 ++++++++++++++++++---------
 1 files changed, 18 insertions(+), 9 deletions(-)
---
diff --git a/src/workspace/gb-workspace.c b/src/workspace/gb-workspace.c
index f43092b..1d6c1a2 100644
--- a/src/workspace/gb-workspace.c
+++ b/src/workspace/gb-workspace.c
@@ -509,15 +509,24 @@ gb_workspace_child_set_reveal (GbWorkspace *self,
 
   frame_clock = gtk_widget_get_frame_clock (child);
 
-  item->animation = ide_object_animate_full (item->adjustment,
-                                             ANIMATION_MODE,
-                                             ANIMATION_DURATION,
-                                             frame_clock,
-                                             gb_workspace_animation_cb,
-                                             g_object_ref (child),
-                                             "value", reveal ? 0.0 : 1.0,
-                                             NULL);
-  g_object_add_weak_pointer (G_OBJECT (item->animation), (gpointer *)&item->animation);
+  if (gtk_widget_get_realized (GTK_WIDGET (self)))
+    {
+      item->animation = ide_object_animate_full (item->adjustment,
+                                                 ANIMATION_MODE,
+                                                 ANIMATION_DURATION,
+                                                 frame_clock,
+                                                 gb_workspace_animation_cb,
+                                                 g_object_ref (child),
+                                                 "value", reveal ? 0.0 : 1.0,
+                                                 NULL);
+      g_object_add_weak_pointer (G_OBJECT (item->animation), (gpointer *)&item->animation);
+    }
+  else
+    {
+      item->reveal = reveal;
+      gtk_adjustment_set_value (item->adjustment, reveal ? 0.0 : 1.0);
+      gtk_container_child_notify (GTK_CONTAINER (self), item->widget, "reveal");
+    }
 
   gtk_widget_queue_resize (GTK_WIDGET (self));
 }


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