diff options
author | Samuli Suominen <ssuominen@gentoo.org> | 2010-09-09 12:35:56 +0000 |
---|---|---|
committer | Samuli Suominen <ssuominen@gentoo.org> | 2010-09-09 12:35:56 +0000 |
commit | 1ede0d2630af1db788cca0e2db80601d31606702 (patch) | |
tree | ce3f8732fb0eb27f8715388010d5b6f6acf22527 /xfce-base | |
parent | Don't run ck-launch-session from xinitrc because latest xfce4-session will st... (diff) | |
download | historical-1ede0d2630af1db788cca0e2db80601d31606702.tar.gz historical-1ede0d2630af1db788cca0e2db80601d31606702.tar.bz2 historical-1ede0d2630af1db788cca0e2db80601d31606702.zip |
Check for XDG_SESSION_COOKIE and run consolekit session if required (or reuse existing session).
Package-Manager: portage-2.2_rc75/cvs/Linux x86_64
Diffstat (limited to 'xfce-base')
-rw-r--r-- | xfce-base/xfce4-session/ChangeLog | 8 | ||||
-rw-r--r-- | xfce-base/xfce4-session/files/xfce4-session-4.7.0-ck-launch-session.patch | 209 | ||||
-rw-r--r-- | xfce-base/xfce4-session/xfce4-session-4.7.0.ebuild | 3 |
3 files changed, 218 insertions, 2 deletions
diff --git a/xfce-base/xfce4-session/ChangeLog b/xfce-base/xfce4-session/ChangeLog index 86aa082d9bb0..e1702f57932f 100644 --- a/xfce-base/xfce4-session/ChangeLog +++ b/xfce-base/xfce4-session/ChangeLog @@ -1,6 +1,12 @@ # ChangeLog for xfce-base/xfce4-session # Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/xfce-base/xfce4-session/ChangeLog,v 1.118 2010/09/06 17:25:13 ssuominen Exp $ +# $Header: /var/cvsroot/gentoo-x86/xfce-base/xfce4-session/ChangeLog,v 1.119 2010/09/09 12:35:56 ssuominen Exp $ + + 09 Sep 2010; Samuli Suominen <ssuominen@gentoo.org> + xfce4-session-4.7.0.ebuild, + +files/xfce4-session-4.7.0-ck-launch-session.patch: + Check for XDG_SESSION_COOKIE and run consolekit session if required (or + reuse existing session). 06 Sep 2010; Samuli Suominen <ssuominen@gentoo.org> xfce4-session-4.7.0.ebuild: diff --git a/xfce-base/xfce4-session/files/xfce4-session-4.7.0-ck-launch-session.patch b/xfce-base/xfce4-session/files/xfce4-session-4.7.0-ck-launch-session.patch new file mode 100644 index 000000000000..4f65e410793a --- /dev/null +++ b/xfce-base/xfce4-session/files/xfce4-session-4.7.0-ck-launch-session.patch @@ -0,0 +1,209 @@ +From 35c620aa3749581580e0917ff7c2db1c223564a8 Mon Sep 17 00:00:00 2001 +From: Jannis Pohlmann <jannis@xfce.org> +Date: Wed, 08 Sep 2010 10:02:46 +0000 +Subject: Reuse existing ConsoleKit sessions (bug #6685). + +According to the ConsoleKit documentation, only one session leader may +exist for a session. An application becomes the leader of a session by +calling org.freedesktop.ConsoleKit.Manager.OpenSession() which returns a +session identifier. This identifier is then made available to other +session clients by setting the XDG_SESSION_COOKIE environment variable. + +GDM and upstart open ConsoleKit sessions on their own and desktop +environments are supposed to reuse these sessions instead of opening new +ones. So with this commit, xfce4-session checks for XDG_SESSION_COOKIE +and, if it exists, does not try to call OpenSession in order to +overwrite this environment variable. + +I tested this with xfce4-session-logout which finally allows me to +reboot and shutdown again. + +Also fix the indentation, use spaces instead of tabs etc. +--- +diff --git a/xfce4-session/xfsm-manager.c b/xfce4-session/xfsm-manager.c +index 3eb7696..892b6c6 100644 +--- a/xfce4-session/xfsm-manager.c ++++ b/xfce4-session/xfsm-manager.c +@@ -257,11 +255,11 @@ xfsm_manager_init (XfsmManager *manager) + #ifdef ENABLE_CONSOLE_KIT + manager->system_bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error); + +- if ( G_LIKELY (manager->system_bus != NULL) ) ++ if (G_LIKELY (manager->system_bus != NULL)) + { + xfsm_manager_consolekit_init (manager); + } +- else if ( error ) ++ else if (error) + { + g_warning ("Failed to connect to the system bus : %s", error->message); + g_error_free (error); +@@ -279,7 +277,7 @@ xfsm_manager_finalize (GObject *obj) + #ifdef ENABLE_CONSOLE_KIT + xfsm_manager_consolekit_cleanup (manager); + +- if ( manager->system_bus ) ++ if (manager->system_bus) + dbus_g_connection_unref (manager->system_bus); + #endif /*ENABLE_CONSOLE_KIT*/ + +@@ -342,6 +340,7 @@ xfsm_manager_new (void) + return manager; + } + ++ + #ifdef ENABLE_CONSOLE_KIT + static void xfsm_manager_consolekit_init (XfsmManager *manager) + { +@@ -349,61 +348,83 @@ static void xfsm_manager_consolekit_init (XfsmManager *manager) + gboolean ret; + + manager->consolekit_proxy = dbus_g_proxy_new_for_name_owner (manager->system_bus, +- "org.freedesktop.ConsoleKit", +- "/org/freedesktop/ConsoleKit/Manager", +- "org.freedesktop.ConsoleKit.Manager", +- NULL); ++ "org.freedesktop.ConsoleKit", ++ "/org/freedesktop/ConsoleKit/Manager", ++ "org.freedesktop.ConsoleKit.Manager", ++ NULL); + + +- if ( G_UNLIKELY (!manager->consolekit_proxy) ) ++ if (G_UNLIKELY (!manager->consolekit_proxy)) + { + g_warning ("Failed to create proxy for 'org.freedesktop.ConsoleKit'"); + return; + } + +- ret = dbus_g_proxy_call (manager->consolekit_proxy, "OpenSession", &error, +- G_TYPE_INVALID, +- G_TYPE_STRING, &manager->consolekit_cookie, +- G_TYPE_INVALID); +- +- if ( G_LIKELY (ret) ) ++ /* check if there is a session to reuse */ ++ if (g_getenv ("XDG_SESSION_COOKIE") != NULL) + { +- /* +- * ConsoleKit doc says that the leader session should set the cookie +- * on XDG_SESSION_COOKIE env variable. +- */ +- g_warn_if_fail (g_setenv ("XDG_SESSION_COOKIE", +- manager->consolekit_cookie, +- TRUE)); ++#ifdef DEBUG ++ g_debug ("Reusing existing ConsoleKit session: XDG_SESSION_ID=%s", ++ g_getenv ("XDG_SESSION_COOKIE")); ++#endif + } +- else if ( error ) ++ else + { +- g_warning ("OpenSession on 'org.freedesktop.ConsoleKit' failed with %s", error->message); +- g_error_free (error); ++ /* try to open a new session. as its leader we are then responsible for ++ * setting XDG_SESSION_COOKIE as well as closing the session before we exit */ ++ ret = dbus_g_proxy_call (manager->consolekit_proxy, "OpenSession", &error, ++ G_TYPE_INVALID, ++ G_TYPE_STRING, &manager->consolekit_cookie, ++ G_TYPE_INVALID); ++ ++ if (G_LIKELY (ret)) ++ { ++ /* ++ * ConsoleKit doc says that the leader session should set the cookie ++ * on XDG_SESSION_COOKIE env variable. ++ */ ++ if (g_setenv ("XDG_SESSION_COOKIE", manager->consolekit_cookie, TRUE)) ++ { ++#ifdef DEBUG ++ g_debug ("Opening a new ConsoleKit session: XDG_SESSION_COOKIE=%s", ++ manager->consolekit_cookie); ++#endif ++ } ++ else ++ { ++ g_warning ("Failed to set XDG_SESSION_COOKIE"); ++ } ++ } ++ else if (error) ++ { ++ g_warning ("OpenSession on 'org.freedesktop.ConsoleKit' failed with %s", error->message); ++ g_error_free (error); ++ } + } + } + ++ + static void xfsm_manager_consolekit_cleanup (XfsmManager *manager) + { +- if ( manager->consolekit_proxy ) ++ GError *error = NULL; ++ gboolean ret, result; ++ ++ if (manager->consolekit_proxy) + { + if (manager->consolekit_cookie) +- { +- GError *error = NULL; +- gboolean ret, result; +- +- ret = dbus_g_proxy_call (manager->consolekit_proxy, "CloseSession", &error, +- G_TYPE_STRING, manager->consolekit_cookie, +- G_TYPE_INVALID, +- G_TYPE_BOOLEAN, &result, +- G_TYPE_INVALID); +- if ( !ret ) +- { +- g_warning ("CloseSession on 'org.freedesktop.ConsoleKit' failed with %s", error->message); +- g_error_free (error); +- } +- g_free (manager->consolekit_cookie); +- } ++ { ++ ret = dbus_g_proxy_call (manager->consolekit_proxy, "CloseSession", &error, ++ G_TYPE_STRING, manager->consolekit_cookie, ++ G_TYPE_INVALID, ++ G_TYPE_BOOLEAN, &result, ++ G_TYPE_INVALID); ++ if (!ret) ++ { ++ g_warning ("CloseSession on 'org.freedesktop.ConsoleKit' failed with %s", error->message); ++ g_error_free (error); ++ } ++ g_free (manager->consolekit_cookie); ++ } + g_object_unref (manager->consolekit_proxy); + } + } +@@ -1181,6 +1202,7 @@ xfsm_manager_interact_done (XfsmManager *manager, + xfsm_manager_start_client_save_timeout (manager, client); + } + ++ + static void + xfsm_manager_save_yourself_global (XfsmManager *manager, + gint save_type, +@@ -1222,8 +1244,8 @@ xfsm_manager_save_yourself_global (XfsmManager *manager, + shutdown_helper = xfsm_shutdown_helper_new (); + + if (!xfsm_shutdown_helper_send_command (shutdown_helper, +- manager->shutdown_type, +- &error)) ++ manager->shutdown_type, ++ &error)) + { + xfce_message_dialog (NULL, _("Shutdown Failed"), + GTK_STOCK_DIALOG_ERROR, +@@ -1237,7 +1259,7 @@ xfsm_manager_save_yourself_global (XfsmManager *manager, + } + + /* clean up and return */ +- g_object_unref (shutdown_helper); ++ g_object_unref (shutdown_helper); + + + /* at this point, either we failed to suspend/hibernate, or we +-- +cgit v0.8.2.1 diff --git a/xfce-base/xfce4-session/xfce4-session-4.7.0.ebuild b/xfce-base/xfce4-session/xfce4-session-4.7.0.ebuild index ada23c577380..3384aa9d0e24 100644 --- a/xfce-base/xfce4-session/xfce4-session-4.7.0.ebuild +++ b/xfce-base/xfce4-session/xfce4-session-4.7.0.ebuild @@ -1,6 +1,6 @@ # Copyright 1999-2010 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/xfce-base/xfce4-session/xfce4-session-4.7.0.ebuild,v 1.2 2010/09/06 17:25:13 ssuominen Exp $ +# $Header: /var/cvsroot/gentoo-x86/xfce-base/xfce4-session/xfce4-session-4.7.0.ebuild,v 1.3 2010/09/09 12:35:56 ssuominen Exp $ EAPI=3 inherit xfconf @@ -32,6 +32,7 @@ DEPEND="${RDEPEND} sys-devel/gettext" pkg_setup() { + PATCHES=( "${FILESDIR}"/${P}-ck-launch-session.patch ) XFCONF="--docdir=${EPREFIX}/usr/share/doc/${PF} --disable-dependency-tracking --disable-static |