[gnome-builder/gnome-builder-3-20] prefs: add toggle to disable restoring previously opened files
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/gnome-builder-3-20] prefs: add toggle to disable restoring previously opened files
- Date: Thu, 5 May 2016 07:32:38 +0000 (UTC)
commit b3d894fed81e9d28dce06bc947cbc5fd67e75d04
Author: Christian Hergert <chergert redhat com>
Date: Thu May 5 10:31:52 2016 +0300
prefs: add toggle to disable restoring previously opened files
Some users have requested that we have a way to disable the feature of
loading previously opened files.
This can also be useful if for some reason we are crashing when loading
files and at least gives us an escape hatch for users.
data/gsettings/org.gnome.builder.gschema.xml.in | 5 +++++
libide/ide-workbench.c | 10 ++++++++--
libide/preferences/ide-preferences-builtin.c | 3 ++-
3 files changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/data/gsettings/org.gnome.builder.gschema.xml.in b/data/gsettings/org.gnome.builder.gschema.xml.in
index 95f1f25..75c0a13 100644
--- a/data/gsettings/org.gnome.builder.gschema.xml.in
+++ b/data/gsettings/org.gnome.builder.gschema.xml.in
@@ -30,5 +30,10 @@
<summary>Projects directory</summary>
<description>Directory for all builder projects</description>
</key>
+ <key name="restore-previous-files" type="b">
+ <default>true</default>
+ <summary>Restore Previous Files</summary>
+ <description>Restore previously opened files when loading a project.</description>
+ </key>
</schema>
</schemalist>
diff --git a/libide/ide-workbench.c b/libide/ide-workbench.c
index ed3a569..bad9891 100644
--- a/libide/ide-workbench.c
+++ b/libide/ide-workbench.c
@@ -568,6 +568,7 @@ void
ide_workbench_set_context (IdeWorkbench *self,
IdeContext *context)
{
+ g_autoptr(GSettings) settings = NULL;
IdeProject *project;
guint duration;
@@ -575,6 +576,8 @@ ide_workbench_set_context (IdeWorkbench *self,
g_return_if_fail (IDE_IS_CONTEXT (context));
g_return_if_fail (self->context == NULL);
+ settings = g_settings_new ("org.gnome.builder");
+
g_set_object (&self->context, context);
project = ide_context_get_project (context);
@@ -612,8 +615,11 @@ ide_workbench_set_context (IdeWorkbench *self,
* the stack transition results in non-smooth transitions. So instead,
* we will delay until the transition has completed.
*/
- duration = gtk_stack_get_transition_duration (self->top_stack);
- g_timeout_add (STABLIZE_DELAY_MSEC + duration, restore_in_timeout, g_object_ref (context));
+ if (g_settings_get_boolean (settings, "restore-previous-files"))
+ {
+ duration = gtk_stack_get_transition_duration (self->top_stack);
+ g_timeout_add (STABLIZE_DELAY_MSEC + duration, restore_in_timeout, g_object_ref (context));
+ }
}
void
diff --git a/libide/preferences/ide-preferences-builtin.c b/libide/preferences/ide-preferences-builtin.c
index a64a3ad..e5be35d 100644
--- a/libide/preferences/ide-preferences-builtin.c
+++ b/libide/preferences/ide-preferences-builtin.c
@@ -252,7 +252,8 @@ ide_preferences_builtin_register_projects (IdePreferences *preferences)
ide_preferences_add_page (preferences, "projects", _("Projects"), 450);
ide_preferences_add_list_group (preferences, "projects", "directory", _("Workspace"), 0);
- ide_preferences_add_file_chooser (preferences, "projects", "directory", "org.gnome.builder",
"projects-directory", NULL, _("Projects Directory"), _("A place for all your projects"),
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, NULL, 0);
+ ide_preferences_add_file_chooser (preferences, "projects", "directory", "org.gnome.builder",
"projects-directory", NULL, _("Projects directory"), _("A place for all your projects"),
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, NULL, 0);
+ ide_preferences_add_switch (preferences, "projects", "directory", "org.gnome.builder",
"restore-previous-files", NULL, NULL, _("Restore previously opened files"), _("Open previously opened files
when loading a project"), NULL, 10);
ide_preferences_add_list_group (preferences, "projects", "discovery", _("Project Discovery"), 0);
ide_preferences_add_switch (preferences, "projects", "discovery", "org.gnome.builder",
"enable-project-miners", NULL, NULL, _("Discover projects on my computer"), _("Scan your computer for
existing projects"), NULL, 0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]