diff options
author | Benedikt Meurer <benny@xfce.org> | 2004-05-17 22:31:54 +0000 |
---|---|---|
committer | Benedikt Meurer <benny@xfce.org> | 2004-05-17 22:31:54 +0000 |
commit | feb37e4a4b72e312669a7b4c1d67d75a52bf62b8 (patch) | |
tree | db162d685b014ddc4518aeefa486f1d69f3e0443 /xfce4-session/xfsm-client.c | |
parent | 4f10902c9cfddc49d38f34038c58bbcbcc3e9623 (diff) | |
download | xfce4-session-feb37e4a4b72e312669a7b4c1d67d75a52bf62b8.tar.gz |
Run DiscardCommand if it changes during a SAVE YOURSELF to cleanup
unneeded session files.
Remember ActiveWorkspace for all Screens and restore it after the
session is restored.
(Old svn revision: 4553)
Diffstat (limited to 'xfce4-session/xfsm-client.c')
-rw-r--r-- | xfce4-session/xfsm-client.c | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/xfce4-session/xfsm-client.c b/xfce4-session/xfsm-client.c index ee094840..bb20aeeb 100644 --- a/xfce4-session/xfsm-client.c +++ b/xfce4-session/xfsm-client.c @@ -1,5 +1,28 @@ /* $Id$ */ /*- + * Copyright (c) 2003-2004 Benedikt Meurer <benny@xfce.org> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifdef HAVE_CONFIG_H @@ -7,6 +30,8 @@ #endif #include <xfce4-session/xfsm-client.h> +#include <xfce4-session/xfsm-global.h> +#include <xfce4-session/xfsm-util.h> XfsmClient* @@ -30,6 +55,8 @@ xfsm_client_free (XfsmClient *client) xfsm_properties_free (client->properties); if (client->save_timeout_id > 0) g_source_remove (client->save_timeout_id); + if (client->old_discard_command != NULL) + g_strfreev (client->old_discard_command); g_free (client); } @@ -47,3 +74,50 @@ xfsm_client_set_initial_properties (XfsmClient *client, client->id = properties->client_id; } + +void +xfsm_client_remember_discard_command (XfsmClient *client) +{ + XfsmProperties *properties = client->properties; + + if (client->old_discard_command != NULL) + { + g_strfreev (client->old_discard_command); + client->old_discard_command = NULL; + } + + if (properties != NULL && properties->discard_command != NULL) + { + client->old_discard_command = xfsm_strv_copy(properties->discard_command); + } +} + + +void +xfsm_client_maybe_run_old_discard_command (XfsmClient *client) +{ + gchar **old_discard_command = client->old_discard_command; + XfsmProperties *properties = client->properties; + + if (old_discard_command != NULL) + { + if (!xfsm_strv_equal (old_discard_command, properties->discard_command)) + { + xfsm_verbose ("Client Id = %s, running old discard command.\n\n", + client->id); + + g_spawn_sync (properties->current_directory, + old_discard_command, + NULL, + G_SPAWN_SEARCH_PATH, + NULL, NULL, + NULL, NULL, + NULL, NULL); + } + + g_strfreev (client->old_discard_command); + client->old_discard_command = NULL; + } +} + + |