Lines Matching refs:xsmp

84 #define EGG_SM_CLIENT_XSMP_STATE(xsmp) (state_names[(xsmp)->state])  argument
161 static void set_properties (EggSMClientXSMP *xsmp, ...);
162 static void delete_properties (EggSMClientXSMP *xsmp, ...);
168 static void save_state (EggSMClientXSMP *xsmp);
169 static void do_save_yourself (EggSMClientXSMP *xsmp);
170 static void update_pending_events (EggSMClientXSMP *xsmp);
185 egg_sm_client_xsmp_init (EggSMClientXSMP *xsmp) in G_DEFINE_TYPE()
187 xsmp->state = XSMP_STATE_CONNECTION_CLOSED; in G_DEFINE_TYPE()
188 xsmp->connection = NULL; in G_DEFINE_TYPE()
189 xsmp->restart_style = SmRestartIfRunning; in G_DEFINE_TYPE()
216 EggSMClientXSMP *xsmp = user_data; in sm_client_xsmp_set_initial_properties() local
221 if (xsmp->idle) in sm_client_xsmp_set_initial_properties()
223 g_source_remove (xsmp->idle); in sm_client_xsmp_set_initial_properties()
224 xsmp->idle = 0; in sm_client_xsmp_set_initial_properties()
226 xsmp->waiting_to_set_initial_properties = FALSE; in sm_client_xsmp_set_initial_properties()
229 xsmp->restart_style = SmRestartNever; in sm_client_xsmp_set_initial_properties()
239 if (xsmp->restart_style == SmRestartIfRunning) in sm_client_xsmp_set_initial_properties()
243 xsmp->restart_style = SmRestartImmediately; in sm_client_xsmp_set_initial_properties()
246 if (!xsmp->set_restart_command) in sm_client_xsmp_set_initial_properties()
253 egg_sm_client_set_restart_command (EGG_SM_CLIENT (xsmp), in sm_client_xsmp_set_initial_properties()
267 if (!xsmp->set_restart_command) in sm_client_xsmp_set_initial_properties()
268 xsmp->restart_command = g_strsplit (g_get_prgname (), " ", -1); in sm_client_xsmp_set_initial_properties()
270 clone = generate_command (xsmp->restart_command, NULL, NULL); in sm_client_xsmp_set_initial_properties()
271 restart = generate_command (xsmp->restart_command, xsmp->client_id, NULL); in sm_client_xsmp_set_initial_properties()
280 set_properties (xsmp, in sm_client_xsmp_set_initial_properties()
286 card8_prop (SmRestartStyleHint, xsmp->restart_style), in sm_client_xsmp_set_initial_properties()
293 set_properties (xsmp, in sm_client_xsmp_set_initial_properties()
298 update_pending_events (xsmp); in sm_client_xsmp_set_initial_properties()
307 sm_client_xsmp_disconnect (EggSMClientXSMP *xsmp) in sm_client_xsmp_disconnect() argument
311 if (!xsmp->connection) in sm_client_xsmp_disconnect()
316 connection = xsmp->connection; in sm_client_xsmp_disconnect()
317 xsmp->connection = NULL; in sm_client_xsmp_disconnect()
319 xsmp->state = XSMP_STATE_CONNECTION_CLOSED; in sm_client_xsmp_disconnect()
321 xsmp->waiting_to_save_myself = FALSE; in sm_client_xsmp_disconnect()
322 update_pending_events (xsmp); in sm_client_xsmp_disconnect()
329 EggSMClientXSMP *xsmp = (EggSMClientXSMP *)client; in sm_client_xsmp_startup() local
334 xsmp->client_id = g_strdup (client_id); in sm_client_xsmp_startup()
344 callbacks.save_yourself.client_data = xsmp; in sm_client_xsmp_startup()
345 callbacks.die.client_data = xsmp; in sm_client_xsmp_startup()
346 callbacks.save_complete.client_data = xsmp; in sm_client_xsmp_startup()
347 callbacks.shutdown_cancelled.client_data = xsmp; in sm_client_xsmp_startup()
351 xsmp->connection = in sm_client_xsmp_startup()
352 SmcOpenConnection (NULL, xsmp, SmProtoMajor, SmProtoMinor, in sm_client_xsmp_startup()
357 xsmp->client_id, &ret_client_id, in sm_client_xsmp_startup()
360 if (!xsmp->connection) in sm_client_xsmp_startup()
365 xsmp->state = XSMP_STATE_CONNECTION_CLOSED; in sm_client_xsmp_startup()
373 if (!xsmp->client_id || in sm_client_xsmp_startup()
374 (ret_client_id && strcmp (xsmp->client_id, ret_client_id) != 0)) in sm_client_xsmp_startup()
375 xsmp->expecting_initial_save_yourself = TRUE; in sm_client_xsmp_startup()
379 g_free (xsmp->client_id); in sm_client_xsmp_startup()
380 xsmp->client_id = g_strdup (ret_client_id); in sm_client_xsmp_startup()
385 gdk_x11_set_sm_client_id (xsmp->client_id); in sm_client_xsmp_startup()
388 g_debug ("Got client ID \"%s\"", xsmp->client_id); in sm_client_xsmp_startup()
391 xsmp->state = XSMP_STATE_IDLE; in sm_client_xsmp_startup()
399 xsmp->waiting_to_set_initial_properties = TRUE; in sm_client_xsmp_startup()
400 xsmp->idle = g_idle_add (sm_client_xsmp_set_initial_properties, client); in sm_client_xsmp_startup()
408 EggSMClientXSMP *xsmp = (EggSMClientXSMP *)client; in sm_client_xsmp_set_restart_command() local
411 g_strfreev (xsmp->restart_command); in sm_client_xsmp_set_restart_command()
413 xsmp->restart_command = g_new (char *, argc + 1); in sm_client_xsmp_set_restart_command()
415 xsmp->restart_command[i] = g_strdup (argv[i]); in sm_client_xsmp_set_restart_command()
416 xsmp->restart_command[i] = NULL; in sm_client_xsmp_set_restart_command()
418 xsmp->set_restart_command = TRUE; in sm_client_xsmp_set_restart_command()
426 EggSMClientXSMP *xsmp = (EggSMClientXSMP *)client; in sm_client_xsmp_set_discard_command() local
429 g_strfreev (xsmp->discard_command); in sm_client_xsmp_set_discard_command()
431 xsmp->discard_command = g_new (char *, argc + 1); in sm_client_xsmp_set_discard_command()
433 xsmp->discard_command[i] = g_strdup (argv[i]); in sm_client_xsmp_set_discard_command()
434 xsmp->discard_command[i] = NULL; in sm_client_xsmp_set_discard_command()
436 xsmp->set_discard_command = TRUE; in sm_client_xsmp_set_discard_command()
443 EggSMClientXSMP *xsmp = (EggSMClientXSMP *)client; in sm_client_xsmp_will_quit() local
445 if (xsmp->state == XSMP_STATE_CONNECTION_CLOSED) in sm_client_xsmp_will_quit()
450 xsmp->waiting_to_emit_quit = TRUE; in sm_client_xsmp_will_quit()
451 update_pending_events (xsmp); in sm_client_xsmp_will_quit()
454 else if (xsmp->state == XSMP_STATE_SHUTDOWN_CANCELLED) in sm_client_xsmp_will_quit()
459 xsmp->waiting_to_emit_quit_cancelled = TRUE; in sm_client_xsmp_will_quit()
460 update_pending_events (xsmp); in sm_client_xsmp_will_quit()
464 g_return_if_fail (xsmp->state == XSMP_STATE_INTERACT); in sm_client_xsmp_will_quit()
467 SmcInteractDone (xsmp->connection, !will_quit); in sm_client_xsmp_will_quit()
469 if (will_quit && xsmp->need_save_state) in sm_client_xsmp_will_quit()
470 save_state (xsmp); in sm_client_xsmp_will_quit()
473 SmcSaveYourselfDone (xsmp->connection, will_quit); in sm_client_xsmp_will_quit()
474 xsmp->state = XSMP_STATE_SAVE_YOURSELF_DONE; in sm_client_xsmp_will_quit()
482 EggSMClientXSMP *xsmp = (EggSMClientXSMP *)client; in sm_client_xsmp_end_session() local
499 while (xsmp->state != XSMP_STATE_IDLE || in sm_client_xsmp_end_session()
500 xsmp->expecting_initial_save_yourself) in sm_client_xsmp_end_session()
503 if (xsmp->shutting_down) in sm_client_xsmp_end_session()
506 switch (xsmp->state) in sm_client_xsmp_end_session()
515 SmcSaveYourselfDone (xsmp->connection, FALSE); in sm_client_xsmp_end_session()
516 xsmp->state = XSMP_STATE_SAVE_YOURSELF_DONE; in sm_client_xsmp_end_session()
528 if (xsmp->waiting_to_set_initial_properties) in sm_client_xsmp_end_session()
529 sm_client_xsmp_set_initial_properties (xsmp); in sm_client_xsmp_end_session()
531 if (!xsmp->expecting_initial_save_yourself) in sm_client_xsmp_end_session()
537 process_ice_messages (SmcGetIceConnection (xsmp->connection)); in sm_client_xsmp_end_session()
551 if (!strcmp (SmcVendor (xsmp->connection), "xfce4-session")) in sm_client_xsmp_end_session()
557 SmcRequestSaveYourself (xsmp->connection, in sm_client_xsmp_end_session()
569 EggSMClientXSMP *xsmp = data; in idle_do_pending_events() local
572 xsmp->idle = 0; in idle_do_pending_events()
574 if (xsmp->waiting_to_emit_quit) in idle_do_pending_events()
576 xsmp->waiting_to_emit_quit = FALSE; in idle_do_pending_events()
581 if (xsmp->waiting_to_emit_quit_cancelled) in idle_do_pending_events()
583 xsmp->waiting_to_emit_quit_cancelled = FALSE; in idle_do_pending_events()
585 xsmp->state = XSMP_STATE_IDLE; in idle_do_pending_events()
588 if (xsmp->waiting_to_save_myself) in idle_do_pending_events()
590 xsmp->waiting_to_save_myself = FALSE; in idle_do_pending_events()
591 do_save_yourself (xsmp); in idle_do_pending_events()
599 update_pending_events (EggSMClientXSMP *xsmp) in update_pending_events() argument
602 xsmp->waiting_to_emit_quit || in update_pending_events()
603 xsmp->waiting_to_emit_quit_cancelled || in update_pending_events()
604 xsmp->waiting_to_save_myself; in update_pending_events()
608 if (xsmp->idle == 0) in update_pending_events()
609 xsmp->idle = g_idle_add (idle_do_pending_events, xsmp); in update_pending_events()
613 if (xsmp->idle != 0) in update_pending_events()
614 g_source_remove (xsmp->idle); in update_pending_events()
615 xsmp->idle = 0; in update_pending_events()
620 fix_broken_state (EggSMClientXSMP *xsmp, const char *message, in fix_broken_state() argument
625 message, EGG_SM_CLIENT_XSMP_STATE (xsmp)); in fix_broken_state()
628 xsmp->waiting_to_save_myself = FALSE; in fix_broken_state()
629 update_pending_events (xsmp); in fix_broken_state()
632 SmcInteractDone (xsmp->connection, False); in fix_broken_state()
634 SmcSaveYourselfDone (xsmp->connection, True); in fix_broken_state()
636 xsmp->state = send_save_yourself_done ? XSMP_STATE_SAVE_YOURSELF_DONE : XSMP_STATE_IDLE; in fix_broken_state()
649 EggSMClientXSMP *xsmp = client_data; in xsmp_save_yourself() local
659 EGG_SM_CLIENT_XSMP_STATE (xsmp)); in xsmp_save_yourself()
661 if (xsmp->state != XSMP_STATE_IDLE && in xsmp_save_yourself()
662 xsmp->state != XSMP_STATE_SHUTDOWN_CANCELLED) in xsmp_save_yourself()
664 fix_broken_state (xsmp, "SaveYourself", FALSE, TRUE); in xsmp_save_yourself()
668 if (xsmp->waiting_to_set_initial_properties) in xsmp_save_yourself()
669 sm_client_xsmp_set_initial_properties (xsmp); in xsmp_save_yourself()
674 if (xsmp->expecting_initial_save_yourself) in xsmp_save_yourself()
676 xsmp->expecting_initial_save_yourself = FALSE; in xsmp_save_yourself()
683 SmcSaveYourselfDone (xsmp->connection, True); in xsmp_save_yourself()
688 xsmp->state = XSMP_STATE_SAVE_YOURSELF_DONE; in xsmp_save_yourself()
737 …wants_quit_requested = g_signal_has_handler_pending (xsmp, g_signal_lookup ("quit_requested", EGG_… in xsmp_save_yourself()
739 xsmp->need_save_state = (save_type != SmSaveGlobal); in xsmp_save_yourself()
740 xsmp->need_quit_requested = (shutdown && wants_quit_requested && in xsmp_save_yourself()
742 xsmp->interact_errors = (interact_style == SmInteractStyleErrors); in xsmp_save_yourself()
744 xsmp->shutting_down = shutdown; in xsmp_save_yourself()
746 do_save_yourself (xsmp); in xsmp_save_yourself()
750 do_save_yourself (EggSMClientXSMP *xsmp) in do_save_yourself() argument
752 if (xsmp->state == XSMP_STATE_SHUTDOWN_CANCELLED) in do_save_yourself()
758 xsmp->waiting_to_save_myself = TRUE; in do_save_yourself()
759 update_pending_events (xsmp); in do_save_yourself()
763 if (xsmp->need_quit_requested) in do_save_yourself()
765 xsmp->state = XSMP_STATE_INTERACT_REQUEST; in do_save_yourself()
768 xsmp->interact_errors ? "Error" : "Normal"); in do_save_yourself()
769 SmcInteractRequest (xsmp->connection, in do_save_yourself()
770 xsmp->interact_errors ? SmDialogError : SmDialogNormal, in do_save_yourself()
772 xsmp); in do_save_yourself()
776 if (xsmp->need_save_state) in do_save_yourself()
778 save_state (xsmp); in do_save_yourself()
783 if (!xsmp->connection) in do_save_yourself()
788 SmcSaveYourselfDone (xsmp->connection, True); in do_save_yourself()
795 xsmp->state = XSMP_STATE_SAVE_YOURSELF_DONE; in do_save_yourself()
799 save_state (EggSMClientXSMP *xsmp) in save_state() argument
810 xsmp->state = XSMP_STATE_SAVE_YOURSELF; in save_state()
812 state_file = egg_sm_client_save_state ((EggSMClient *)xsmp); in save_state()
815 restart = generate_command (xsmp->restart_command, xsmp->client_id, NULL); in save_state()
816 set_properties (xsmp, in save_state()
821 if (xsmp->set_discard_command) in save_state()
823 discard = generate_command (xsmp->discard_command, NULL, NULL); in save_state()
824 set_properties (xsmp, in save_state()
830 delete_properties (xsmp, SmDiscardCommand, NULL); in save_state()
876 restart = generate_command (xsmp->restart_command, in save_state()
953 restart = generate_command (xsmp->restart_command, xsmp->client_id, in save_state()
955 set_properties (xsmp, in save_state()
962 set_properties (xsmp, in save_state()
975 EggSMClientXSMP *xsmp = client_data; in xsmp_interact() local
979 EGG_SM_CLIENT_XSMP_STATE (xsmp)); in xsmp_interact()
981 if (xsmp->state != XSMP_STATE_INTERACT_REQUEST) in xsmp_interact()
983 fix_broken_state (xsmp, "Interact", TRUE, TRUE); in xsmp_interact()
987 xsmp->state = XSMP_STATE_INTERACT; in xsmp_interact()
995 EggSMClientXSMP *xsmp = client_data; in xsmp_die() local
999 EGG_SM_CLIENT_XSMP_STATE (xsmp)); in xsmp_die()
1001 sm_client_xsmp_disconnect (xsmp); in xsmp_die()
1009 EggSMClientXSMP *xsmp = client_data; in xsmp_save_complete() local
1012 EGG_SM_CLIENT_XSMP_STATE (xsmp)); in xsmp_save_complete()
1014 if (xsmp->state == XSMP_STATE_SAVE_YOURSELF_DONE) in xsmp_save_complete()
1015 xsmp->state = XSMP_STATE_IDLE; in xsmp_save_complete()
1017 fix_broken_state (xsmp, "SaveComplete", FALSE, FALSE); in xsmp_save_complete()
1024 EggSMClientXSMP *xsmp = client_data; in xsmp_shutdown_cancelled() local
1028 EGG_SM_CLIENT_XSMP_STATE (xsmp)); in xsmp_shutdown_cancelled()
1030 xsmp->shutting_down = FALSE; in xsmp_shutdown_cancelled()
1032 if (xsmp->state == XSMP_STATE_SAVE_YOURSELF_DONE) in xsmp_shutdown_cancelled()
1037 xsmp->state = XSMP_STATE_IDLE; in xsmp_shutdown_cancelled()
1040 else if (xsmp->state == XSMP_STATE_SHUTDOWN_CANCELLED) in xsmp_shutdown_cancelled()
1048 xsmp->waiting_to_save_myself = FALSE; in xsmp_shutdown_cancelled()
1049 update_pending_events (xsmp); in xsmp_shutdown_cancelled()
1054 SmcSaveYourselfDone (xsmp->connection, False); in xsmp_shutdown_cancelled()
1056 if (xsmp->state == XSMP_STATE_INTERACT) in xsmp_shutdown_cancelled()
1062 xsmp->state = XSMP_STATE_SHUTDOWN_CANCELLED; in xsmp_shutdown_cancelled()
1069 xsmp->state = XSMP_STATE_IDLE; in xsmp_shutdown_cancelled()
1117 set_properties (EggSMClientXSMP *xsmp, ...) in set_properties() argument
1126 va_start (ap, xsmp); in set_properties()
1131 if (xsmp->connection) in set_properties()
1133 SmcSetProperties (xsmp->connection, props->len, in set_properties()
1148 delete_properties (EggSMClientXSMP *xsmp, ...) in delete_properties() argument
1154 if (!xsmp->connection) in delete_properties()
1159 va_start (ap, xsmp); in delete_properties()
1164 SmcDeleteProperties (xsmp->connection, props->len, in delete_properties()