diff options
author | Josselin Mouette <joss@malsain.org> | 2007-03-26 21:38:19 +0000 |
---|---|---|
committer | Thomas James Alexander Thurman <tthurman@src.gnome.org> | 2007-03-26 21:38:19 +0000 |
commit | 44b86d468ec813721b601a209ecaf603da710b0a (patch) | |
tree | c9d8a4b58782a0ecc447021d011dd6de3e44b454 | |
parent | 44ef3b3a5187ae8752ecfc7dbb0dc8399b33f63b (diff) | |
download | metacity-44b86d468ec813721b601a209ecaf603da710b0a.tar.gz |
if previous client ID was supplied, use it in filename. use --sm-client-id
2007-03-26 Josselin Mouette <joss@malsain.org>
* src/session.c (meta_session_init): if previous client ID
was supplied, use it in filename.
* src/session.c (set_clone_restart_commands): use --sm-client-id
in command line to restore session, not original file name.
* src/session.c (regenerate_save_file): generate filename using
client ID and not original file name.
* src/session.c (base_save_file): removed function.
Closes GNOME 407981, Debian 391287, Debian 315169.
svn path=/trunk/; revision=3125
-rw-r--r-- | ChangeLog | 11 | ||||
-rw-r--r-- | src/session.c | 39 |
2 files changed, 30 insertions, 20 deletions
@@ -1,3 +1,14 @@ +2007-03-26 Josselin Mouette <joss@malsain.org> + + * src/session.c (meta_session_init): if previous client ID + was supplied, use it in filename. + * src/session.c (set_clone_restart_commands): use --sm-client-id + in command line to restore session, not original file name. + * src/session.c (regenerate_save_file): generate filename using + client ID and not original file name. + * src/session.c (base_save_file): removed function. + Closes GNOME 407981, Debian 391287, Debian 315169. + 2007-03-25 Elijah Newren <newren gmail com> * configure.in: bump version to 2.19.1; doesn't make sense to have diff --git a/src/session.c b/src/session.c index 1031b242..ee93bfa5 100644 --- a/src/session.c +++ b/src/session.c @@ -240,6 +240,12 @@ meta_session_init (const char *previous_client_id, saved_client_id = load_state (previous_save_file); previous_client_id = saved_client_id; } + else if (previous_client_id) + { + char *save_file = g_strconcat (previous_client_id, ".ms", NULL); + saved_client_id = load_state (save_file); + g_free (save_file); + } else { saved_client_id = NULL; @@ -588,12 +594,14 @@ set_clone_restart_commands (void) prop1.name = SmRestartCommand; prop1.type = SmLISTofARRAY8; + g_return_if_fail (client_id); + i = 0; restartv[i] = "metacity"; ++i; - restartv[i] = "--sm-save-file"; + restartv[i] = "--sm-client-id"; ++i; - restartv[i] = (char*) base_save_file (); + restartv[i] = client_id; ++i; restartv[i] = NULL; @@ -1681,24 +1689,21 @@ session_info_new (void) return info; } -static char* relative_save_path = NULL; static char* full_save_path = NULL; static void regenerate_save_file (void) { - g_free (relative_save_path); g_free (full_save_path); - - relative_save_path = g_strdup_printf ("%d-%d-%u.ms", - (int) time (NULL), - (int) getpid (), - g_random_int ()); - - full_save_path = g_strconcat (g_get_home_dir (), - "/.metacity/sessions/", - relative_save_path, - NULL); + + if (client_id) + full_save_path = g_strconcat (g_get_home_dir (), + "/.metacity/sessions/", + client_id, + ".ms", + NULL); + else + full_save_path = NULL; } static const char* @@ -1707,12 +1712,6 @@ full_save_file (void) return full_save_path; } -static const char* -base_save_file (void) -{ - return relative_save_path; -} - static int windows_cmp_by_title (MetaWindow *a, MetaWindow *b) |