summaryrefslogtreecommitdiff
path: root/xfce4-session/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'xfce4-session/main.c')
-rw-r--r--xfce4-session/main.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/xfce4-session/main.c b/xfce4-session/main.c
index e88b8952..ddac4077 100644
--- a/xfce4-session/main.c
+++ b/xfce4-session/main.c
@@ -195,11 +195,13 @@ xfsm_dbus_cleanup (void)
int
main (int argc, char **argv)
{
- XfsmManager *manager;
- XfsmShutdownType shutdown_type;
- GError *error = NULL;
- GdkDisplay *dpy;
- XfconfChannel *channel;
+ XfsmManager *manager;
+ GError *error = NULL;
+ GdkDisplay *dpy;
+ XfconfChannel *channel;
+ XfsmShutdownType shutdown_type;
+ XfsmShutdown *shutdown;
+ gboolean succeed;
xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");
@@ -261,13 +263,25 @@ main (int argc, char **argv)
xfsm_manager_restart (manager);
gtk_main ();
-
+
shutdown_type = xfsm_manager_get_shutdown_type (manager);
+
g_object_unref (manager);
g_object_unref (channel);
xfsm_dbus_cleanup ();
ice_cleanup ();
- return xfsm_shutdown (shutdown_type);
+ if (shutdown_type == XFSM_SHUTDOWN_SHUTDOWN
+ || shutdown_type == XFSM_SHUTDOWN_RESTART)
+ {
+ shutdown = xfsm_shutdown_get ();
+ succeed = xfsm_shutdown_try_type (shutdown, shutdown_type, &error);
+ if (!succeed)
+ g_warning ("Failed to shutdown/restart: %s", ERROR_MSG (error));
+ g_object_unref (shutdown);
+ return succeed ? EXIT_SUCCESS : EXIT_FAILURE;
+ }
+
+ return EXIT_SUCCESS;
}