437
439
g_debug ("GsmXSMPClient: queuing new SaveYourself for '%s'",
438
440
client->priv->description);
439
441
client->priv->next_save_yourself = save_type;
442
client->priv->next_save_yourself_allow_interact = allow_interact;
441
444
client->priv->current_save_yourself = save_type;
445
/* make sure we don't have anything queued */
446
client->priv->next_save_yourself = -1;
447
client->priv->next_save_yourself_allow_interact = FALSE;
443
449
switch (save_type) {
444
450
case SmSaveLocal:
620
630
xsmp_save (GsmClient *client,
633
GKeyFile *keyfile = NULL;
624
634
char *desktop_file_path = NULL;
625
635
char *exec_program = NULL;
636
char *exec_discard = NULL;
626
637
char *startup_id = NULL;
627
638
GError *local_error;
650
666
"X-GNOME-Autostart-startup-id",
653
exec_program = xsmp_get_restart_command (client);
654
669
g_key_file_set_string (keyfile,
655
670
G_KEY_FILE_DESKTOP_GROUP,
656
671
G_KEY_FILE_DESKTOP_KEY_EXEC,
674
exec_discard = xsmp_get_discard_command (client);
676
g_key_file_set_string (keyfile,
677
G_KEY_FILE_DESKTOP_GROUP,
678
"X-GNOME-Autostart-discard-exec",
660
682
g_free (desktop_file_path);
661
683
g_free (exec_program);
684
g_free (exec_discard);
662
685
g_free (startup_id);
664
687
if (local_error != NULL) {
702
forceful = (flags & GSM_CLIENT_END_SESSION_FLAG_FORCEFUL);
703
do_save_yourself (GSM_XSMP_CLIENT (client), SmSaveGlobal, forceful);
726
allow_interact = !(flags & GSM_CLIENT_END_SESSION_FLAG_FORCEFUL);
728
/* we don't want to save the session state, but we just want to know if
729
* there's user data the client has to save and we want to give the
730
* client a chance to tell the user about it. This is consistent with
731
* the manager not setting GSM_CLIENT_END_SESSION_FLAG_SAVE for this
733
save_type = SmSaveGlobal;
735
do_save_yourself (GSM_XSMP_CLIENT (client), save_type, allow_interact);
722
forceful = (flags & GSM_CLIENT_END_SESSION_FLAG_FORCEFUL);
723
do_save_yourself (GSM_XSMP_CLIENT (client), SmSaveGlobal, forceful);
754
phase2 = (flags & GSM_CLIENT_END_SESSION_FLAG_LAST);
757
xsmp_save_yourself_phase2 (client);
759
gboolean allow_interact;
762
/* we gave a chance to interact to the app during
763
* xsmp_query_end_session(), now it's too late to interact */
764
allow_interact = FALSE;
766
if (flags & GSM_CLIENT_END_SESSION_FLAG_SAVE) {
767
save_type = SmSaveBoth;
769
save_type = SmSaveGlobal;
772
do_save_yourself (GSM_XSMP_CLIENT (client),
773
save_type, allow_interact);
1099
1151
g_signal_emit (client, signals[LOGOUT_REQUEST], 0, !fast);
1100
1152
} else if (!shutdown && !global) {
1101
1153
g_debug ("GsmXSMPClient: initiating checkpoint");
1102
do_save_yourself (client, SmSaveLocal, FALSE);
1154
do_save_yourself (client, SmSaveLocal, TRUE);
1104
1156
g_debug ("GsmXSMPClient: ignoring");
1114
1166
g_debug ("GsmXSMPClient: Client '%s' received SaveYourselfPhase2Request",
1115
1167
client->priv->description);
1117
/* Treat this just like a SaveYourselfDone */
1118
if (client->priv->current_save_yourself == SmSaveLocal) {
1119
client->priv->current_save_yourself = -1;
1120
SmsSaveComplete (client->priv->conn);
1122
client->priv->current_save_yourself = -1;
1169
client->priv->current_save_yourself = -1;
1125
1171
/* this is a valid response to SaveYourself and therefore
1126
1172
may be a response to a QES or ES */
1127
gdm_client_end_session_response (GSM_CLIENT (client),
1173
gsm_client_end_session_response (GSM_CLIENT (client),
1131
/* FIXME: change priority so this client runs at the end? */
1137
1181
int dialog_type)
1139
1183
GsmXSMPClient *client = manager_data;
1143
1189
g_debug ("GsmXSMPClient: Client '%s' received InteractRequest(%s)",
1144
1190
client->priv->description,
1145
1191
dialog_type == SmDialogNormal ? "Dialog" : "Errors");
1147
gdm_client_end_session_response (GSM_CLIENT (client),
1193
gsm_client_end_session_response (GSM_CLIENT (client),
1194
FALSE, FALSE, FALSE,
1149
1195
_("This program is blocking log out."));
1151
1198
/* Can't just call back with Interact because session client
1152
1199
grabs the keyboard! So, we try to get it to release
1153
1200
grabs by telling it we've cancelled the shutdown.
1172
1221
client->priv->description,
1173
1222
cancel_shutdown ? "True" : "False");
1175
gdm_client_end_session_response (GSM_CLIENT (client),
1224
gsm_client_end_session_response (GSM_CLIENT (client),
1225
TRUE, FALSE, cancel_shutdown,
1188
1237
client->priv->description,
1189
1238
success ? "True" : "False");
1191
if (client->priv->current_save_yourself == SmSaveLocal) {
1192
client->priv->current_save_yourself = -1;
1193
SmsSaveComplete (client->priv->conn);
1195
client->priv->current_save_yourself = -1;
1240
client->priv->current_save_yourself = -1;
1241
SmsSaveComplete (client->priv->conn);
1198
/* If success is false then the application still has
1199
unsafe data. We may also have tricked it into sending
1200
us this message when we faked the ShutdownCancel to
1203
gdm_client_end_session_response (GSM_CLIENT (client),
1243
/* If success is false then the application couldn't save data. Nothing
1244
* the session manager can do about, though. FIXME: we could display a
1245
* dialog about this, I guess. */
1246
gsm_client_end_session_response (GSM_CLIENT (client),
1208
1250
if (client->priv->next_save_yourself) {
1209
int save_type = client->priv->next_save_yourself;
1251
int save_type = client->priv->next_save_yourself;
1252
gboolean allow_interact = client->priv->next_save_yourself_allow_interact;
1211
1254
client->priv->next_save_yourself = -1;
1212
do_save_yourself (client, save_type, FALSE);
1255
client->priv->next_save_yourself_allow_interact = -1;
1256
do_save_yourself (client, save_type, allow_interact);