3
* Copyright (c) 2003-2004 Benedikt Meurer <benny@xfce.org>
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2, or (at your option)
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21
* Parts of this file where taken from gnome-session/logout.c, which
22
* was written by Owen Taylor <otaylor@redhat.com>.
29
#ifdef HAVE_SYS_WAIT_H
44
#ifdef HAVE_SYS_TYPES_H
45
#include <sys/types.h>
52
#ifdef HAVE_ASM_UNISTD_H
53
#include <asm/unistd.h> /* for __NR_ioprio_set */
56
#include <libxfce4util/libxfce4util.h>
59
#include <libxfsm/xfsm-util.h>
61
#include <xfce4-session/shutdown.h>
62
#include <xfce4-session/xfsm-compat-gnome.h>
63
#include <xfce4-session/xfsm-compat-kde.h>
64
#include <xfce4-session/xfsm-fadeout.h>
65
#include <xfce4-session/xfsm-global.h>
66
#include <xfce4-session/xfsm-legacy.h>
67
#include <xfce4-session/xfsm-shutdown-helper.h>
72
static XfsmShutdownHelper *shutdown_helper = NULL;
74
static GtkWidget *shutdown_dialog = NULL;
76
#ifdef SESSION_SCREENSHOTS
78
screenshot_save (const gchar *session_name, GdkPixmap *pm, GdkRectangle *area)
87
pb = gdk_pixbuf_get_from_drawable (NULL, GDK_DRAWABLE (pm), NULL,
88
0, 0, 0, 0, area->width, area->height);
92
/* scale down the pixbuf */
93
spb = gdk_pixbuf_scale_simple (pb, 52, 43, GDK_INTERP_HYPER);
97
/* determine thumb file */
98
dpy = gdk_drawable_get_display (GDK_DRAWABLE (pm));
99
display_name = xfsm_gdk_display_get_fullname (dpy);
100
resource = g_strconcat ("sessions/thumbs-", display_name,
101
"/", session_name, ".png", NULL);
102
filename = xfce_resource_save_location (XFCE_RESOURCE_CACHE,
104
g_free (display_name);
107
gdk_pixbuf_save (spb, filename, "png", NULL, NULL);
109
g_object_unref (G_OBJECT (spb));
113
g_object_unref (G_OBJECT (pb));
120
entry_activate_cb (GtkWidget *entry, GtkDialog *dialog)
122
gtk_dialog_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
126
logout_button_clicked (GtkWidget *b, gint *shutdownType)
128
*shutdownType = XFSM_SHUTDOWN_LOGOUT;
130
gtk_dialog_response (GTK_DIALOG (shutdown_dialog), GTK_RESPONSE_OK);
134
reboot_button_clicked (GtkWidget *b, gint *shutdownType)
136
*shutdownType = XFSM_SHUTDOWN_REBOOT;
138
gtk_dialog_response (GTK_DIALOG (shutdown_dialog), GTK_RESPONSE_OK);
142
halt_button_clicked (GtkWidget *b, gint *shutdownType)
144
*shutdownType = XFSM_SHUTDOWN_HALT;
146
gtk_dialog_response (GTK_DIALOG (shutdown_dialog), GTK_RESPONSE_OK);
150
suspend_button_clicked (GtkWidget *b, gint *shutdownType)
152
*shutdownType = XFSM_SHUTDOWN_SUSPEND;
154
gtk_dialog_response (GTK_DIALOG (shutdown_dialog), GTK_RESPONSE_OK);
158
hibernate_button_clicked (GtkWidget *b, gint *shutdownType)
160
*shutdownType = XFSM_SHUTDOWN_HIBERNATE;
162
gtk_dialog_response (GTK_DIALOG (shutdown_dialog), GTK_RESPONSE_OK);
168
shutdownDialog(const gchar *sessionName, XfsmShutdownType *shutdownType, gboolean *saveSession)
170
gboolean accessibility;
171
GtkIconTheme *icon_theme;
172
XfsmFadeout *fadeout = NULL;
182
GtkWidget *entry_vbox;
185
GtkWidget *logout_button;
186
GtkWidget *reboot_button;
187
GtkWidget *halt_button;
188
GtkWidget *suspend_button = NULL;
189
GtkWidget *hibernate_button = NULL;
190
GtkWidget *cancel_button;
191
GtkWidget *ok_button;
196
gboolean show_suspend;
197
gboolean show_hibernate;
199
gboolean show_restart;
200
gboolean show_shutdown;
202
gboolean require_password;
207
gboolean kiosk_can_shutdown;
208
gboolean kiosk_can_save_session;
209
XfconfChannel *channel;
210
#ifdef SESSION_SCREENSHOTS
211
GdkRectangle screenshot_area;
213
GdkPixmap *screenshot_pm = NULL;
214
GdkGC *screenshot_gc;
220
g_return_val_if_fail(saveSession != NULL, FALSE);
221
g_return_val_if_fail(shutdownType != NULL, FALSE);
223
icon_theme = gtk_icon_theme_get_default ();
225
/* destroy any previously running shutdown helper first */
226
if (shutdown_helper != NULL)
228
g_object_unref (shutdown_helper);
229
shutdown_helper = NULL;
232
/* load kiosk settings */
233
kiosk = xfce_kiosk_new ("xfce4-session");
234
kiosk_can_shutdown = xfce_kiosk_query (kiosk, "Shutdown");
235
kiosk_can_save_session = xfce_kiosk_query (kiosk, "SaveSession");
236
xfce_kiosk_free (kiosk);
238
/* load configuration */
239
channel = xfsm_open_config ();
240
channel = xfconf_channel_get ("xfce4-session");
241
saveonexit = xfconf_channel_get_bool (channel, "/general/SaveOnExit", TRUE);
242
autosave = xfconf_channel_get_bool (channel, "/general/AutoSave", FALSE);
243
prompt = xfconf_channel_get_bool (channel, "/general/PromptOnLogout", TRUE);
244
show_suspend = xfconf_channel_get_bool (channel, "/shutdown/ShowSuspend", TRUE);
245
show_hibernate = xfconf_channel_get_bool (channel, "/shutdown/ShowHibernate", TRUE);
247
/* make the session-save settings obey the kiosk settings */
248
if (!kiosk_can_save_session)
254
/* if PromptOnLogout is off, saving depends on AutoSave */
257
*shutdownType = XFSM_SHUTDOWN_LOGOUT;
258
*saveSession = autosave;
263
/* spawn the helper early so we know what it supports when
264
* constructing the dialog */
265
shutdown_helper = xfsm_shutdown_helper_new ();
267
/* It's really bad here if someone else has the pointer
268
* grabbed, so we first grab the pointer and keyboard
269
* to an offscreen window, and then once we have the
270
* server grabbed, move that to our dialog.
272
gtk_rc_reparse_all ();
274
/* get screen with pointer */
275
screen = xfce_gdk_screen_get_active (&monitor);
278
screen = gdk_screen_get_default ();
282
/* Try to grab Input on a hidden window first */
283
hidden = gtk_invisible_new_for_screen (screen);
284
gtk_widget_show_now (hidden);
286
accessibility = GTK_IS_ACCESSIBLE (gtk_widget_get_accessible (hidden));
292
if (gdk_pointer_grab (hidden->window, TRUE, 0, NULL, NULL,
293
GDK_CURRENT_TIME) == GDK_GRAB_SUCCESS)
295
if (gdk_keyboard_grab (hidden->window, FALSE, GDK_CURRENT_TIME)
301
gdk_pointer_ungrab (GDK_CURRENT_TIME);
304
g_usleep (50 * 1000);
307
#ifdef SESSION_SCREENSHOTS
308
/* grab a screenshot */
309
root = gdk_screen_get_root_window (screen);
310
gdk_screen_get_monitor_geometry (screen, monitor, &screenshot_area);
311
screenshot_pm = gdk_pixmap_new (GDK_DRAWABLE (root),
312
screenshot_area.width,
313
screenshot_area.height,
315
screenshot_gc = gdk_gc_new (GDK_DRAWABLE (screenshot_pm));
316
gdk_gc_set_function (screenshot_gc, GDK_COPY);
317
gdk_gc_set_subwindow (screenshot_gc, TRUE);
318
gdk_draw_drawable (GDK_DRAWABLE (screenshot_pm),
325
screenshot_area.width,
326
screenshot_area.height);
327
g_object_unref (G_OBJECT (screenshot_gc));
330
/* display fadeout */
331
fadeout = xfsm_fadeout_new (gtk_widget_get_display (hidden));
334
/* create confirm dialog */
335
dialog = g_object_new (GTK_TYPE_DIALOG,
336
"type", GTK_WINDOW_POPUP,
341
dialog = gtk_dialog_new ();
342
atk_object_set_role (gtk_widget_get_accessible (dialog), ATK_ROLE_ALERT);
343
gtk_window_set_decorated (GTK_WINDOW (dialog), FALSE);
346
shutdown_dialog = dialog;
348
cancel_button = gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_CANCEL,
349
GTK_RESPONSE_CANCEL);
351
ok_button = gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_OK,
354
gtk_widget_hide (ok_button);
356
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CANCEL);
357
gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
358
gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
359
gtk_window_set_screen (GTK_WINDOW (dialog), screen);
361
dbox = GTK_DIALOG(dialog)->vbox;
363
vbox = gtk_vbox_new(FALSE, BORDER);
364
gtk_box_pack_start(GTK_BOX(dbox), vbox, TRUE, TRUE, 0);
365
gtk_container_set_border_width (GTK_CONTAINER (vbox), BORDER);
366
gtk_widget_show(vbox);
369
pw = getpwuid (getuid ());
370
if (G_LIKELY(pw && pw->pw_name && *pw->pw_name))
372
gchar *text = g_strdup_printf (_("<span size='large'><b>Log out %s</b></span>"), pw->pw_name);
373
GtkWidget *logout_label = g_object_new (GTK_TYPE_LABEL,
376
"justify", GTK_JUSTIFY_CENTER,
381
gtk_widget_show (logout_label);
382
gtk_box_pack_start (GTK_BOX (vbox), logout_label, FALSE, FALSE, 0);
388
hbox = gtk_hbox_new (TRUE, BORDER);
389
gtk_widget_show (hbox);
390
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
393
logout_button = gtk_button_new ();
394
gtk_widget_show (logout_button);
395
gtk_box_pack_start (GTK_BOX (hbox), logout_button, TRUE, TRUE, 0);
397
g_signal_connect (logout_button, "clicked",
398
G_CALLBACK (logout_button_clicked), shutdownType);
400
vbox2 = gtk_vbox_new (FALSE, BORDER);
401
gtk_container_set_border_width (GTK_CONTAINER (vbox2), BORDER);
402
gtk_widget_show (vbox2);
403
gtk_container_add (GTK_CONTAINER (logout_button), vbox2);
405
icon = gtk_icon_theme_load_icon (icon_theme,
411
icon = gtk_icon_theme_load_icon (icon_theme,
414
GTK_ICON_LOOKUP_GENERIC_FALLBACK,
417
image = gtk_image_new_from_pixbuf (icon);
418
gtk_widget_show (image);
419
gtk_box_pack_start (GTK_BOX (vbox2), image, FALSE, FALSE, 0);
420
g_object_unref (icon);
422
label = gtk_label_new (_("Log Out"));
423
gtk_widget_show (label);
424
gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, FALSE, 0);
427
reboot_button = gtk_button_new ();
428
gtk_widget_show (reboot_button);
429
gtk_box_pack_start (GTK_BOX (hbox), reboot_button, TRUE, TRUE, 0);
431
g_signal_connect (reboot_button, "clicked",
432
G_CALLBACK (reboot_button_clicked), shutdownType);
434
vbox2 = gtk_vbox_new (FALSE, BORDER);
435
gtk_container_set_border_width (GTK_CONTAINER (vbox2), BORDER);
436
gtk_widget_show (vbox2);
437
gtk_container_add (GTK_CONTAINER (reboot_button), vbox2);
439
icon = gtk_icon_theme_load_icon (icon_theme,
446
icon = gtk_icon_theme_load_icon (icon_theme,
449
GTK_ICON_LOOKUP_GENERIC_FALLBACK,
452
image = gtk_image_new_from_pixbuf (icon);
453
gtk_widget_show (image);
454
gtk_box_pack_start (GTK_BOX (vbox2), image, FALSE, FALSE, 0);
455
g_object_unref (icon);
457
label = gtk_label_new (_("Restart"));
458
gtk_widget_show (label);
459
gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, FALSE, 0);
461
g_object_get (shutdown_helper,
462
"user-can-restart", &show_restart,
465
if (!kiosk_can_shutdown || !show_restart )
466
gtk_widget_set_sensitive (reboot_button, FALSE);
469
halt_button = gtk_button_new ();
470
gtk_widget_show (halt_button);
471
gtk_box_pack_start (GTK_BOX (hbox), halt_button, TRUE, TRUE, 0);
473
g_signal_connect (halt_button, "clicked",
474
G_CALLBACK (halt_button_clicked), shutdownType);
476
vbox2 = gtk_vbox_new (FALSE, BORDER);
477
gtk_container_set_border_width (GTK_CONTAINER (vbox2), BORDER);
478
gtk_widget_show (vbox2);
479
gtk_container_add (GTK_CONTAINER (halt_button), vbox2);
481
icon = gtk_icon_theme_load_icon (icon_theme,
488
icon = gtk_icon_theme_load_icon (icon_theme,
491
GTK_ICON_LOOKUP_GENERIC_FALLBACK,
494
image = gtk_image_new_from_pixbuf (icon);
495
gtk_widget_show (image);
496
gtk_box_pack_start (GTK_BOX (vbox2), image, FALSE, FALSE, 0);
497
g_object_unref (icon);
499
label = gtk_label_new (_("Shut Down"));
500
gtk_widget_show (label);
501
gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, FALSE, 0);
503
g_object_get (shutdown_helper,
504
"user-can-shutdown", &show_shutdown,
507
if (!kiosk_can_shutdown || !show_shutdown)
508
gtk_widget_set_sensitive (halt_button, FALSE);
511
g_object_get (shutdown_helper,
512
"user-can-suspend", &show_suspend,
516
g_object_get (shutdown_helper,
517
"user-can-hibernate", &show_hibernate,
521
if (kiosk_can_shutdown && (show_suspend || show_hibernate))
523
hbox = gtk_hbox_new (FALSE, BORDER);
524
gtk_widget_show (hbox);
525
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
529
if (kiosk_can_shutdown && show_suspend)
531
suspend_button = gtk_button_new ();
532
gtk_widget_show (suspend_button);
533
gtk_box_pack_start (GTK_BOX (hbox), suspend_button, TRUE, TRUE, 0);
535
g_signal_connect (suspend_button, "clicked",
536
G_CALLBACK (suspend_button_clicked), shutdownType);
538
vbox2 = gtk_vbox_new (FALSE, BORDER);
539
gtk_container_set_border_width (GTK_CONTAINER (vbox2), BORDER);
540
gtk_widget_show (vbox2);
541
gtk_container_add (GTK_CONTAINER (suspend_button), vbox2);
543
icon = gtk_icon_theme_load_icon (icon_theme,
550
icon = gtk_icon_theme_load_icon (icon_theme,
553
GTK_ICON_LOOKUP_GENERIC_FALLBACK,
556
image = gtk_image_new_from_pixbuf (icon);
557
gtk_widget_show (image);
558
gtk_box_pack_start (GTK_BOX (vbox2), image, FALSE, FALSE, 0);
559
g_object_unref (icon);
561
label = gtk_label_new (_("Suspend"));
562
gtk_widget_show (label);
563
gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, FALSE, 0);
567
if (kiosk_can_shutdown && show_hibernate)
569
hibernate_button = gtk_button_new ();
570
gtk_widget_show (hibernate_button);
571
gtk_box_pack_start (GTK_BOX (hbox), hibernate_button, TRUE, TRUE, 0);
573
g_signal_connect (hibernate_button, "clicked",
574
G_CALLBACK (hibernate_button_clicked), shutdownType);
576
vbox2 = gtk_vbox_new (FALSE, BORDER);
577
gtk_container_set_border_width (GTK_CONTAINER (vbox2), BORDER);
578
gtk_widget_show (vbox2);
579
gtk_container_add (GTK_CONTAINER (hibernate_button), vbox2);
581
icon = gtk_icon_theme_load_icon (icon_theme,
588
icon = gtk_icon_theme_load_icon (icon_theme,
591
GTK_ICON_LOOKUP_GENERIC_FALLBACK,
594
image = gtk_image_new_from_pixbuf (icon);
595
gtk_widget_show (image);
596
gtk_box_pack_start (GTK_BOX (vbox2), image, FALSE, FALSE, 0);
597
g_object_unref (icon);
599
label = gtk_label_new (_("Hibernate"));
600
gtk_widget_show (label);
601
gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, FALSE, 0);
605
if (!autosave && kiosk_can_save_session)
607
checkbox = gtk_check_button_new_with_mnemonic(
608
_("_Save session for future logins"));
609
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbox), saveonexit);
610
gtk_box_pack_start(GTK_BOX(vbox), checkbox, FALSE, TRUE, BORDER);
611
gtk_widget_show(checkbox);
618
/* create small border */
620
xfsm_window_add_border (GTK_WINDOW (dialog));
622
/* center dialog on target monitor */
623
gtk_window_set_screen (GTK_WINDOW (dialog), screen);
624
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER);
626
/* save portion of the root window covered by the dialog */
627
if (!accessibility && shutdown_helper != NULL)
629
gtk_widget_realize (dialog);
630
gdk_window_set_override_redirect (dialog->window, TRUE);
631
gdk_window_raise (dialog->window);
634
/* need to realize the dialog first! */
635
gtk_widget_show_now (dialog);
636
gtk_widget_grab_focus (logout_button);
638
/* Grab Keyboard and Mouse pointer */
640
xfsm_window_grab_input (GTK_WINDOW (dialog));
642
/* run the logout dialog */
643
result = gtk_dialog_run (GTK_DIALOG(dialog));
645
if (result == GTK_RESPONSE_OK) {
646
*saveSession = autosave ? autosave :
647
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbox));
650
gtk_widget_hide (dialog);
652
g_object_get (shutdown_helper,
653
"require-password", &require_password,
657
if (result == GTK_RESPONSE_OK && *shutdownType != XFSM_SHUTDOWN_LOGOUT
658
&& require_password )
660
gtk_widget_show (ok_button);
662
gtk_widget_destroy (vbox);
664
entry_vbox = gtk_vbox_new (FALSE, BORDER);
665
gtk_box_pack_start (GTK_BOX (dbox), entry_vbox, TRUE, TRUE, BORDER);
666
gtk_widget_show (entry_vbox);
668
label = gtk_label_new (_("Please enter your password:"));
669
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
670
gtk_widget_show (label);
671
gtk_box_pack_start (GTK_BOX (entry_vbox), label, FALSE, FALSE, 0);
673
entry = gtk_entry_new ();
674
gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE);
675
gtk_box_pack_start (GTK_BOX (entry_vbox), entry, TRUE, TRUE, 0);
676
g_signal_connect (G_OBJECT (entry), "activate",
677
G_CALLBACK (entry_activate_cb), dialog);
678
gtk_widget_show (entry);
680
/* center dialog on target monitor */
681
gtk_window_set_screen (GTK_WINDOW (dialog), screen);
682
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER);
684
gtk_widget_show_now (dialog);
685
gtk_widget_grab_focus (entry);
687
/* Grab Keyboard and Mouse pointer */
689
xfsm_window_grab_input (GTK_WINDOW (dialog));
691
result = gtk_dialog_run (GTK_DIALOG (dialog));
693
if (result == GTK_RESPONSE_OK)
695
const gchar *password = gtk_entry_get_text (GTK_ENTRY (entry));
697
if (!xfsm_shutdown_helper_send_password (shutdown_helper, password))
699
gtk_label_set_text (GTK_LABEL (label),
700
_("<b>An error occurred</b>"));
701
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
703
gtk_container_remove (GTK_CONTAINER (
704
GTK_DIALOG (dialog)->action_area), cancel_button);
705
gtk_container_remove (GTK_CONTAINER (
706
GTK_DIALOG (dialog)->action_area), ok_button);
708
gtk_container_remove (GTK_CONTAINER (entry_vbox), entry);
710
gtk_dialog_add_button (GTK_DIALOG (dialog),
712
GTK_RESPONSE_CANCEL);
714
label = gtk_label_new (_("Either the password you entered is "
715
"invalid, or the system administrator "
716
"disallows shutting down this computer "
717
"with your user account."));
718
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
719
gtk_box_pack_start (GTK_BOX (entry_vbox), label, TRUE, TRUE, 0);
720
gtk_widget_show (label);
722
/* center dialog on target monitor */
723
gtk_window_set_screen (GTK_WINDOW (dialog), screen);
724
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER);
726
gtk_widget_show_now (dialog);
728
/* Grab Keyboard and Mouse pointer */
730
xfsm_window_grab_input (GTK_WINDOW (dialog));
732
gtk_dialog_run (GTK_DIALOG (dialog));
734
result = GTK_RESPONSE_CANCEL;
739
gtk_widget_destroy(dialog);
740
gtk_widget_destroy(hidden);
742
shutdown_dialog = NULL;
744
/* Release Keyboard/Mouse pointer grab */
747
xfsm_fadeout_destroy (fadeout);
749
gdk_pointer_ungrab (GDK_CURRENT_TIME);
750
gdk_keyboard_ungrab (GDK_CURRENT_TIME);
754
/* process all pending events first */
755
while (gtk_events_pending ())
756
g_main_context_iteration (NULL, FALSE);
759
* remember the current settings.
761
if (result == GTK_RESPONSE_OK)
763
xfconf_channel_set_string (channel, "/general/SessionName", sessionName);
764
xfconf_channel_set_bool (channel, "/general/SaveOnExit", *saveSession);
768
g_object_unref (shutdown_helper);
769
shutdown_helper = NULL;
772
#ifdef SESSION_SCREENSHOTS
773
if (screenshot_pm != NULL)
775
if (result == GTK_RESPONSE_OK)
776
screenshot_save (sessionName, screenshot_pm, &screenshot_area);
778
g_object_unref (G_OBJECT (screenshot_pm));
782
return (result == GTK_RESPONSE_OK);
789
xfsm_shutdown(XfsmShutdownType type)
792
GError *error = NULL;
795
if (type == XFSM_SHUTDOWN_ASK)
797
g_warning ("xfsm_shutdown () passed XFSM_SHUTDOWN_ASK. This is a bug.");
798
type = XFSM_SHUTDOWN_LOGOUT;
801
/* these two remember if they were started or not */
802
xfsm_compat_gnome_shutdown ();
803
xfsm_compat_kde_shutdown ();
805
/* kill legacy clients */
806
xfsm_legacy_shutdown ();
808
#if !defined(__NR_ioprio_set) && defined(HAVE_SYNC)
809
/* sync disk block in-core status with that on disk. if
810
* we have ioprio_set (), then we've already synced. */
817
_exit (EXIT_SUCCESS);
819
#endif /* HAVE_SYNC */
821
if (type == XFSM_SHUTDOWN_LOGOUT)
824
if (shutdown_helper == NULL)
825
shutdown_helper = xfsm_shutdown_helper_new ();
827
result = xfsm_shutdown_helper_send_command (shutdown_helper, type, &error);
828
g_object_unref (shutdown_helper);
829
shutdown_helper = NULL;
833
xfce_message_dialog (NULL, _("Shutdown Failed"),
834
GTK_STOCK_DIALOG_ERROR,
835
_("Unable to perform shutdown"),
837
GTK_STOCK_QUIT, GTK_RESPONSE_ACCEPT,
839
g_error_free (error);