Commit 27a02075 authored by Vincent Untz's avatar Vincent Untz Committed by Vincent Untz

Make session saving works a bit better by telling client to not just save

2009-03-25  Vincent Untz  <vuntz@gnome.org>

	Make session saving works a bit better by telling client to not just
	save the global state, but also the local state when relevant.

	* gnome-session/gsm-client.h: add new GSM_CLIENT_END_SESSION_FLAG_SAVE
	* gnome-session/gsm-manager.c: (do_phase_end_session): if the session
	should be autosaved, then pass the GSM_CLIENT_END_SESSION_FLAG_SAVE
	flag
	(do_phase_query_end_session): add a comment explaining why we don't use
	the GSM_CLIENT_END_SESSION_FLAG_SAVE flag
	* gnome-session/gsm-xsmp-client.c: (xsmp_query_end_session),
	(xsmp_end_session): depending on the presence of the
	GSM_CLIENT_END_SESSION_FLAG_SAVE flag, use SmSaveBoth or SmSaveGlobal

svn path=/trunk/; revision=5357
parent 60b298fe
2009-03-25 Vincent Untz <vuntz@gnome.org>
Make session saving works a bit better by telling client to not just
save the global state, but also the local state when relevant.
* gnome-session/gsm-client.h: add new GSM_CLIENT_END_SESSION_FLAG_SAVE
* gnome-session/gsm-manager.c: (do_phase_end_session): if the session
should be autosaved, then pass the GSM_CLIENT_END_SESSION_FLAG_SAVE
flag
(do_phase_query_end_session): add a comment explaining why we don't use
the GSM_CLIENT_END_SESSION_FLAG_SAVE flag
* gnome-session/gsm-xsmp-client.c: (xsmp_query_end_session),
(xsmp_end_session): depending on the presence of the
GSM_CLIENT_END_SESSION_FLAG_SAVE flag, use SmSaveBoth or SmSaveGlobal
2009-03-24 Vincent Untz <vuntz@gnome.org>
* gnome-session/gsm-xsmp-client.c: (do_save_yourself): just add some
......
......@@ -55,7 +55,8 @@ typedef enum {
} GsmClientRestartStyle;
typedef enum {
GSM_CLIENT_END_SESSION_FLAG_FORCEFUL = 1 << 0
GSM_CLIENT_END_SESSION_FLAG_FORCEFUL = 1 << 0,
GSM_CLIENT_END_SESSION_FLAG_SAVE = 1 << 1
} GsmClientEndSessionFlag;
struct _GsmClient
......
......@@ -137,6 +137,8 @@ static void gsm_manager_class_init (GsmManagerClass *klass);
static void gsm_manager_init (GsmManager *manager);
static void gsm_manager_finalize (GObject *object);
static gboolean auto_save_is_enabled (GsmManager *manager);
static gpointer manager_object = NULL;
G_DEFINE_TYPE (GsmManager, gsm_manager, G_TYPE_OBJECT)
......@@ -561,6 +563,10 @@ do_phase_end_session (GsmManager *manager)
if (manager->priv->forceful_logout) {
data.flags |= GSM_CLIENT_END_SESSION_FLAG_FORCEFUL;
}
if (auto_save_is_enabled (manager)) {
data.flags |= GSM_CLIENT_END_SESSION_FLAG_SAVE;
}
if (manager->priv->phase_timeout_id > 0) {
g_source_remove (manager->priv->phase_timeout_id);
......@@ -1044,6 +1050,9 @@ do_phase_query_end_session (GsmManager *manager)
if (manager->priv->forceful_logout) {
data.flags |= GSM_CLIENT_END_SESSION_FLAG_FORCEFUL;
}
/* We only query if an app is ready to log out, so we don't use
* GSM_CLIENT_END_SESSION_FLAG_SAVE here.
*/
debug_clients (manager);
g_debug ("GsmManager: sending query-end-session to clients forceful:%d", manager->priv->forceful_logout);
......
......@@ -708,6 +708,7 @@ xsmp_query_end_session (GsmClient *client,
GError **error)
{
gboolean forceful;
int save_type;
if (GSM_XSMP_CLIENT (client)->priv->conn == NULL) {
g_set_error (error,
......@@ -718,7 +719,14 @@ xsmp_query_end_session (GsmClient *client,
}
forceful = (flags & GSM_CLIENT_END_SESSION_FLAG_FORCEFUL);
do_save_yourself (GSM_XSMP_CLIENT (client), SmSaveGlobal, forceful);
if (flags & GSM_CLIENT_END_SESSION_FLAG_SAVE) {
save_type = SmSaveBoth;
} else {
save_type = SmSaveGlobal;
}
do_save_yourself (GSM_XSMP_CLIENT (client), save_type, forceful);
return TRUE;
}
......@@ -728,6 +736,7 @@ xsmp_end_session (GsmClient *client,
GError **error)
{
gboolean forceful;
int save_type;
if (GSM_XSMP_CLIENT (client)->priv->conn == NULL) {
g_set_error (error,
......@@ -738,7 +747,14 @@ xsmp_end_session (GsmClient *client,
}
forceful = (flags & GSM_CLIENT_END_SESSION_FLAG_FORCEFUL);
do_save_yourself (GSM_XSMP_CLIENT (client), SmSaveGlobal, forceful);
if (flags & GSM_CLIENT_END_SESSION_FLAG_SAVE) {
save_type = SmSaveBoth;
} else {
save_type = SmSaveGlobal;
}
do_save_yourself (GSM_XSMP_CLIENT (client), save_type, forceful);
return TRUE;
}
......
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