[gnome-builder] workbench: cleanup delay calculation



commit e2ac0953250ff505f6d59f08727e357efa45f300
Author: Christian Hergert <chergert redhat com>
Date:   Thu Jun 30 15:37:39 2016 -0700

    workbench: cleanup delay calculation
    
    Adds some debug macros for time tracking, and cleans up our delay tracking
    a bit. We can also avoid extra delay when not showing the greeter.

 libide/workbench/ide-workbench.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/libide/workbench/ide-workbench.c b/libide/workbench/ide-workbench.c
index f35c008..51f90c4 100644
--- a/libide/workbench/ide-workbench.c
+++ b/libide/workbench/ide-workbench.c
@@ -568,7 +568,9 @@ ide_workbench_set_context (IdeWorkbench *self,
 {
   g_autoptr(GSettings) settings = NULL;
   IdeProject *project;
-  guint delay_msec = STABLIZE_DELAY_MSEC;
+  guint delay_msec;
+
+  IDE_ENTRY;
 
   g_return_if_fail (IDE_IS_WORKBENCH (self));
   g_return_if_fail (IDE_IS_CONTEXT (context));
@@ -607,8 +609,7 @@ ide_workbench_set_context (IdeWorkbench *self,
    * just a bit of time to stablize allocations and sizing before
    * transitioning to the editor.
    */
-  if (self->disable_greeter)
-    delay_msec = 0;
+  delay_msec = self->disable_greeter ? 0 : STABLIZE_DELAY_MSEC;
   g_timeout_add (delay_msec, stablize_cb, g_object_ref (self));
 
   /*
@@ -619,11 +620,14 @@ ide_workbench_set_context (IdeWorkbench *self,
    */
   if (g_settings_get_boolean (settings, "restore-previous-files"))
     {
-      guint duration;
+      guint duration = 0;
 
-      duration = gtk_stack_get_transition_duration (self->perspectives_stack);
+      if (!self->disable_greeter)
+        duration = gtk_stack_get_transition_duration (self->perspectives_stack);
       g_timeout_add (delay_msec + duration, restore_in_timeout, g_object_ref (context));
     }
+
+  IDE_EXIT;
 }
 
 void


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