1 Index: xfce4-session-4.10.1/configure.ac
2 ===================================================================
3 --- xfce4-session-4.10.1.orig/configure.ac
4 +++ xfce4-session-4.10.1/configure.ac
5 @@ -103,7 +103,7 @@ XDT_CHECK_PACKAGE([XFCONF], [libxfconf-0
7 dnl Check for polkit / systemd integration
8 XDT_CHECK_OPTIONAL_PACKAGE([SYSTEMD], [polkit-gobject-1], [0.100],
9 - [systemd], [Systemd support (through polit)])
10 + [systemd], [Systemd support (through polkit)])
12 dnl Check for debugging support
13 XDT_FEATURE_DEBUG([xfsm_debug_default])
14 @@ -207,10 +207,10 @@ echo " * Legacy session management:
16 echo " * Legacy session management: no"
18 -if test x"$GNOME_KEYRING_FOUND" = x"yes"; then
19 -echo " * Gnome Keyring support: yes"
20 +if test x"$SYSTEMD_FOUND" = x"yes"; then
21 +echo " * Systemd support (through polkit): yes"
23 -echo " * Gnome Keyring support: no"
24 +echo " * Systemd support (through polkit): no"
28 Index: xfce4-session-4.10.1/xfce4-session/Makefile.am
29 ===================================================================
30 --- xfce4-session-4.10.1.orig/xfce4-session/Makefile.am
31 +++ xfce4-session-4.10.1/xfce4-session/Makefile.am
32 @@ -38,6 +38,8 @@ xfce4_session_SOURCES = \
41 @@ -67,10 +69,6 @@ if HAVE_SYSTEMD
42 xfce4_session_SOURCES += \
46 -xfce4_session_SOURCES += \
51 xfce4_session_CFLAGS = \
52 Index: xfce4-session-4.10.1/xfce4-session/xfsm-systemd.c
53 ===================================================================
54 --- xfce4-session-4.10.1.orig/xfce4-session/xfsm-systemd.c
55 +++ xfce4-session-4.10.1/xfce4-session/xfsm-systemd.c
57 #include <dbus/dbus-glib.h>
58 #include <dbus/dbus-glib-lowlevel.h>
60 +#include <libxfsm/xfsm-util.h>
61 #include <xfce4-session/xfsm-systemd.h>
65 #define SYSTEMD_DBUS_INTERFACE "org.freedesktop.login1.Manager"
66 #define SYSTEMD_REBOOT_ACTION "Reboot"
67 #define SYSTEMD_POWEROFF_ACTION "PowerOff"
68 +#define SYSTEMD_SUSPEND_ACTION "Suspend"
69 +#define SYSTEMD_HIBERNATE_ACTION "Hibernate"
70 #define SYSTEMD_REBOOT_TEST "org.freedesktop.login1.reboot"
71 #define SYSTEMD_POWEROFF_TEST "org.freedesktop.login1.power-off"
72 +#define SYSTEMD_SUSPEND_TEST "org.freedesktop.login1.suspend"
73 +#define SYSTEMD_HIBERNATE_TEST "org.freedesktop.login1.hibernate"
77 @@ -93,6 +98,22 @@ xfsm_systemd_finalize (GObject *object)
83 +xfsm_systemd_lock_screen (GError **error)
85 + XfconfChannel *channel;
86 + gboolean ret = TRUE;
88 + channel = xfsm_open_config ();
89 + if (xfconf_channel_get_bool (channel, "/shutdown/LockScreen", FALSE))
90 + ret = g_spawn_command_line_async ("xflock4", error);
98 xfsm_systemd_can_method (XfsmSystemd *systemd,
100 @@ -205,6 +226,34 @@ xfsm_systemd_try_shutdown (XfsmSystemd
104 +xfsm_systemd_try_suspend (XfsmSystemd *systemd,
107 + if (!xfsm_systemd_lock_screen (error))
110 + return xfsm_systemd_try_method (systemd,
111 + SYSTEMD_SUSPEND_ACTION,
118 +xfsm_systemd_try_hibernate (XfsmSystemd *systemd,
121 + if (!xfsm_systemd_lock_screen (error))
124 + return xfsm_systemd_try_method (systemd,
125 + SYSTEMD_HIBERNATE_ACTION,
132 xfsm_systemd_can_restart (XfsmSystemd *systemd,
133 gboolean *can_restart,
135 @@ -227,3 +276,39 @@ xfsm_systemd_can_shutdown (XfsmSystemd
136 SYSTEMD_POWEROFF_TEST,
143 +xfsm_systemd_can_suspend (XfsmSystemd *systemd,
144 + gboolean *can_suspend,
145 + gboolean *auth_suspend,
148 + gboolean ret = FALSE;
150 + ret = xfsm_systemd_can_method (systemd,
152 + SYSTEMD_SUSPEND_TEST,
154 + *auth_suspend = *can_suspend;
161 +xfsm_systemd_can_hibernate (XfsmSystemd *systemd,
162 + gboolean *can_hibernate,
163 + gboolean *auth_hibernate,
166 + gboolean ret = FALSE;
168 + ret = xfsm_systemd_can_method (systemd,
170 + SYSTEMD_HIBERNATE_TEST,
172 + *auth_hibernate = *can_hibernate;
175 Index: xfce4-session-4.10.1/xfce4-session/xfsm-systemd.h
176 ===================================================================
177 --- xfce4-session-4.10.1.orig/xfce4-session/xfsm-systemd.h
178 +++ xfce4-session-4.10.1/xfce4-session/xfsm-systemd.h
179 @@ -42,6 +42,12 @@ gboolean xfsm_systemd_try_restart (
180 gboolean xfsm_systemd_try_shutdown (XfsmSystemd *systemd,
183 +gboolean xfsm_systemd_try_suspend (XfsmSystemd *systemd,
186 +gboolean xfsm_systemd_try_hibernate (XfsmSystemd *systemd,
189 gboolean xfsm_systemd_can_restart (XfsmSystemd *systemd,
190 gboolean *can_restart,
192 @@ -50,6 +56,16 @@ gboolean xfsm_systemd_can_shutdown (
193 gboolean *can_shutdown,
196 +gboolean xfsm_systemd_can_suspend (XfsmSystemd *systemd,
197 + gboolean *can_suspend,
198 + gboolean *auth_suspend,
201 +gboolean xfsm_systemd_can_hibernate (XfsmSystemd *systemd,
202 + gboolean *can_hibernate,
203 + gboolean *auth_hibernate,
208 #endif /* __XFSM_SYSTEMD_H__ */
209 Index: xfce4-session-4.10.1/xfce4-session/xfsm-shutdown.c
210 ===================================================================
211 --- xfce4-session-4.10.1.orig/xfce4-session/xfsm-shutdown.c
212 +++ xfce4-session-4.10.1/xfce4-session/xfsm-shutdown.c
214 #include <xfce4-session/xfsm-shutdown.h>
215 #include <xfce4-session/xfsm-compat-gnome.h>
216 #include <xfce4-session/xfsm-compat-kde.h>
217 +#include <xfce4-session/xfsm-consolekit.h>
218 #include <xfce4-session/xfsm-fadeout.h>
219 #include <xfce4-session/xfsm-global.h>
220 #include <xfce4-session/xfsm-legacy.h>
221 #include <xfce4-session/xfsm-upower.h>
224 +#define LOGIND_RUNNING() (access ("/run/systemd/seats/", F_OK) >= 0)
225 #include <xfce4-session/xfsm-systemd.h>
227 -#include <xfce4-session/xfsm-consolekit.h>
230 static void xfsm_shutdown_finalize (GObject *object);
231 @@ -98,9 +98,8 @@ struct _XfsmShutdown
234 XfsmSystemd *systemd;
236 - XfsmConsolekit *consolekit;
238 + XfsmConsolekit *consolekit;
242 @@ -139,10 +138,14 @@ xfsm_shutdown_init (XfsmShutdown *shutdo
246 - shutdown->systemd = xfsm_systemd_get ();
248 - shutdown->consolekit = xfsm_consolekit_get ();
249 + shutdown->consolekit = NULL;
250 + shutdown->systemd = NULL;
251 + if (LOGIND_RUNNING())
252 + shutdown->systemd = xfsm_systemd_get ();
255 + shutdown->consolekit = xfsm_consolekit_get ();
257 shutdown->upower = xfsm_upower_get ();
258 shutdown->helper_state = SUDO_NOT_INITIAZED;
259 shutdown->helper_require_password = FALSE;
260 @@ -162,10 +165,11 @@ xfsm_shutdown_finalize (GObject *object)
261 XfsmShutdown *shutdown = XFSM_SHUTDOWN (object);
264 - g_object_unref (G_OBJECT (shutdown->systemd));
266 - g_object_unref (G_OBJECT (shutdown->consolekit));
267 + if (shutdown->systemd != NULL)
268 + g_object_unref (G_OBJECT (shutdown->systemd));
270 + if (shutdown->consolekit != NULL)
271 + g_object_unref (G_OBJECT (shutdown->consolekit));
272 g_object_unref (G_OBJECT (shutdown->upower));
274 /* close down helper */
275 @@ -657,10 +661,11 @@ xfsm_shutdown_try_restart (XfsmShutdown
276 return xfsm_shutdown_sudo_try_action (shutdown, XFSM_SHUTDOWN_RESTART, error);
279 - return xfsm_systemd_try_restart (shutdown->systemd, error);
281 - return xfsm_consolekit_try_restart (shutdown->consolekit, error);
282 + if (LOGIND_RUNNING())
283 + return xfsm_systemd_try_restart (shutdown->systemd, error);
286 + return xfsm_consolekit_try_restart (shutdown->consolekit, error);
290 @@ -678,10 +683,11 @@ xfsm_shutdown_try_shutdown (XfsmShutdown
291 return xfsm_shutdown_sudo_try_action (shutdown, XFSM_SHUTDOWN_SHUTDOWN, error);
294 - return xfsm_systemd_try_shutdown (shutdown->systemd, error);
296 - return xfsm_consolekit_try_shutdown (shutdown->consolekit, error);
297 + if (LOGIND_RUNNING())
298 + return xfsm_systemd_try_shutdown (shutdown->systemd, error);
301 + return xfsm_consolekit_try_shutdown (shutdown->consolekit, error);
305 @@ -692,6 +698,11 @@ xfsm_shutdown_try_suspend (XfsmShutdown
307 g_return_val_if_fail (XFSM_IS_SHUTDOWN (shutdown), FALSE);
310 + if (LOGIND_RUNNING())
311 + return xfsm_systemd_try_suspend (shutdown->systemd, error);
314 return xfsm_upower_try_suspend (shutdown->upower, error);
317 @@ -703,6 +714,11 @@ xfsm_shutdown_try_hibernate (XfsmShutdow
319 g_return_val_if_fail (XFSM_IS_SHUTDOWN (shutdown), FALSE);
322 + if (LOGIND_RUNNING())
323 + return xfsm_systemd_try_hibernate (shutdown->systemd, error);
326 return xfsm_upower_try_hibernate (shutdown->upower, error);
329 @@ -722,10 +738,14 @@ xfsm_shutdown_can_restart (XfsmShutdown
333 - if (xfsm_systemd_can_restart (shutdown->systemd, can_restart, error))
335 - if (xfsm_consolekit_can_restart (shutdown->consolekit, can_restart, error))
336 + if (LOGIND_RUNNING())
338 + if (xfsm_systemd_can_restart (shutdown->systemd, can_restart, error))
343 + if (xfsm_consolekit_can_restart (shutdown->consolekit, can_restart, error))
346 if (xfsm_shutdown_sudo_init (shutdown, error))
347 @@ -753,10 +773,14 @@ xfsm_shutdown_can_shutdown (XfsmShutdown
351 - if (xfsm_systemd_can_shutdown (shutdown->systemd, can_shutdown, error))
353 - if (xfsm_consolekit_can_shutdown (shutdown->consolekit, can_shutdown, error))
354 + if (LOGIND_RUNNING())
356 + if (xfsm_systemd_can_shutdown (shutdown->systemd, can_shutdown, error))
361 + if (xfsm_consolekit_can_shutdown (shutdown->consolekit, can_shutdown, error))
364 if (xfsm_shutdown_sudo_init (shutdown, error))
365 @@ -784,6 +808,12 @@ xfsm_shutdown_can_suspend (XfsmShutdown
370 + if (LOGIND_RUNNING())
371 + return xfsm_systemd_can_suspend (shutdown->systemd, can_suspend,
372 + auth_suspend, error);
375 return xfsm_upower_can_suspend (shutdown->upower, can_suspend,
376 auth_suspend, error);
378 @@ -804,6 +834,12 @@ xfsm_shutdown_can_hibernate (XfsmShutdow
383 + if (LOGIND_RUNNING())
384 + return xfsm_systemd_can_hibernate (shutdown->systemd, can_hibernate,
385 + auth_hibernate, error);
388 return xfsm_upower_can_hibernate (shutdown->upower, can_hibernate,
389 auth_hibernate, error);