[Xfce4-commits] [xfce/xfce4-session] 01/01: Fix 'shutdown' action in the fallback mode
noreply at xfce.org
noreply at xfce.org
Sat Mar 28 05:04:33 CET 2015
This is an automated email from the git hooks/post-receive script.
eric pushed a commit to branch master
in repository xfce/xfce4-session.
commit 83fd4fee8697fc5da8411c99b18900d211b72d68
Author: Mikhail Efremov <sem at altlinux.org>
Date: Fri Mar 20 20:54:38 2015 +0300
Fix 'shutdown' action in the fallback mode
Use switch instead of multiple if..else.
Signed-off-by: Eric Koegel <eric.koegel at gmail.com>
---
xfce4-session/xfsm-shutdown-fallback.c | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/xfce4-session/xfsm-shutdown-fallback.c b/xfce4-session/xfsm-shutdown-fallback.c
index 24437e8..2627788 100644
--- a/xfce4-session/xfsm-shutdown-fallback.c
+++ b/xfce4-session/xfsm-shutdown-fallback.c
@@ -244,26 +244,29 @@ xfsm_shutdown_fallback_try_action (XfsmShutdownType type,
gint exit_status = 0;
gchar *command = NULL;
- if (type == XFSM_SHUTDOWN_SHUTDOWN)
- action = "shutdown";
- if (type == XFSM_SHUTDOWN_RESTART)
- action = "restart";
- else if (type == XFSM_SHUTDOWN_SUSPEND)
- {
+ switch (type)
+ {
+ case XFSM_SHUTDOWN_SHUTDOWN:
+ action = "shutdown";
+ break;
+ case XFSM_SHUTDOWN_RESTART:
+ action = "restart";
+ break;
+ case XFSM_SHUTDOWN_SUSPEND:
action = "suspend";
/* On suspend we try to lock the screen */
if (!lock_screen (error))
return FALSE;
- }
- else if (type == XFSM_SHUTDOWN_HIBERNATE)
- {
+ break;
+ case XFSM_SHUTDOWN_HIBERNATE:
action = "hibernate";
/* On hibernate we try to lock the screen */
if (!lock_screen (error))
return FALSE;
- }
- else
+ break;
+ default:
return FALSE;
+ }
command = g_strdup_printf ("pkexec " XFSM_SHUTDOWN_HELPER_CMD " --%s", action);
ret = g_spawn_command_line_sync (command, NULL, NULL, &exit_status, error);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list