Commit 108806be authored by Benjamin Berg's avatar Benjamin Berg

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
parent e6cc020f
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment