rpms/kdebase-workspace/devel kdebase-workspace-4.0.3-ck-shutdown.patch, NONE, 1.1 kdebase-workspace.spec, 1.55, 1.56

Kevin Kofler (kkofler) fedora-extras-commits at redhat.com
Sat Mar 29 07:59:21 UTC 2008


Author: kkofler

Update of /cvs/pkgs/rpms/kdebase-workspace/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv32721/devel

Modified Files:
	kdebase-workspace.spec 
Added Files:
	kdebase-workspace-4.0.3-ck-shutdown.patch 
Log Message:
* Sat Mar 29 2008 Kevin Kofler <Kevin at tigcc.ticalc.org> 4.0.3-3
- add support for shutdown/reboot through ConsoleKit >= 0.2.4 (#431817)

kdebase-workspace-4.0.3-ck-shutdown.patch:

--- NEW FILE kdebase-workspace-4.0.3-ck-shutdown.patch ---
diff -ur kdebase-workspace-4.0.3/libs/kworkspace/dmctl.cpp kdebase-workspace-4.0.3-ck-shutdown/libs/kworkspace/dmctl.cpp
--- kdebase-workspace-4.0.3/libs/kworkspace/dmctl.cpp	2008-03-27 21:34:43.000000000 +0100
+++ kdebase-workspace-4.0.3-ck-shutdown/libs/kworkspace/dmctl.cpp	2008-03-29 08:53:28.000000000 +0100
@@ -26,6 +26,7 @@
 #include <QtDBus/QtDBus>
 
 #include <QRegExp>
+#include <QLatin1String>
 
 #include <X11/Xauth.h>
 #include <X11/Xlib.h>
@@ -73,6 +74,7 @@
 				strcpy( sa.sun_path, "/tmp/.gdm_socket" );
 				if (::connect( fd, (struct sockaddr *)&sa, sizeof(sa) )) {
 					::close( fd );
+					DMType = NoDM;
 					fd = -1;
 					break;
 				}
@@ -174,6 +176,21 @@
 bool
 DM::canShutdown()
 {
+	if (DMType == NoDM) {
+		// No DM or newest GDM running, we'll try shutting down through ConsoleKit.
+		// Unfortunately, ConsoleKit won't tell us if we're allowed to do that
+		// (it also depends on whether there are other users logged in on the
+		// system), so we can only check if it's running at all.
+		QDBusConnection systemBus = QDBusConnection::systemBus();
+		if (!systemBus.isConnected())
+			return false;
+		QDBusInterface consoleKit( QLatin1String( "org.freedesktop.ConsoleKit" ),
+		                           QLatin1String( "/org/freedesktop/ConsoleKit/Manager" ),
+		                           QLatin1String( "org.freedesktop.ConsoleKit.Manager" ),
+		                           systemBus );
+		return consoleKit.isValid();
+	}
+
 	if (DMType == OldKDM)
 		return strstr( ctl, ",maysd" ) != 0;
 
@@ -193,6 +210,21 @@
 	if (shutdownType == KWorkSpace::ShutdownTypeNone)
 		return;
 
+	if (DMType == NoDM) {
+		// No DM or newest GDM running, try shutting down through ConsoleKit.
+		QDBusConnection systemBus = QDBusConnection::systemBus();
+		if (!systemBus.isConnected())
+			return;
+		QDBusInterface consoleKit( QLatin1String( "org.freedesktop.ConsoleKit" ),
+		                           QLatin1String( "/org/freedesktop/ConsoleKit/Manager" ),
+		                           QLatin1String( "org.freedesktop.ConsoleKit.Manager" ),
+		                           systemBus );
+		if (consoleKit.isValid())
+			consoleKit.call( QLatin1String( shutdownType == KWorkSpace::ShutdownTypeReboot ?
+		                                        "Restart" : "Stop" ) );
+		return;
+	}
+
 	bool cap_ask;
 	if (DMType == NewKDM) {
 		QByteArray re;


Index: kdebase-workspace.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kdebase-workspace/devel/kdebase-workspace.spec,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -r1.55 -r1.56
--- kdebase-workspace.spec	28 Mar 2008 17:22:18 -0000	1.55
+++ kdebase-workspace.spec	29 Mar 2008 07:58:42 -0000	1.56
@@ -6,7 +6,7 @@
 Name: kdebase-workspace
 Version: 4.0.3
 
-Release: 2%{?dist}
+Release: 3%{?dist}
 Source0: ftp://ftp.kde.org/pub/kde/stable/%{version}/src/kdebase-workspace-%{version}.tar.bz2
 License: GPLv2
 Group: User Interface/Desktops
@@ -17,6 +17,7 @@
 Patch2: kdebase-workspace-4.0.0-consolekit-kdm.patch
 Patch3: kdebase-workspace-4.0.2-plasma-konsole.patch
 Patch4: kdebase-workspace-4.0.2-onlyshowkde.patch
+Patch5: kdebase-workspace-4.0.3-ck-shutdown.patch
 
 # http://bugs.kde.org/155362 (show Name in addition to GenericName in simple menu)
 # backported from trunk (KDE 4.1): http://websvn.kde.org/?view=rev&revision=762886
@@ -114,6 +115,8 @@
 %patch2 -p1 -b .consolekit
 %patch3 -p1 -b .plasma-konsole
 %patch4 -p1 -b .onlyshowkde
+# ConsoleKit >= 0.2.4 shutdown/reboot support (needed for GDM 2.22)
+%patch5 -p1 -b .ck-shutdown
 
 # upstream patches
 %patch100 -p0 -b .kde#155362
@@ -229,6 +232,9 @@
 
 
 %changelog
+* Sat Mar 29 2008 Kevin Kofler <Kevin at tigcc.ticalc.org> 4.0.3-3
+- add support for shutdown/reboot through ConsoleKit >= 0.2.4 (#431817)
+
 * Fri Mar 28 2008 Kevin Kofler <Kevin at tigcc.ticalc.org> 4.0.3-2
 - most of the kde#155362 patch has been merged, keep only the config part
 




More information about the fedora-extras-commits mailing list