[gnome-session] gsm: Remove saved session if auto-save-session is set to false
- From: Vincent Untz <vuntz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-session] gsm: Remove saved session if auto-save-session is set to false
- Date: Tue, 22 Mar 2011 15:35:01 +0000 (UTC)
commit e8759ab5a06fbfe5faf81805c56f61e604572bfa
Author: Vincent Untz <vuntz gnome org>
Date: Tue Mar 22 16:33:05 2011 +0100
gsm: Remove saved session if auto-save-session is set to false
If we don't do that, right now, there is no just no way to go back to a
default session for users. Of course, this will make people who save a
session once unhappy, but if we want to handle that correctly, we need
more work anyway.
gnome-session/gsm-manager.c | 1 +
gnome-session/gsm-session-save.c | 18 +++++++++++++++++-
gnome-session/gsm-session-save.h | 1 +
3 files changed, 19 insertions(+), 1 deletions(-)
---
diff --git a/gnome-session/gsm-manager.c b/gnome-session/gsm-manager.c
index b00e298..6bc4770 100644
--- a/gnome-session/gsm-manager.c
+++ b/gnome-session/gsm-manager.c
@@ -2106,6 +2106,7 @@ maybe_save_session (GsmManager *manager)
}
if (!auto_save_is_enabled (manager)) {
+ gsm_session_save_clear ();
goto out;
}
diff --git a/gnome-session/gsm-session-save.c b/gnome-session/gsm-session-save.c
index 089e71c..fdaf24e 100644
--- a/gnome-session/gsm-session-save.c
+++ b/gnome-session/gsm-session-save.c
@@ -206,7 +206,7 @@ gsm_session_clear_one_client (const char *filename,
if (!discard_exec)
goto out;
- if (g_hash_table_lookup (discard_hash, discard_exec))
+ if (discard_hash && g_hash_table_lookup (discard_hash, discard_exec))
goto out;
if (!g_shell_parse_argv (discard_exec, &argc, &argv, NULL))
@@ -269,3 +269,19 @@ gsm_session_clear_saved_session (const char *directory,
return result;
}
+
+void
+gsm_session_save_clear (void)
+{
+ const char *save_dir;
+
+ g_debug ("GsmSessionSave: Clearing saved session");
+
+ save_dir = gsm_util_get_saved_session_dir ();
+ if (save_dir == NULL) {
+ g_warning ("GsmSessionSave: cannot create saved session directory");
+ return;
+ }
+
+ gsm_session_clear_saved_session (save_dir, NULL);
+}
diff --git a/gnome-session/gsm-session-save.h b/gnome-session/gsm-session-save.h
index 611e864..10b5005 100644
--- a/gnome-session/gsm-session-save.h
+++ b/gnome-session/gsm-session-save.h
@@ -28,6 +28,7 @@ G_BEGIN_DECLS
void gsm_session_save (GsmStore *client_store,
GError **error);
+void gsm_session_save_clear (void);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]