[gnome-session/benzea/no-save-restore-required-components: 1/2] save: Do not save apps in the RequiredComponents list
- From: Benjamin Berg <bberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-session/benzea/no-save-restore-required-components: 1/2] save: Do not save apps in the RequiredComponents list
- Date: Wed, 20 Nov 2019 15:19:27 +0000 (UTC)
commit 108806be2e547e10b2099fb0d78afe988506fdcc
Author: Benjamin Berg <bberg redhat com>
Date: Wed Nov 20 15:21:35 2019 +0100
save: Do not save apps in the RequiredComponents list
These are essential components of the session. They will be restored
anyway and should not be restored if e.g. the user switches sessions.
This actually caused trouble after the systemd move as gnome-session may
end up starting gnome-shell because it was auto-saved, while gnome-shell
is also started through systemd causing the session to fail.
See: #41
gnome-session/gsm-manager.c | 5 ++++-
gnome-session/gsm-session-save.c | 9 ++++++++-
gnome-session/gsm-session-save.h | 1 +
3 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/gnome-session/gsm-manager.c b/gnome-session/gsm-manager.c
index d41bdcac..2f7838b3 100644
--- a/gnome-session/gsm-manager.c
+++ b/gnome-session/gsm-manager.c
@@ -1935,7 +1935,10 @@ maybe_save_session (GsmManager *manager)
}
error = NULL;
- gsm_session_save (manager->priv->clients, manager->priv->apps, &error);
+ gsm_session_save (manager->priv->clients,
+ manager->priv->apps,
+ manager->priv->required_apps,
+ &error);
if (error) {
g_warning ("Error saving session: %s", error->message);
diff --git a/gnome-session/gsm-session-save.c b/gnome-session/gsm-session-save.c
index a71a6181..f78731d7 100644
--- a/gnome-session/gsm-session-save.c
+++ b/gnome-session/gsm-session-save.c
@@ -40,6 +40,7 @@ typedef struct {
const char *dir;
GHashTable *discard_hash;
GsmStore *app_store;
+ GSList *ignored_apps;
GError **error;
} SessionSaveData;
@@ -60,7 +61,7 @@ save_one_client (char *id,
SessionSaveData *data)
{
GsmClient *client;
- GKeyFile *keyfile;
+ GKeyFile *keyfile = NULL;
GsmApp *app = NULL;
const char *app_id;
char *path = NULL;
@@ -87,6 +88,10 @@ save_one_client (char *id,
(GsmStoreFunc)_app_has_app_id,
(char *)app_id);
}
+ /* Do not save apps in the ignored set (i.e. required components). */
+ if (g_slist_find (data->ignored_apps, app) != NULL)
+ goto out;
+
keyfile = gsm_client_save (client, app, &local_error);
if (keyfile == NULL || local_error) {
@@ -153,6 +158,7 @@ out:
void
gsm_session_save (GsmStore *client_store,
GsmStore *app_store,
+ GSList *ignored_apps,
GError **error)
{
GSettings *settings;
@@ -178,6 +184,7 @@ gsm_session_save (GsmStore *client_store,
data.discard_hash = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free, NULL);
data.app_store = app_store;
+ data.ignored_apps = ignored_apps;
/* remove old saved session */
gsm_session_clear_saved_session (save_dir, data.discard_hash);
diff --git a/gnome-session/gsm-session-save.h b/gnome-session/gsm-session-save.h
index f55c9c16..98f16fa9 100644
--- a/gnome-session/gsm-session-save.h
+++ b/gnome-session/gsm-session-save.h
@@ -26,6 +26,7 @@ G_BEGIN_DECLS
void gsm_session_save (GsmStore *client_store,
GsmStore *app_store,
+ GSList *ignored_apps,
GError **error);
void gsm_session_save_clear (void);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]