[gnome-builder] workbench: remove early perspectives after project transition



commit 8579e658c762eaf20c9f31803cd52de2871d1915
Author: Christian Hergert <chergert redhat com>
Date:   Wed Apr 27 21:03:05 2016 -0700

    workbench: remove early perspectives after project transition
    
    After we have switched to a project, we can drop these old perspectives
    as they'll never be displayed again.

 libide/ide-workbench.c |   24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)
---
diff --git a/libide/ide-workbench.c b/libide/ide-workbench.c
index f133d7f..ed3a569 100644
--- a/libide/ide-workbench.c
+++ b/libide/ide-workbench.c
@@ -727,6 +727,23 @@ ide_workbench_get_visible_perspective (IdeWorkbench *self)
   return IDE_PERSPECTIVE (gtk_stack_get_visible_child (self->perspectives_stack));
 }
 
+static gboolean
+remove_early_perspectives (gpointer data)
+{
+  g_autoptr(IdeWorkbench) self = data;
+  GtkWidget *widget;
+
+  g_assert (IDE_IS_WORKBENCH (self));
+
+  widget = gtk_stack_get_child_by_name (self->top_stack, "greeter");
+  gtk_widget_destroy (widget);
+
+  widget = gtk_stack_get_child_by_name (self->top_stack, "genesis");
+  gtk_widget_destroy (widget);
+
+  return G_SOURCE_REMOVE;
+}
+
 void
 ide_workbench_set_visible_perspective (IdeWorkbench   *self,
                                        IdePerspective *perspective)
@@ -755,7 +772,12 @@ ide_workbench_set_visible_perspective (IdeWorkbench   *self,
 
   if ((stack == self->perspectives_stack) &&
       !ide_str_equal0 (gtk_stack_get_visible_child_name (self->top_stack), "perspectives"))
-    gtk_stack_set_visible_child_name (self->top_stack, "perspectives");
+    {
+      gtk_stack_set_visible_child_name (self->top_stack, "perspectives");
+      g_timeout_add (1000 + gtk_stack_get_transition_duration (self->top_stack),
+                     remove_early_perspectives,
+                     g_object_ref (self));
+    }
 }
 
 const gchar *


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