diff options
| author | Dana Jansens <danakj@orodu.net> | 2003-11-11 11:54:29 +0000 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2003-11-11 11:54:29 +0000 |
| commit | 064901801e8ceb7b07dbd0d27b4fecd600f7c766 (patch) | |
| tree | d69df5a4ab844fd0c7612829cc7a570c16299d4b /openbox | |
| parent | 5f0d12c9d7519faa0189296133c27c849a9d9599 (diff) | |
dont go changing the session file all the time, and so then dont need to unlink so we dont end up stalling when the same session is asked for more than once.
Diffstat (limited to 'openbox')
| -rw-r--r-- | openbox/session.c | 38 |
1 files changed, 15 insertions, 23 deletions
diff --git a/openbox/session.c b/openbox/session.c index 2fd83e98..107abe4e 100644 --- a/openbox/session.c +++ b/openbox/session.c @@ -92,17 +92,10 @@ static void save_commands() prop_res.vals[i].length = strlen(sm_argv[i]); } - if (save_file) { - prop_res.vals[i].value = "--sm-save-file"; - prop_res.vals[i++].length = strlen("--sm-save-file"); - prop_res.vals[i].value = save_file; - prop_res.vals[i++].length = strlen(save_file); - } else { - prop_res.vals[i].value = "--sm-client-id"; - prop_res.vals[i++].length = strlen("--sm-client-id"); - prop_res.vals[i].value = sm_id; - prop_res.vals[i++].length = strlen(sm_id); - } + prop_res.vals[i].value = "--sm-save-file"; + prop_res.vals[i++].length = strlen("--sm-save-file"); + prop_res.vals[i].value = save_file; + prop_res.vals[i++].length = strlen(save_file); props[0] = &prop_res; props[1] = &prop_cmd; @@ -169,6 +162,17 @@ void session_startup(gint *argc, gchar ***argv) if (save_file) session_load(save_file); + else { + gchar *filename; + + /* this algo is from metacity */ + filename = g_strdup_printf("%d-%d-%u.obs", + (gint) time(NULL), + (gint) getpid(), + g_random_int()); + save_file = g_build_filename(sm_sessions_path, filename, NULL); + g_free(filename); + } sm_argc = *argc; sm_argv = *argv; @@ -315,22 +319,10 @@ static void sm_shutdown_cancelled(SmcConn conn, SmPointer data) static gboolean session_save() { - gchar *filename; FILE *f; GList *it; gboolean success = TRUE; - if (save_file) - unlink(save_file); - - /* this algo is from metacity */ - filename = g_strdup_printf("%d-%d-%u.obs", - (gint) time(NULL), - (gint) getpid(), - g_random_int()); - save_file = g_build_filename(sm_sessions_path, filename, NULL); - g_free(filename); - f = fopen(save_file, "w"); if (!f) { success = FALSE; |
