[gnome-text-editor] session: store graceful shutdown state
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-text-editor] session: store graceful shutdown state
- Date: Sun, 19 Jun 2022 21:14:48 +0000 (UTC)
commit 05005c2a1b187022d2cfe8920e2a801a8ebd8728
Author: Christian Hergert <chergert redhat com>
Date: Sun Jun 19 14:14:05 2022 -0700
session: store graceful shutdown state
We need to know when loading session state if the state was part of an
auto-save or if it was from a graceful shutdown.
Related #403
src/editor-application-actions.c | 2 ++
src/editor-session.c | 5 ++++-
src/editor-session.h | 1 +
3 files changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/src/editor-application-actions.c b/src/editor-application-actions.c
index 2478829..1de3153 100644
--- a/src/editor-application-actions.c
+++ b/src/editor-application-actions.c
@@ -265,6 +265,7 @@ editor_application_actions_confirm_cb (GObject *object,
return;
editor_session_save_async (self->session,
+ TRUE,
NULL,
editor_application_actions_quit_cb,
g_object_ref (self));
@@ -301,6 +302,7 @@ editor_application_actions_quit (GSimpleAction *action,
}
editor_session_save_async (self->session,
+ TRUE,
NULL,
editor_application_actions_quit_cb,
g_object_ref (self));
diff --git a/src/editor-session.c b/src/editor-session.c
index 0f98170..92f83c1 100644
--- a/src/editor-session.c
+++ b/src/editor-session.c
@@ -1028,6 +1028,7 @@ _editor_session_remove_window (EditorSession *self,
}
editor_session_save_async (self,
+ TRUE,
NULL,
editor_session_save_for_shutdown_cb,
NULL);
@@ -1233,6 +1234,7 @@ editor_session_save_draft_cb (GObject *object,
void
editor_session_save_async (EditorSession *self,
+ gboolean shutting_down,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
@@ -1252,6 +1254,7 @@ editor_session_save_async (EditorSession *self,
g_variant_builder_add_parsed (&builder, "{'version', <%u>}", 1);
add_draft_state (self, &builder);
add_window_state (self, &builder);
+ g_variant_builder_add_parsed (&builder, "{'shutdown', <%b>}", !!shutting_down);
vstate = g_variant_builder_end (&builder);
state = g_slice_new0 (EditorSessionSave);
@@ -2224,7 +2227,7 @@ editor_session_auto_save_timeout_cb (gpointer user_data)
self->auto_save_source = 0;
g_debug ("Performing auto-save of session state");
- editor_session_save_async (self, NULL, NULL, NULL);
+ editor_session_save_async (self, FALSE, NULL, NULL, NULL);
return G_SOURCE_REMOVE;
}
diff --git a/src/editor-session.h b/src/editor-session.h
index e1a14b9..a958e65 100644
--- a/src/editor-session.h
+++ b/src/editor-session.h
@@ -67,6 +67,7 @@ gboolean editor_session_restore_finish (EditorSession *self
GAsyncResult *result,
GError **error);
void editor_session_save_async (EditorSession *self,
+ gboolean shutting_down,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]