session: Add shutdown command

This commit is contained in:
Kim Woelders 2024-03-08 14:07:41 +01:00
parent e0cd65cc10
commit af8665e634
5 changed files with 15 additions and 1 deletions

View File

@ -8,3 +8,4 @@
"Theme menu" NULL menu theme.menu "Theme menu" NULL menu theme.menu
"Restart" NULL "exit restart" "Restart" NULL "exit restart"
"Log out" NULL "exit logout" "Log out" NULL "exit logout"
"Shut down" NULL "exit shutdown"

View File

@ -105,6 +105,7 @@ const char *txt[] = {
_("Theme menu"), _("Theme menu"),
_("Restart"), _("Restart"),
_("Log out"), _("Log out"),
_("Shut down"),
/* winops.menu */ /* winops.menu */
_("Window Options"), _("Window Options"),
_("Close"), _("Close"),

View File

@ -1,6 +1,6 @@
/* /*
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
* Copyright (C) 2004-2023 Kim Woelders * Copyright (C) 2004-2024 Kim Woelders
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to * of this software and associated documentation files (the "Software"), to
@ -1105,6 +1105,8 @@ IPC_Exit(const char *params)
SessionExit(EEXIT_THEME, p2); SessionExit(EEXIT_THEME, p2);
else if (!strcmp(param1, "exec")) else if (!strcmp(param1, "exec"))
SessionExit(EEXIT_EXEC, p2); SessionExit(EEXIT_EXEC, p2);
else if (!strcmp(param1, "shutdown"))
SessionExit(EEXIT_SHUTDOWN, NULL);
} }
#if ENABLE_DIALOGS #if ENABLE_DIALOGS

View File

@ -720,6 +720,15 @@ SessionExit(int mode, const char *param)
if (Conf.session.enable_logout_dialog) if (Conf.session.enable_logout_dialog)
_SessionLogoutConfirm(); _SessionLogoutConfirm();
else else
#endif
_SessionLogout();
return;
case EEXIT_SHUTDOWN:
#if ENABLE_DIALOGS
if (Conf.session.enable_logout_dialog)
_SessionLogoutConfirm();
else
#endif #endif
_SessionLogout(); _SessionLogout();
return; return;

View File

@ -32,6 +32,7 @@
#define EEXIT_RESTART 4 #define EEXIT_RESTART 4
#define EEXIT_THEME 5 #define EEXIT_THEME 5
#define EEXIT_EXEC 6 #define EEXIT_EXEC 6
#define EEXIT_SHUTDOWN 7
#define ESESSHLP_INIT 0 #define ESESSHLP_INIT 0
#define ESESSHLP_START 1 #define ESESSHLP_START 1