[gnome-builder/wip/chergert/headerbar] workbench: remove early perspectives
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/chergert/headerbar] workbench: remove early perspectives
- Date: Mon, 27 Jun 2016 06:02:33 +0000 (UTC)
commit 1302c014ca25edec3743f2e48b5d2a09a0cdd2ed
Author: Christian Hergert <chergert redhat com>
Date: Sun Jun 26 23:02:24 2016 -0700
workbench: remove early perspectives
After we transition to the editor, we can remove early perspectives which
saves us a bunch of widgets and style calculation overhead.
libide/workbench/ide-workbench-private.h | 1 +
libide/workbench/ide-workbench.c | 32 +++++++++++++++++++++++++++++-
2 files changed, 32 insertions(+), 1 deletions(-)
---
diff --git a/libide/workbench/ide-workbench-private.h b/libide/workbench/ide-workbench-private.h
index e18d962..40f0dd7 100644
--- a/libide/workbench/ide-workbench-private.h
+++ b/libide/workbench/ide-workbench-private.h
@@ -33,6 +33,7 @@ struct _IdeWorkbench
GtkApplicationWindow parent;
guint unloading : 1;
+ guint early_perspectives_removed : 1;
IdeContext *context;
GCancellable *cancellable;
diff --git a/libide/workbench/ide-workbench.c b/libide/workbench/ide-workbench.c
index 43bedc8..edaeddb 100644
--- a/libide/workbench/ide-workbench.c
+++ b/libide/workbench/ide-workbench.c
@@ -22,6 +22,7 @@
#include "ide-debug.h"
+#include "editor/ide-editor-perspective.h"
#include "genesis/ide-genesis-perspective.h"
#include "greeter/ide-greeter-perspective.h"
#include "ide-macros.h"
@@ -752,6 +753,30 @@ ide_workbench_notify_perspective_set (PeasExtensionSet *set,
ide_workbench_addin_perspective_set (addin, perspective);
}
+static void
+do_remove_early_perspectives (GtkWidget *widget,
+ gpointer user_data)
+{
+ if (IDE_IS_GREETER_PERSPECTIVE (widget) ||
+ IDE_IS_GENESIS_PERSPECTIVE (widget))
+ gtk_widget_destroy (widget);
+}
+
+static void
+remove_early_perspectives (IdeWorkbench *self)
+{
+ g_assert (IDE_IS_WORKBENCH (self));
+
+ if (self->early_perspectives_removed)
+ return;
+
+ gtk_container_foreach (GTK_CONTAINER (self->perspectives_stack),
+ do_remove_early_perspectives,
+ NULL);
+
+ self->early_perspectives_removed = TRUE;
+}
+
void
ide_workbench_set_visible_perspective (IdeWorkbench *self,
IdePerspective *perspective)
@@ -780,7 +805,12 @@ ide_workbench_set_visible_perspective (IdeWorkbench *self,
actions = ide_perspective_get_actions (perspective);
gtk_widget_insert_action_group (GTK_WIDGET (self), "perspective", actions);
- /* TODO: Possibly remove some perspectives */
+ /*
+ * If we are transitioning to the editor the first time, we can
+ * remove the early perspectives (greeter, genesis, etc).
+ */
+ if (IDE_IS_EDITOR_PERSPECTIVE (perspective))
+ remove_early_perspectives (self);
gtk_widget_set_visible (GTK_WIDGET (self->perspective_menu_button),
!ide_perspective_is_early (perspective));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]