[gnome-builder] workbench: avoid transition duration when :disable-greeter
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] workbench: avoid transition duration when :disable-greeter
- Date: Thu, 30 Jun 2016 21:22:27 +0000 (UTC)
commit ce9485a1090c462405dffc61ac1860d22dd49cc3
Author: Christian Hergert <chergert redhat com>
Date: Thu Jun 30 14:21:04 2016 -0700
workbench: avoid transition duration when :disable-greeter
If we are opening a new workbench and simply want to jump strait to the
editor, we can avoid the transition duration (which will take us from
preferences, the only other "early perspective", to the editor). This
allows the workbench to be displayed with the proper view immediately.
libide/workbench/ide-workbench-private.h | 1 +
libide/workbench/ide-workbench.c | 19 +++++++++++++++++++
2 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/libide/workbench/ide-workbench-private.h b/libide/workbench/ide-workbench-private.h
index 9b90615..4f738e6 100644
--- a/libide/workbench/ide-workbench-private.h
+++ b/libide/workbench/ide-workbench-private.h
@@ -35,6 +35,7 @@ struct _IdeWorkbench
guint unloading : 1;
guint disable_greeter : 1;
guint early_perspectives_removed : 1;
+ guint did_initial_editor_transition : 1;
IdeContext *context;
GCancellable *cancellable;
diff --git a/libide/workbench/ide-workbench.c b/libide/workbench/ide-workbench.c
index 63fe929..f35c008 100644
--- a/libide/workbench/ide-workbench.c
+++ b/libide/workbench/ide-workbench.c
@@ -807,10 +807,26 @@ ide_workbench_set_visible_perspective (IdeWorkbench *self,
GActionGroup *actions = NULL;
const gchar *current_id;
GtkWidget *titlebar;
+ guint restore_duration = 0;
g_return_if_fail (IDE_IS_WORKBENCH (self));
g_return_if_fail (IDE_IS_PERSPECTIVE (perspective));
+ /*
+ * If we can detect that this is the first transition to the editor,
+ * and that our window is not yet displayed, we can avoid the transition
+ * duration altogether. This is handy when first opening a window with
+ * a project loaded, as used by self->disable_greeter.
+ */
+ if (self->disable_greeter &&
+ IDE_IS_EDITOR_PERSPECTIVE (perspective) &&
+ !self->did_initial_editor_transition)
+ {
+ self->did_initial_editor_transition = TRUE;
+ restore_duration = gtk_stack_get_transition_duration (self->perspectives_stack);
+ gtk_stack_set_transition_duration (self->perspectives_stack, 0);
+ }
+
current_id = gtk_stack_get_visible_child_name (self->perspectives_stack);
id = ide_perspective_get_id (perspective);
@@ -843,6 +859,9 @@ ide_workbench_set_visible_perspective (IdeWorkbench *self,
perspective);
g_clear_object (&actions);
+
+ if (restore_duration != 0)
+ gtk_stack_set_transition_duration (self->perspectives_stack, restore_duration);
}
const gchar *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]