[gnome-builder] libide/gui: improve symmetry for saving session state
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] libide/gui: improve symmetry for saving session state
- Date: Thu, 15 Sep 2022 00:32:57 +0000 (UTC)
commit d20a597f024c3bfe5f8af60e9c06eeebc1f92c9d
Author: Christian Hergert <chergert redhat com>
Date: Wed Sep 14 17:20:48 2022 -0700
libide/gui: improve symmetry for saving session state
src/libide/gui/ide-workbench.c | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
---
diff --git a/src/libide/gui/ide-workbench.c b/src/libide/gui/ide-workbench.c
index 67be8ac8e..f62bd1268 100644
--- a/src/libide/gui/ide-workbench.c
+++ b/src/libide/gui/ide-workbench.c
@@ -1717,16 +1717,20 @@ ide_workbench_unload_async (IdeWorkbench *self,
G_CONNECT_SWAPPED);
g_application_hold (app);
- /* If we have a project open, we want to save session state that
- * can be restored the next time Builder is started.
+ /* Collect addins up front, we'll need them a couple times */
+ addins = ide_workbench_collect_addins (self);
+
+ /* Create a session object to store project state */
+ session = ide_session_new ();
+
+ /* We always request to save session state, but we only persist
+ * it to disk for projects. That may change in the future though
+ * so we always call that API for symmetry.
*/
- if (self->project_info != NULL)
+ for (guint i = 0; i < addins->len; i++)
{
- session = ide_session_new ();
-
- peas_extension_set_foreach (self->addins,
- ide_workbench_addin_save_state_cb,
- session);
+ IdeWorkbenchAddin *addin = g_ptr_array_index (addins, i);
+ ide_workbench_addin_save_session (addin, session);
}
/* Release the search engine early to help it cleanup */
@@ -1749,8 +1753,10 @@ ide_workbench_unload_async (IdeWorkbench *self,
IDE_EXIT;
}
- addins = ide_workbench_collect_addins (self);
- ide_task_set_task_data (task, g_ptr_array_ref (addins), g_ptr_array_unref);
+ /* Keep the addins around to call during stages of unload */
+ ide_task_set_task_data (task,
+ g_ptr_array_ref (addins),
+ g_ptr_array_unref);
if (addins->len == 0)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]