[lightdm] polish systemd-login1 power support patch

Rex Dieter rdieter at fedoraproject.org
Fri Jan 11 04:57:48 UTC 2013


commit 8c981c83c349176351e1e2f38df1605b84f3178c
Author: Rex Dieter <rdieter at math.unl.edu>
Date:   Thu Jan 10 22:58:08 2013 -0600

    polish systemd-login1 power support patch

 lightdm-1.4.0-systemd_login1_power.patch |   50 +++++++++++++++++++----------
 lightdm.spec                             |    5 ++-
 2 files changed, 37 insertions(+), 18 deletions(-)
---
diff --git a/lightdm-1.4.0-systemd_login1_power.patch b/lightdm-1.4.0-systemd_login1_power.patch
index 6f09d40..268a70e 100644
--- a/lightdm-1.4.0-systemd_login1_power.patch
+++ b/lightdm-1.4.0-systemd_login1_power.patch
@@ -1,6 +1,6 @@
-diff -up lightdm-1.4.0/liblightdm-gobject/power.c.systemd_login1 lightdm-1.4.0/liblightdm-gobject/power.c
---- lightdm-1.4.0/liblightdm-gobject/power.c.systemd_login1	2011-12-08 19:51:23.000000000 -0600
-+++ lightdm-1.4.0/liblightdm-gobject/power.c	2012-11-05 12:33:21.402801485 -0600
+diff -up lightdm-1.4.0/liblightdm-gobject/power.c.systemd_login1_power lightdm-1.4.0/liblightdm-gobject/power.c
+--- lightdm-1.4.0/liblightdm-gobject/power.c.systemd_login1_power	2011-12-08 19:51:23.000000000 -0600
++++ lightdm-1.4.0/liblightdm-gobject/power.c	2013-01-10 22:34:41.782151231 -0600
 @@ -18,6 +18,7 @@
  
  static GDBusProxy *upower_proxy = NULL;
@@ -119,10 +119,18 @@ diff -up lightdm-1.4.0/liblightdm-gobject/power.c.systemd_login1 lightdm-1.4.0/l
 +          function_result = ck_call_function ("Stop", TRUE, error);
 +    return function_result;
  }
-diff -up lightdm-1.4.0/liblightdm-qt/power.cpp.systemd_login1 lightdm-1.4.0/liblightdm-qt/power.cpp
---- lightdm-1.4.0/liblightdm-qt/power.cpp.systemd_login1	2011-12-08 19:51:23.000000000 -0600
-+++ lightdm-1.4.0/liblightdm-qt/power.cpp	2012-11-05 12:36:47.261292317 -0600
-@@ -27,11 +27,13 @@ public:
+diff -up lightdm-1.4.0/liblightdm-qt/power.cpp.systemd_login1_power lightdm-1.4.0/liblightdm-qt/power.cpp
+--- lightdm-1.4.0/liblightdm-qt/power.cpp.systemd_login1_power	2011-12-08 19:51:23.000000000 -0600
++++ lightdm-1.4.0/liblightdm-qt/power.cpp	2013-01-10 22:57:15.458512125 -0600
+@@ -16,6 +16,7 @@
+ #include <QtCore/QVariant>
+ #include <QtDBus/QDBusInterface>
+ #include <QtDBus/QDBusReply>
++#include <QDebug>
+ 
+ #include "config.h"
+ 
+@@ -27,11 +28,13 @@ public:
      PowerInterfacePrivate();
      QScopedPointer<QDBusInterface> powerManagementInterface;
      QScopedPointer<QDBusInterface> consoleKitInterface;
@@ -137,14 +145,18 @@ diff -up lightdm-1.4.0/liblightdm-qt/power.cpp.systemd_login1 lightdm-1.4.0/libl
  {
  }
  
-@@ -81,34 +83,45 @@ void PowerInterface::hibernate()
+@@ -81,34 +84,53 @@ void PowerInterface::hibernate()
  
  bool PowerInterface::canShutdown()
  {
-+    QDBusReply<QString> reply1 = d->login1Interface->call("CanPowerOff");
-+    if ( reply1.isValid()) {
++    if ( d->login1Interface->isValid() ) {
++      QDBusReply<QString> reply1 = d->login1Interface->call("CanPowerOff");
++      if (reply1.isValid()) {
 +        return (reply1.value()=="yes");
++      }
 +    }
++    qWarning() << d->login1Interface->lastError();
++
      QDBusReply<bool> reply = d->consoleKitInterface->call("CanStop");
      if (reply.isValid()) {
          return reply.value();
@@ -158,18 +170,21 @@ diff -up lightdm-1.4.0/liblightdm-qt/power.cpp.systemd_login1 lightdm-1.4.0/libl
  void PowerInterface::shutdown()
  {
 -    d->consoleKitInterface->call("Stop");
-+    QDBusReply<bool> reply = d->login1Interface->call("PowerOff",0);
-+    if (!reply.isValid())
++    if ( d->login1Interface->isValid() )
++        d->login1Interface->call("PowerOff",false);
++    else
 +        d->consoleKitInterface->call("Stop");
  }
  
  bool PowerInterface::canRestart()
  {
-+  
-+    QDBusReply<QString> reply1 = d->login1Interface->call("CanReboot");
-+    if (reply1.isValid()) {
++    if ( d->login1Interface->isValid() ) {
++      QDBusReply<QString> reply1 = d->login1Interface->call("CanReboot");
++      if (reply1.isValid()) {
 +        return (reply1.value()=="yes");
++      }
 +    }
++    qWarning() << d->login1Interface->lastError();
 +  
      QDBusReply<bool> reply = d->consoleKitInterface->call("CanRestart");
      if (reply.isValid()) {
@@ -185,8 +200,9 @@ diff -up lightdm-1.4.0/liblightdm-qt/power.cpp.systemd_login1 lightdm-1.4.0/libl
  void PowerInterface::restart()
  {
 -    d->consoleKitInterface->call("Restart");
-+    QDBusReply<bool> reply = d->login1Interface->call("Reboot",0);
-+    if (!reply.isValid())
++    if ( d->login1Interface->isValid() )
++        d->login1Interface->call("Reboot",false);
++    else
 +        d->consoleKitInterface->call("Restart");
  }
  
diff --git a/lightdm.spec b/lightdm.spec
index 0c2b22c..6e3dba2 100644
--- a/lightdm.spec
+++ b/lightdm.spec
@@ -6,7 +6,7 @@
 Name:    lightdm
 Summary: Lightweight Display Manager
 Version: 1.4.0
-Release: 4%{?dist}
+Release: 5%{?dist}
 
 # library/bindings are LGPLv3, the rest GPLv3+
 License: LGPLv3+ and GPLv3+
@@ -255,6 +255,9 @@ exit 0
 
 
 %changelog
+* Thu Jan 10 2013 Rex Dieter <rdieter at fedoraproject.org> 1.4.0-5
+- polish systemd-login1 power support patch
+
 * Tue Jan 08 2013 Rex Dieter <rdieter at fedoraproject.org> 1.4.0-4
 - omit upstart/init support from packaging (#892157)
 


More information about the scm-commits mailing list