From: Jan Rękorajski Date: Sat, 10 May 2014 19:43:44 +0000 (+0200) Subject: - up to 4.10.1 X-Git-Tag: auto/th/xfce4-session-4.10.1-1 X-Git-Url: http://git.pld-linux.org/gitweb.cgi?a=commitdiff_plain;h=fb518912859c15edad511694588ab60e2b5925dd;p=packages%2Fxfce4-session.git - up to 4.10.1 - add-systemd-support patch replaced with systemd-suspend-hibernate-support from SUSE - removed obsolete patches --- diff --git a/0001-Use-the-async-spawn-function-of-glib.patch b/0001-Use-the-async-spawn-function-of-glib.patch deleted file mode 100644 index 5e154f2..0000000 --- a/0001-Use-the-async-spawn-function-of-glib.patch +++ /dev/null @@ -1,83 +0,0 @@ -From dee0200fa5dc4de064f288281ddd13199ba7fcde Mon Sep 17 00:00:00 2001 -From: Nick Schermer -Date: Fri, 26 Apr 2013 19:46:29 +0200 -Subject: Use the async spawn function of glib. - ---- - xfce4-session/xfsm-startup.c | 45 +++++++++++++++----------------------------- - 1 file changed, 15 insertions(+), 30 deletions(-) - -diff --git a/xfce4-session/xfsm-startup.c b/xfce4-session/xfsm-startup.c -index 911eec6..e43c53c 100644 ---- a/xfce4-session/xfsm-startup.c -+++ b/xfce4-session/xfsm-startup.c -@@ -864,6 +864,7 @@ xfsm_startup_start_properties (XfsmProperties *properties, - gint n; - const gchar *current_directory; - GPid pid; -+ GError *error = NULL; - - /* release any possible old resources related to a previous startup */ - xfsm_properties_set_default_child_watch (properties); -@@ -878,44 +879,28 @@ xfsm_startup_start_properties (XfsmProperties *properties, - - current_directory = xfsm_properties_get_string (properties, SmCurrentDirectory); - -- /* fork a new process for the application */ --#ifdef HAVE_VFORK -- /* vfork() doesn't allow you to do anything but call exec*() or _exit(), -- * so if we need to set the working directory, we can't use vfork() */ -- if (current_directory == NULL) -- pid = vfork (); -- else --#endif -- pid = fork (); -- -- /* handle the child process */ -- if (pid == 0) -+ if (!g_spawn_async (current_directory, -+ argv, NULL, -+ G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_SEARCH_PATH, -+ NULL, NULL, -+ &pid, &error)) - { -- /* execute the application here */ -- if (current_directory) -- { -- if (chdir (current_directory)) -- g_warning ("Unable to chdir to \"%s\": %s", current_directory, strerror (errno)); -- } -- execvp (argv[0], argv); -- _exit (127); -- } -- -- /* cleanup */ -- g_strfreev (argv); -+ g_warning ("Unable to launch \"%s\": %s", -+ *argv, error->message); -+ g_error_free (error); -+ g_strfreev (argv); - -- /* check if we failed to fork */ -- if (G_UNLIKELY (pid < 0)) -- { -- /* tell the user that we failed to fork */ -- perror ("Failed to fork new process"); - return FALSE; - } - -+ xfsm_verbose ("Launched command \"%s\" with PID %dn", *argv, (gint) pid); -+ -+ g_strfreev (argv); -+ - properties->pid = pid; - - /* set a watch to make sure the child doesn't quit before registering */ -- child_watch_data = g_new (XfsmStartupData, 1); -+ child_watch_data = g_new0 (XfsmStartupData, 1); - child_watch_data->manager = g_object_ref (manager); - child_watch_data->properties = properties; - g_child_watch_add_full (G_PRIORITY_LOW, properties->pid, --- -1.8.1 - diff --git a/0002-Store-the-watch-function-id-to-avoid-possible-double.patch b/0002-Store-the-watch-function-id-to-avoid-possible-double.patch deleted file mode 100644 index 7b43f79..0000000 --- a/0002-Store-the-watch-function-id-to-avoid-possible-double.patch +++ /dev/null @@ -1,31 +0,0 @@ -From ab391138cacc62ab184a338e237c4430356b41f9 Mon Sep 17 00:00:00 2001 -From: Nick Schermer -Date: Fri, 26 Apr 2013 20:05:10 +0200 -Subject: Store the watch function id to avoid possible double free (bug - #9709). - ---- - xfce4-session/xfsm-startup.c | 7 ++++--- - 1 file changed, 4 insertions(+), 3 deletions(-) - -diff --git a/xfce4-session/xfsm-startup.c b/xfce4-session/xfsm-startup.c -index e43c53c..c621397 100644 ---- a/xfce4-session/xfsm-startup.c -+++ b/xfce4-session/xfsm-startup.c -@@ -903,9 +903,10 @@ xfsm_startup_start_properties (XfsmProperties *properties, - child_watch_data = g_new0 (XfsmStartupData, 1); - child_watch_data->manager = g_object_ref (manager); - child_watch_data->properties = properties; -- g_child_watch_add_full (G_PRIORITY_LOW, properties->pid, -- xfsm_startup_child_watch, child_watch_data, -- (GDestroyNotify) xfsm_startup_data_free); -+ child_watch_data->properties->child_watch_id = -+ g_child_watch_add_full (G_PRIORITY_LOW, properties->pid, -+ xfsm_startup_child_watch, child_watch_data, -+ (GDestroyNotify) xfsm_startup_data_free); - - /* set a timeout -- client must register in a a certain amount of time - * or it's assumed to be broken/have issues. */ --- -1.8.1 - diff --git a/am.patch b/am.patch deleted file mode 100644 index 49c6580..0000000 --- a/am.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- xfce4-session-4.10.0/configure.in~ 2013-04-18 22:17:37.012003694 +0200 -+++ xfce4-session-4.10.0/configure.in 2013-04-18 22:18:04.065592886 +0200 -@@ -33,7 +33,7 @@ - - dnl Initialize automake - AM_INIT_AUTOMAKE([AC_PACKAGE_TARNAME()], [AC_PACKAGE_VERSION()]) --AM_CONFIG_HEADER([config.h]) -+AC_CONFIG_HEADERS([config.h]) - AM_MAINTAINER_MODE() - m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) - diff --git a/xfce4-session-add-systemd-support.patch b/xfce4-session-add-systemd-support.patch deleted file mode 100644 index 75eb6c0..0000000 --- a/xfce4-session-add-systemd-support.patch +++ /dev/null @@ -1,393 +0,0 @@ -diff -up xfce4-session-4.10.0/configure.in.systemd xfce4-session-4.10.0/configure.in ---- xfce4-session-4.10.0/configure.in.systemd 2012-04-28 15:43:29.000000000 -0500 -+++ xfce4-session-4.10.0/configure.in 2013-03-29 14:29:28.468230742 -0500 -@@ -101,6 +101,33 @@ XDT_CHECK_PACKAGE([DBUS], [dbus-1], [1.1 - XDT_CHECK_PACKAGE([DBUS_GLIB], [dbus-glib-1], [0.84]) - XDT_CHECK_PACKAGE([XFCONF], [libxfconf-0], [4.9.0]) - -+dnl systemd integration -+AC_ARG_ENABLE([systemd], -+ AS_HELP_STRING([--enable-systemd], [Use systemd]), -+ [with_systemd=$enableval], -+ [with_systemd=auto]) -+PKG_CHECK_MODULES(SYSTEMD, -+ [libsystemd-daemon libsystemd-login polkit-gobject-1], -+ [have_systemd=yes], [have_systemd=no]) -+AC_MSG_CHECKING([whether to use systemd]) -+if test x$with_systemd = xauto ; then -+ if test x$have_systemd = xno ; then -+ with_systemd=no -+ else -+ with_systemd=yes -+ fi -+fi -+AC_MSG_RESULT($with_systemd) -+if test x$with_systemd = xyes; then -+ if test x$have_systemd = xno; then -+ AC_MSG_ERROR([Systemd support explicitly required, but systemd not found]) -+ fi -+ AC_DEFINE(HAVE_SYSTEMD, 1, [Define if systemd is used for session tracking]) -+fi -+AC_SUBST(SYSTEMD_CFLAGS) -+AC_SUBST(SYSTEMD_LIBS) -+AM_CONDITIONAL(WITH_SYSTEMD, [test "$with_systemd" = "yes"], [Using systemd]) -+ - dnl Check for gnome support - XDT_CHECK_OPTIONAL_PACKAGE([GNOME_KEYRING], [gnome-keyring-1], [2.22], - [libgnome-keyring], -diff -up xfce4-session-4.10.0/xfce4-session/Makefile.am.systemd xfce4-session-4.10.0/xfce4-session/Makefile.am ---- xfce4-session-4.10.0/xfce4-session/Makefile.am.systemd 2012-04-28 15:43:27.000000000 -0500 -+++ xfce4-session-4.10.0/xfce4-session/Makefile.am 2013-03-29 14:29:28.468230742 -0500 -@@ -65,6 +63,12 @@ xfce4_session_SOURCES = \ - xfsm-upower.c \ - xfsm-upower.h - -+if WITH_SYSTEMD -+xfce4_session_SOURCES += \ -+ xfsm-systemd.c \ -+ xfsm-systemd.h -+endif -+ - xfce4_session_CFLAGS = \ - $(GNOME_KEYRING_CFLAGS) \ - $(LIBSM_CFLAGS) \ -@@ -73,6 +81,7 @@ xfce4_session_CFLAGS = \ - $(DBUS_CFLAGS) \ - $(DBUS_GLIB_CFLAGS) \ - $(LIBWNCK_CFLAGS) \ -+ $(SYSTEMD_CFLAGS) \ - $(XFCONF_CFLAGS) \ - $(GMODULE_CFLAGS) \ - $(PLATFORM_CFLAGS) -@@ -92,6 +101,7 @@ xfce4_session_LDADD = \ - $(DBUS_LIBS) \ - $(DBUS_GLIB_LIBS) \ - $(LIBWNCK_LIBS) \ -+ $(SYSTEMD_LIBS) \ - $(XFCONF_LIBS) \ - $(GNOME_KEYRING_LIBS) \ - -lm -diff -up xfce4-session-4.10.0/xfce4-session/xfsm-shutdown.c.systemd xfce4-session-4.10.0/xfce4-session/xfsm-shutdown.c ---- xfce4-session-4.10.0/xfce4-session/xfsm-shutdown.c.systemd 2012-04-28 15:43:27.000000000 -0500 -+++ xfce4-session-4.10.0/xfce4-session/xfsm-shutdown.c 2013-03-29 14:34:40.377331342 -0500 -@@ -66,7 +66,10 @@ - #include - #include - -- -+#ifdef HAVE_SYSTEMD -+#include -+#include -+#endif - - static void xfsm_shutdown_finalize (GObject *object); - static void xfsm_shutdown_sudo_free (XfsmShutdown *shutdown); -@@ -93,6 +96,9 @@ struct _XfsmShutdown - GObject __parent__; - - XfsmConsolekit *consolekit; -+#ifdef HAVE_SYSTEMD -+ SystemdProxy *systemd_proxy; -+#endif - XfsmUPower *upower; - - /* kiosk settings */ -@@ -130,6 +137,12 @@ xfsm_shutdown_init (XfsmShutdown *shutdown) - { - XfceKiosk *kiosk; - -+#ifdef HAVE_SYSTEMD -+ shutdown->systemd_proxy = NULL; -+ if (sd_booted() > 0) -+ shutdown->systemd_proxy = systemd_proxy_new (); -+ else -+#endif - shutdown->consolekit = xfsm_consolekit_get (); - shutdown->upower = xfsm_upower_get (); - shutdown->helper_state = SUDO_NOT_INITIAZED; -@@ -150,6 +160,11 @@ xfsm_shutdown_finalize (GObject *object) - { - XfsmShutdown *shutdown = XFSM_SHUTDOWN (object); - -+#ifdef HAVE_SYSTEMD -+ if (shutdown->systemd_proxy) -+ systemd_proxy_free (shutdown->systemd_proxy); -+ else -+#endif - g_object_unref (G_OBJECT (shutdown->consolekit)); - g_object_unref (G_OBJECT (shutdown->upower)); - -@@ -641,6 +655,11 @@ xfsm_shutdown_try_restart (XfsmShutdown - if (shutdown->helper_state == SUDO_AVAILABLE) - return xfsm_shutdown_sudo_try_action (shutdown, XFSM_SHUTDOWN_RESTART, error); - else -+#ifdef HAVE_SYSTEMD -+ if (shutdown->systemd_proxy) -+ return systemd_proxy_restart (shutdown->systemd_proxy, error); -+ else -+#endif - return xfsm_consolekit_try_restart (shutdown->consolekit, error); - } - -@@ -658,6 +676,11 @@ xfsm_shutdown_try_shutdown (XfsmShutdown - if (shutdown->helper_state == SUDO_AVAILABLE) - return xfsm_shutdown_sudo_try_action (shutdown, XFSM_SHUTDOWN_SHUTDOWN, error); - else -+#ifdef HAVE_SYSTEMD -+ if (shutdown->systemd_proxy) -+ return systemd_proxy_shutdown (shutdown->systemd_proxy, error); -+ else -+#endif - return xfsm_consolekit_try_shutdown (shutdown->consolekit, error); - } - -@@ -669,6 +691,11 @@ xfsm_shutdown_try_suspend (XfsmShutdown - { - g_return_val_if_fail (XFSM_IS_SHUTDOWN (shutdown), FALSE); - -+#ifdef HAVE_SYSTEMD -+ if (shutdown->systemd_proxy) -+ return systemd_proxy_suspend (shutdown->systemd_proxy, error); -+ else -+#endif - return xfsm_upower_try_suspend (shutdown->upower, error); - } - -@@ -680,6 +706,11 @@ xfsm_shutdown_try_hibernate (XfsmShutdow - { - g_return_val_if_fail (XFSM_IS_SHUTDOWN (shutdown), FALSE); - -+#ifdef HAVE_SYSTEMD -+ if (shutdown->systemd_proxy) -+ return systemd_proxy_hibernate (shutdown->systemd_proxy, error); -+ else -+#endif - return xfsm_upower_try_hibernate (shutdown->upower, error); - } - -@@ -697,6 +727,12 @@ xfsm_shutdown_can_restart (XfsmShutdown - return TRUE; - } - -+#ifdef HAVE_SYSTEMD -+ if (shutdown->systemd_proxy) { -+ if (systemd_proxy_can_restart (shutdown->systemd_proxy, can_restart, error)) -+ return TRUE; -+ } else -+#endif - if (xfsm_consolekit_can_restart (shutdown->consolekit, can_restart, error)) - return TRUE; - -@@ -724,6 +757,12 @@ xfsm_shutdown_can_shutdown (XfsmShutdown - return TRUE; - } - -+#ifdef HAVE_SYSTEMD -+ if (shutdown->systemd_proxy) { -+ if (systemd_proxy_can_shutdown (shutdown->systemd_proxy, can_shutdown, error)) -+ return TRUE; -+ } else -+#endif - if (xfsm_consolekit_can_shutdown (shutdown->consolekit, can_shutdown, error)) - return TRUE; - -diff -up xfce4-session-4.10.0/xfce4-session/xfsm-systemd.c.systemd xfce4-session-4.10.0/xfce4-session/xfsm-systemd.c ---- xfce4-session-4.10.0/xfce4-session/xfsm-systemd.c.systemd 2013-03-29 14:29:28.469230730 -0500 -+++ xfce4-session-4.10.0/xfce4-session/xfsm-systemd.c 2013-03-29 14:39:52.551428628 -0500 -@@ -0,0 +1,146 @@ -+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- -+ * -+ * Copyright (C) 2012 Christian Hesse -+ * -+ * Licensed under the GNU General Public License Version 2 -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -+ */ -+ -+#include -+ -+#include -+#include -+ -+#include "xfsm-systemd.h" -+ -+#define SYSTEMD_DBUS_NAME "org.freedesktop.login1" -+#define SYSTEMD_DBUS_PATH "/org/freedesktop/login1" -+#define SYSTEMD_DBUS_INTERFACE "org.freedesktop.login1.Manager" -+#define SYSTEMD_REBOOT_ACTION "org.freedesktop.login1.reboot" -+#define SYSTEMD_SHUTDOWN_ACTION "org.freedesktop.login1.power-off" -+#define SYSTEMD_SUSPEND_ACTION "org.freedesktop.login1.suspend" -+#define SYSTEMD_HIBERNATE_ACTION "org.freedesktop.login1.hibernate" -+ -+struct _SystemdProxy { -+ PolkitAuthority *authority; -+ PolkitSubject *subject; -+}; -+ -+SystemdProxy * -+systemd_proxy_new (void) -+{ -+ SystemdProxy *proxy; -+ -+ proxy = g_new0 (SystemdProxy, 1); -+ -+ proxy->authority = polkit_authority_get_sync (NULL, NULL); -+ proxy->subject = polkit_unix_process_new (getpid()); -+ -+ return proxy; -+} -+ -+void -+systemd_proxy_free (SystemdProxy *proxy) -+{ -+ g_object_unref (proxy->authority); -+ g_object_unref (proxy->subject); -+ -+ g_free (proxy); -+} -+ -+gboolean systemd_proxy_can_method (SystemdProxy *proxy, gboolean *can_method, const gchar *method, GError **error) -+{ -+ PolkitAuthorizationResult *res; -+ GError *local_error = NULL; -+ -+ *can_method = FALSE; -+ res = polkit_authority_check_authorization_sync (proxy->authority, -+ proxy->subject, -+ method, -+ NULL, -+ POLKIT_CHECK_AUTHORIZATION_FLAGS_NONE, -+ NULL, -+ &local_error); -+ if (res == NULL) { -+ g_propagate_error (error, local_error); -+ return FALSE; -+ } -+ -+ *can_method = polkit_authorization_result_get_is_authorized (res) || -+ polkit_authorization_result_get_is_challenge (res); -+ -+ g_object_unref (res); -+ -+ return TRUE; -+} -+ -+gboolean systemd_proxy_can_restart (SystemdProxy *proxy, gboolean *can_restart, GError **error) -+{ -+ return systemd_proxy_can_method(proxy, can_restart, SYSTEMD_REBOOT_ACTION, error); -+} -+ -+gboolean systemd_proxy_can_shutdown (SystemdProxy *proxy, gboolean *can_shutdown, GError **error) -+{ -+ return systemd_proxy_can_method(proxy, can_shutdown, SYSTEMD_SHUTDOWN_ACTION, error); -+} -+ -+gboolean systemd_proxy_can_suspend (SystemdProxy *proxy, gboolean *can_suspend, GError **error) -+{ -+ return systemd_proxy_can_method(proxy, can_suspend, SYSTEMD_SUSPEND_ACTION, error); -+} -+ -+gboolean systemd_proxy_can_hibernate (SystemdProxy *proxy, gboolean *can_hibernate, GError **error) -+{ -+ return systemd_proxy_can_method(proxy, can_hibernate, SYSTEMD_HIBERNATE_ACTION, error); -+} -+ -+gboolean systemd_proxy_method (SystemdProxy *proxy, const gchar *method, GError **error) -+{ -+ GDBusConnection *bus; -+ -+ bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, NULL); -+ g_dbus_connection_call_sync (bus, -+ SYSTEMD_DBUS_NAME, -+ SYSTEMD_DBUS_PATH, -+ SYSTEMD_DBUS_INTERFACE, -+ method, -+ g_variant_new ("(b)", TRUE), -+ NULL, 0, G_MAXINT, NULL, NULL); -+ g_object_unref (bus); -+ -+ return TRUE; -+} -+ -+gboolean systemd_proxy_restart (SystemdProxy *proxy, GError **error) -+{ -+ return systemd_proxy_method(proxy, "Reboot", error); -+} -+ -+gboolean systemd_proxy_shutdown (SystemdProxy *proxy, GError **error) -+{ -+ return systemd_proxy_method(proxy, "PowerOff", error); -+} -+ -+gboolean systemd_proxy_suspend (SystemdProxy *proxy, GError **error) -+{ -+ return systemd_proxy_method(proxy, "Suspend", error); -+} -+ -+gboolean systemd_proxy_hibernate (SystemdProxy *proxy, GError **error) -+{ -+ return systemd_proxy_method(proxy, "Hibernate", error); -+} -+ -diff -up xfce4-session-4.10.0/xfce4-session/xfsm-systemd.h.systemd xfce4-session-4.10.0/xfce4-session/xfsm-systemd.h ---- xfce4-session-4.10.0/xfce4-session/xfsm-systemd.h.systemd 2013-03-29 14:29:28.469230730 -0500 -+++ xfce4-session-4.10.0/xfce4-session/xfsm-systemd.h 2013-03-29 14:35:54.549404063 -0500 -@@ -0,0 +1,46 @@ -+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- -+ * -+ * Copyright (C) 2012 Christian Hesse -+ * -+ * Licensed under the GNU General Public License Version 2 -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -+ */ -+ -+#ifndef __SYSTEMD_PROXY_H__ -+#define __SYSTEMD_PROXY_H__ -+ -+#include -+ -+G_BEGIN_DECLS -+ -+typedef struct _SystemdProxy SystemdProxy; -+ -+SystemdProxy *systemd_proxy_new (void); -+void systemd_proxy_free (SystemdProxy *proxy); -+gboolean systemd_proxy_can_method (SystemdProxy *proxy, gboolean *can_method, const char *method, GError **error); -+gboolean systemd_proxy_can_restart (SystemdProxy *proxy, gboolean *can_restart, GError **error); -+gboolean systemd_proxy_can_shutdown (SystemdProxy *proxy, gboolean *can_shutdown, GError **error); -+gboolean systemd_proxy_can_suspend (SystemdProxy *proxy, gboolean *can_suspend, GError **error); -+gboolean systemd_proxy_can_hibernate (SystemdProxy *proxy, gboolean *can_hibernate, GError **error); -+gboolean systemd_proxy_method (SystemdProxy *proxy, const char *method, GError **error); -+gboolean systemd_proxy_restart (SystemdProxy *proxy, GError **error); -+gboolean systemd_proxy_shutdown (SystemdProxy *proxy, GError **error); -+gboolean systemd_proxy_suspend (SystemdProxy *proxy, GError **error); -+gboolean systemd_proxy_hibernate (SystemdProxy *proxy, GError **error); -+ -+G_END_DECLS -+ -+#endif /* __SYSTEMD_PROXY_H__ */ diff --git a/xfce4-session-session-save.patch b/xfce4-session-session-save.patch deleted file mode 100644 index 9e6d945..0000000 --- a/xfce4-session-session-save.patch +++ /dev/null @@ -1,147 +0,0 @@ -From 9f3077be682355e1cd07e9a9463e76307292208c Mon Sep 17 00:00:00 2001 -From: Dimitar Zhekov -Date: Thu, 30 Aug 2012 20:52:14 +0000 -Subject: Handle multiple interactive session save (bug #5379). - -Additionnaly, we now use SmSaveGlobal on log out / shutdown without -session save which avoids data loss. Previously clients would not save -anything on log out without session save. - -Based on original work by Chris Bainbridge (chris.bainbridge@gmail.com). ---- -diff --git a/xfce4-session/xfsm-manager.c b/xfce4-session/xfsm-manager.c -index bf6a446..35811c5 100644 ---- a/xfce4-session/xfsm-manager.c -+++ b/xfce4-session/xfsm-manager.c -@@ -98,6 +98,7 @@ struct _XfsmManager - - XfsmShutdownType shutdown_type; - XfsmShutdown *shutdown_helper; -+ gboolean save_session; - - gboolean session_chooser; - gchar *session_name; -@@ -230,6 +231,7 @@ xfsm_manager_init (XfsmManager *manager) - manager->failsafe_mode = TRUE; - manager->shutdown_type = XFSM_SHUTDOWN_LOGOUT; - manager->shutdown_helper = xfsm_shutdown_get (); -+ manager->save_session = TRUE; - - manager->pending_properties = g_queue_new (); - manager->starting_properties = g_queue_new (); -@@ -989,7 +991,9 @@ xfsm_manager_interact (XfsmManager *manager, - XfsmClient *cl = lp->data; - if (xfsm_client_get_state (cl) == XFSM_CLIENT_INTERACTING) - { -- xfsm_client_set_state (cl, XFSM_CLIENT_WAITFORINTERACT); -+ /* a client is already interacting, so new client has to wait */ -+ xfsm_client_set_state (client, XFSM_CLIENT_WAITFORINTERACT); -+ xfsm_manager_cancel_client_save_timeout(manager, client); - return; - } - } -@@ -1138,44 +1142,47 @@ xfsm_manager_save_yourself_global (XfsmManager *manager, - } - } - -- if (!shutdown || shutdown_save) -+ /* don't save the session if shutting down without save */ -+ manager->save_session = !shutdown || shutdown_save; -+ -+ if (save_type == SmSaveBoth && !manager->save_session) - { -- xfsm_manager_set_state (manager, -- shutdown -- ? XFSM_MANAGER_SHUTDOWN -- : XFSM_MANAGER_CHECKPOINT); -+ /* saving the session, so clients should -+ * (prompt to) save the user data only */ -+ save_type = SmSaveGlobal; -+ } - -- /* handle legacy applications first! */ -- xfsm_legacy_perform_session_save (); -+ xfsm_manager_set_state (manager, -+ shutdown -+ ? XFSM_MANAGER_SHUTDOWN -+ : XFSM_MANAGER_CHECKPOINT); - -- for (lp = g_queue_peek_nth_link (manager->running_clients, 0); -- lp; -- lp = lp->next) -- { -- XfsmClient *client = lp->data; -- XfsmProperties *properties = xfsm_client_get_properties (client); -- const gchar *program; -+ /* handle legacy applications first! */ -+ if (manager->save_session) -+ xfsm_legacy_perform_session_save (); - -- /* xterm's session management is broken, so we won't -- * send a SAVE YOURSELF to xterms */ -- program = xfsm_properties_get_string (properties, SmProgram); -- if (program != NULL && strcasecmp (program, "xterm") == 0) -- continue; -+ for (lp = g_queue_peek_nth_link (manager->running_clients, 0); -+ lp; -+ lp = lp->next) -+ { -+ XfsmClient *client = lp->data; -+ XfsmProperties *properties = xfsm_client_get_properties (client); -+ const gchar *program; - -- if (xfsm_client_get_state (client) != XFSM_CLIENT_SAVINGLOCAL) -- { -- SmsSaveYourself (xfsm_client_get_sms_connection (client), save_type, shutdown, -- interact_style, fast); -- } -+ /* xterm's session management is broken, so we won't -+ * send a SAVE YOURSELF to xterms */ -+ program = xfsm_properties_get_string (properties, SmProgram); -+ if (program != NULL && strcasecmp (program, "xterm") == 0) -+ continue; - -- xfsm_client_set_state (client, XFSM_CLIENT_SAVING); -- xfsm_manager_start_client_save_timeout (manager, client); -+ if (xfsm_client_get_state (client) != XFSM_CLIENT_SAVINGLOCAL) -+ { -+ SmsSaveYourself (xfsm_client_get_sms_connection (client), save_type, shutdown, -+ interact_style, fast); - } -- } -- else -- { -- /* shutdown session without saving */ -- xfsm_manager_perform_shutdown (manager); -+ -+ xfsm_client_set_state (client, XFSM_CLIENT_SAVING); -+ xfsm_manager_start_client_save_timeout (manager, client); - } - } - -@@ -1249,7 +1256,12 @@ xfsm_manager_save_yourself_done (XfsmManager *manager, - XfsmClient *client, - gboolean success) - { -- if (xfsm_client_get_state (client) != XFSM_CLIENT_SAVING && xfsm_client_get_state (client) != XFSM_CLIENT_SAVINGLOCAL) -+ /* In xfsm_manager_interact_done we send SmsShutdownCancelled to clients in -+ XFSM_CLIENT_WAITFORINTERACT state. They respond with SmcSaveYourselfDone -+ (xsmp_shutdown_cancelled in libxfce4ui library) so we allow it here. */ -+ if (xfsm_client_get_state (client) != XFSM_CLIENT_SAVING && -+ xfsm_client_get_state (client) != XFSM_CLIENT_SAVINGLOCAL && -+ xfsm_client_get_state (client) != XFSM_CLIENT_WAITFORINTERACT) - { - xfsm_verbose ("Client Id = %s send SAVE YOURSELF DONE, while not being " - "in save mode. Prepare to be nuked!\n", -@@ -1521,7 +1533,8 @@ xfsm_manager_complete_saveyourself (XfsmManager *manager) - xfsm_verbose ("Manager finished SAVE YOURSELF, session data will be stored now.\n\n"); - - /* all clients done, store session data */ -- xfsm_manager_store_session (manager); -+ if (manager->save_session) -+ xfsm_manager_store_session (manager); - - if (manager->state == XFSM_MANAGER_CHECKPOINT) - { --- -cgit v0.9.0.3 diff --git a/xfce4-session-systemd-suspend-hibernate-support.patch b/xfce4-session-systemd-suspend-hibernate-support.patch new file mode 100644 index 0000000..08ea4c6 --- /dev/null +++ b/xfce4-session-systemd-suspend-hibernate-support.patch @@ -0,0 +1,390 @@ +Index: xfce4-session-4.10.1/configure.ac +=================================================================== +--- xfce4-session-4.10.1.orig/configure.ac ++++ xfce4-session-4.10.1/configure.ac +@@ -103,7 +103,7 @@ XDT_CHECK_PACKAGE([XFCONF], [libxfconf-0 + + dnl Check for polkit / systemd integration + XDT_CHECK_OPTIONAL_PACKAGE([SYSTEMD], [polkit-gobject-1], [0.100], +- [systemd], [Systemd support (through polit)]) ++ [systemd], [Systemd support (through polkit)]) + + dnl Check for debugging support + XDT_FEATURE_DEBUG([xfsm_debug_default]) +@@ -207,10 +207,10 @@ echo " * Legacy session management: + else + echo " * Legacy session management: no" + fi +-if test x"$GNOME_KEYRING_FOUND" = x"yes"; then +-echo " * Gnome Keyring support: yes" ++if test x"$SYSTEMD_FOUND" = x"yes"; then ++echo " * Systemd support (through polkit): yes" + else +-echo " * Gnome Keyring support: no" ++echo " * Systemd support (through polkit): no" + fi + + echo +Index: xfce4-session-4.10.1/xfce4-session/Makefile.am +=================================================================== +--- xfce4-session-4.10.1.orig/xfce4-session/Makefile.am ++++ xfce4-session-4.10.1/xfce4-session/Makefile.am +@@ -38,6 +38,8 @@ xfce4_session_SOURCES = \ + xfsm-compat-gnome.h \ + xfsm-compat-kde.c \ + xfsm-compat-kde.h \ ++ xfsm-consolekit.c \ ++ xfsm-consolekit.h \ + xfsm-dns.c \ + xfsm-dns.h \ + xfsm-error.c \ +@@ -67,10 +69,6 @@ if HAVE_SYSTEMD + xfce4_session_SOURCES += \ + xfsm-systemd.c \ + xfsm-systemd.h +-else +-xfce4_session_SOURCES += \ +- xfsm-consolekit.c \ +- xfsm-consolekit.h + endif + + xfce4_session_CFLAGS = \ +Index: xfce4-session-4.10.1/xfce4-session/xfsm-systemd.c +=================================================================== +--- xfce4-session-4.10.1.orig/xfce4-session/xfsm-systemd.c ++++ xfce4-session-4.10.1/xfce4-session/xfsm-systemd.c +@@ -24,6 +24,7 @@ + #include + #include + ++#include + #include + + +@@ -33,8 +34,12 @@ + #define SYSTEMD_DBUS_INTERFACE "org.freedesktop.login1.Manager" + #define SYSTEMD_REBOOT_ACTION "Reboot" + #define SYSTEMD_POWEROFF_ACTION "PowerOff" ++#define SYSTEMD_SUSPEND_ACTION "Suspend" ++#define SYSTEMD_HIBERNATE_ACTION "Hibernate" + #define SYSTEMD_REBOOT_TEST "org.freedesktop.login1.reboot" + #define SYSTEMD_POWEROFF_TEST "org.freedesktop.login1.power-off" ++#define SYSTEMD_SUSPEND_TEST "org.freedesktop.login1.suspend" ++#define SYSTEMD_HIBERNATE_TEST "org.freedesktop.login1.hibernate" + + + +@@ -93,6 +98,22 @@ xfsm_systemd_finalize (GObject *object) + } + + ++ ++static gboolean ++xfsm_systemd_lock_screen (GError **error) ++{ ++ XfconfChannel *channel; ++ gboolean ret = TRUE; ++ ++ channel = xfsm_open_config (); ++ if (xfconf_channel_get_bool (channel, "/shutdown/LockScreen", FALSE)) ++ ret = g_spawn_command_line_async ("xflock4", error); ++ ++ return ret; ++} ++ ++ ++ + static gboolean + xfsm_systemd_can_method (XfsmSystemd *systemd, + gboolean *can_method, +@@ -205,6 +226,34 @@ xfsm_systemd_try_shutdown (XfsmSystemd + + + gboolean ++xfsm_systemd_try_suspend (XfsmSystemd *systemd, ++ GError **error) ++{ ++ if (!xfsm_systemd_lock_screen (error)) ++ return FALSE; ++ ++ return xfsm_systemd_try_method (systemd, ++ SYSTEMD_SUSPEND_ACTION, ++ error); ++} ++ ++ ++ ++gboolean ++xfsm_systemd_try_hibernate (XfsmSystemd *systemd, ++ GError **error) ++{ ++ if (!xfsm_systemd_lock_screen (error)) ++ return FALSE; ++ ++ return xfsm_systemd_try_method (systemd, ++ SYSTEMD_HIBERNATE_ACTION, ++ error); ++} ++ ++ ++ ++gboolean + xfsm_systemd_can_restart (XfsmSystemd *systemd, + gboolean *can_restart, + GError **error) +@@ -227,3 +276,39 @@ xfsm_systemd_can_shutdown (XfsmSystemd + SYSTEMD_POWEROFF_TEST, + error); + } ++ ++ ++ ++gboolean ++xfsm_systemd_can_suspend (XfsmSystemd *systemd, ++ gboolean *can_suspend, ++ gboolean *auth_suspend, ++ GError **error) ++{ ++ gboolean ret = FALSE; ++ ++ ret = xfsm_systemd_can_method (systemd, ++ can_suspend, ++ SYSTEMD_SUSPEND_TEST, ++ error); ++ *auth_suspend = *can_suspend; ++ return ret; ++} ++ ++ ++ ++gboolean ++xfsm_systemd_can_hibernate (XfsmSystemd *systemd, ++ gboolean *can_hibernate, ++ gboolean *auth_hibernate, ++ GError **error) ++{ ++ gboolean ret = FALSE; ++ ++ ret = xfsm_systemd_can_method (systemd, ++ can_hibernate, ++ SYSTEMD_HIBERNATE_TEST, ++ error); ++ *auth_hibernate = *can_hibernate; ++ return ret; ++} +Index: xfce4-session-4.10.1/xfce4-session/xfsm-systemd.h +=================================================================== +--- xfce4-session-4.10.1.orig/xfce4-session/xfsm-systemd.h ++++ xfce4-session-4.10.1/xfce4-session/xfsm-systemd.h +@@ -42,6 +42,12 @@ gboolean xfsm_systemd_try_restart ( + gboolean xfsm_systemd_try_shutdown (XfsmSystemd *systemd, + GError **error); + ++gboolean xfsm_systemd_try_suspend (XfsmSystemd *systemd, ++ GError **error); ++ ++gboolean xfsm_systemd_try_hibernate (XfsmSystemd *systemd, ++ GError **error); ++ + gboolean xfsm_systemd_can_restart (XfsmSystemd *systemd, + gboolean *can_restart, + GError **error); +@@ -50,6 +56,16 @@ gboolean xfsm_systemd_can_shutdown ( + gboolean *can_shutdown, + GError **error); + ++gboolean xfsm_systemd_can_suspend (XfsmSystemd *systemd, ++ gboolean *can_suspend, ++ gboolean *auth_suspend, ++ GError **error); ++ ++gboolean xfsm_systemd_can_hibernate (XfsmSystemd *systemd, ++ gboolean *can_hibernate, ++ gboolean *auth_hibernate, ++ GError **error); ++ + G_END_DECLS + + #endif /* __XFSM_SYSTEMD_H__ */ +Index: xfce4-session-4.10.1/xfce4-session/xfsm-shutdown.c +=================================================================== +--- xfce4-session-4.10.1.orig/xfce4-session/xfsm-shutdown.c ++++ xfce4-session-4.10.1/xfce4-session/xfsm-shutdown.c +@@ -63,15 +63,15 @@ + #include + #include + #include ++#include + #include + #include + #include + #include + + #ifdef HAVE_SYSTEMD ++#define LOGIND_RUNNING() (access ("/run/systemd/seats/", F_OK) >= 0) + #include +-#else +-#include + #endif + + static void xfsm_shutdown_finalize (GObject *object); +@@ -98,9 +98,8 @@ struct _XfsmShutdown + + #ifdef HAVE_SYSTEMD + XfsmSystemd *systemd; +-#else +- XfsmConsolekit *consolekit; + #endif ++ XfsmConsolekit *consolekit; + XfsmUPower *upower; + + /* kiosk settings */ +@@ -139,10 +138,14 @@ xfsm_shutdown_init (XfsmShutdown *shutdo + XfceKiosk *kiosk; + + #ifdef HAVE_SYSTEMD +- shutdown->systemd = xfsm_systemd_get (); +-#else +- shutdown->consolekit = xfsm_consolekit_get (); ++ shutdown->consolekit = NULL; ++ shutdown->systemd = NULL; ++ if (LOGIND_RUNNING()) ++ shutdown->systemd = xfsm_systemd_get (); ++ else + #endif ++ shutdown->consolekit = xfsm_consolekit_get (); ++ + shutdown->upower = xfsm_upower_get (); + shutdown->helper_state = SUDO_NOT_INITIAZED; + shutdown->helper_require_password = FALSE; +@@ -162,10 +165,11 @@ xfsm_shutdown_finalize (GObject *object) + XfsmShutdown *shutdown = XFSM_SHUTDOWN (object); + + #ifdef HAVE_SYSTEMD +- g_object_unref (G_OBJECT (shutdown->systemd)); +-#else +- g_object_unref (G_OBJECT (shutdown->consolekit)); ++ if (shutdown->systemd != NULL) ++ g_object_unref (G_OBJECT (shutdown->systemd)); + #endif ++ if (shutdown->consolekit != NULL) ++ g_object_unref (G_OBJECT (shutdown->consolekit)); + g_object_unref (G_OBJECT (shutdown->upower)); + + /* close down helper */ +@@ -657,10 +661,11 @@ xfsm_shutdown_try_restart (XfsmShutdown + return xfsm_shutdown_sudo_try_action (shutdown, XFSM_SHUTDOWN_RESTART, error); + else + #ifdef HAVE_SYSTEMD +- return xfsm_systemd_try_restart (shutdown->systemd, error); +-#else +- return xfsm_consolekit_try_restart (shutdown->consolekit, error); ++ if (LOGIND_RUNNING()) ++ return xfsm_systemd_try_restart (shutdown->systemd, error); ++ else + #endif ++ return xfsm_consolekit_try_restart (shutdown->consolekit, error); + } + + +@@ -678,10 +683,11 @@ xfsm_shutdown_try_shutdown (XfsmShutdown + return xfsm_shutdown_sudo_try_action (shutdown, XFSM_SHUTDOWN_SHUTDOWN, error); + else + #ifdef HAVE_SYSTEMD +- return xfsm_systemd_try_shutdown (shutdown->systemd, error); +-#else +- return xfsm_consolekit_try_shutdown (shutdown->consolekit, error); ++ if (LOGIND_RUNNING()) ++ return xfsm_systemd_try_shutdown (shutdown->systemd, error); ++ else + #endif ++ return xfsm_consolekit_try_shutdown (shutdown->consolekit, error); + } + + +@@ -692,6 +698,11 @@ xfsm_shutdown_try_suspend (XfsmShutdown + { + g_return_val_if_fail (XFSM_IS_SHUTDOWN (shutdown), FALSE); + ++#ifdef HAVE_SYSTEMD ++ if (LOGIND_RUNNING()) ++ return xfsm_systemd_try_suspend (shutdown->systemd, error); ++ else ++#endif + return xfsm_upower_try_suspend (shutdown->upower, error); + } + +@@ -703,6 +714,11 @@ xfsm_shutdown_try_hibernate (XfsmShutdow + { + g_return_val_if_fail (XFSM_IS_SHUTDOWN (shutdown), FALSE); + ++#ifdef HAVE_SYSTEMD ++ if (LOGIND_RUNNING()) ++ return xfsm_systemd_try_hibernate (shutdown->systemd, error); ++ else ++#endif + return xfsm_upower_try_hibernate (shutdown->upower, error); + } + +@@ -722,10 +738,14 @@ xfsm_shutdown_can_restart (XfsmShutdown + } + + #ifdef HAVE_SYSTEMD +- if (xfsm_systemd_can_restart (shutdown->systemd, can_restart, error)) +-#else +- if (xfsm_consolekit_can_restart (shutdown->consolekit, can_restart, error)) ++ if (LOGIND_RUNNING()) ++ { ++ if (xfsm_systemd_can_restart (shutdown->systemd, can_restart, error)) ++ return TRUE; ++ } ++ else + #endif ++ if (xfsm_consolekit_can_restart (shutdown->consolekit, can_restart, error)) + return TRUE; + + if (xfsm_shutdown_sudo_init (shutdown, error)) +@@ -753,10 +773,14 @@ xfsm_shutdown_can_shutdown (XfsmShutdown + } + + #ifdef HAVE_SYSTEMD +- if (xfsm_systemd_can_shutdown (shutdown->systemd, can_shutdown, error)) +-#else +- if (xfsm_consolekit_can_shutdown (shutdown->consolekit, can_shutdown, error)) ++ if (LOGIND_RUNNING()) ++ { ++ if (xfsm_systemd_can_shutdown (shutdown->systemd, can_shutdown, error)) ++ return TRUE; ++ } ++ else + #endif ++ if (xfsm_consolekit_can_shutdown (shutdown->consolekit, can_shutdown, error)) + return TRUE; + + if (xfsm_shutdown_sudo_init (shutdown, error)) +@@ -784,6 +808,12 @@ xfsm_shutdown_can_suspend (XfsmShutdown + return TRUE; + } + ++#ifdef HAVE_SYSTEMD ++ if (LOGIND_RUNNING()) ++ return xfsm_systemd_can_suspend (shutdown->systemd, can_suspend, ++ auth_suspend, error); ++ else ++#endif + return xfsm_upower_can_suspend (shutdown->upower, can_suspend, + auth_suspend, error); + } +@@ -804,6 +834,12 @@ xfsm_shutdown_can_hibernate (XfsmShutdow + return TRUE; + } + ++#ifdef HAVE_SYSTEMD ++ if (LOGIND_RUNNING()) ++ return xfsm_systemd_can_hibernate (shutdown->systemd, can_hibernate, ++ auth_hibernate, error); ++ else ++#endif + return xfsm_upower_can_hibernate (shutdown->upower, can_hibernate, + auth_hibernate, error); + } diff --git a/xfce4-session.spec b/xfce4-session.spec index d6d7986..9ca8829 100644 --- a/xfce4-session.spec +++ b/xfce4-session.spec @@ -2,26 +2,24 @@ # Conditional build: %bcond_with static_libs # don't build static library # +%define xfce_version 4.10.0 Summary: Xfce session manager Summary(pl.UTF-8): Zarządca sesji Xfce Name: xfce4-session -Version: 4.10.0 -Release: 7 +Version: 4.10.1 +Release: 1 License: GPL v2 Group: X11/Applications -Source0: http://archive.xfce.org/xfce/4.10/src/%{name}-%{version}.tar.bz2 -# Source0-md5: 4768e1a41a0287af6aad18b329a0f230 +Source0: http://archive.xfce.org/src/xfce/%{name}/4.10/%{name}-%{version}.tar.bz2 +# Source0-md5: 1757657c1d590aa6274b7b7cbba33352 Source1: http://www.blues.gda.pl/SOURCES/%{name}-ubuntu_icons.tar.bz2 # Source1-md5: bf19add3364c0b0d804a7490c1a1fcbe # taken from mate-polkit (GTK+2), license is LGPLv2+, requires because of # http://lists.fedoraproject.org/pipermail/devel-announce/2011-February/000758.html Source2: polkit-mate-authentication-agent-1.desktop Patch0: %{name}-ubuntu_icons.patch -Patch1: %{name}-session-save.patch -Patch2: %{name}-add-systemd-support.patch -Patch3: am.patch -Patch4: 0001-Use-the-async-spawn-function-of-glib.patch -Patch5: 0002-Store-the-watch-function-id-to-avoid-possible-double.patch +# be really, really carefull with this, it also makes systemd optional instead of default mandatory +Patch1: %{name}-systemd-suspend-hibernate-support.patch URL: http://www.xfce.org/projects/xfce4-session BuildRequires: autoconf >= 2.50 BuildRequires: automake @@ -32,14 +30,14 @@ BuildRequires: gtk+2-devel >= 2:2.14.0 BuildRequires: intltool >= 0.35.0 BuildRequires: libtool BuildRequires: libwnck2-devel >= 2.22.0 -BuildRequires: libxfce4ui-devel >= %{version} -BuildRequires: libxfce4util-devel >= %{version} +BuildRequires: libxfce4ui-devel >= %{xfce_version} +BuildRequires: libxfce4util-devel >= %{xfce_version} BuildRequires: pkgconfig BuildRequires: polkit-devel BuildRequires: rpmbuild(macros) >= 1.601 BuildRequires: systemd-devel -BuildRequires: xfce4-dev-tools >= 4.10.0 -BuildRequires: xfconf-devel >= %{version} +BuildRequires: xfce4-dev-tools >= %{xfce_version} +BuildRequires: xfconf-devel >= %{xfce_version} BuildRequires: xorg-lib-libSM-devel Requires: %{name}-libs = %{version}-%{release} Requires: gtk-update-icon-cache @@ -99,10 +97,6 @@ Statyczna biblioteka zarządcy sesji dla środowiska Xfce. %setup -q -a1 %patch0 -p1 %patch1 -p1 -%patch2 -p1 -%patch3 -p1 -%patch4 -p1 -%patch5 -p1 %build %{__intltoolize}