[arch-commits] Commit in lightdm/trunk (PKGBUILD lightdm-use-login1.patch)

Maxime Gauduin alucryd at nymeria.archlinux.org
Thu Jun 13 08:51:13 UTC 2013


    Date: Thursday, June 13, 2013 @ 10:51:13
  Author: alucryd
Revision: 92708

FS#35704: lightdm 1:1.6.0-5

Modified:
  lightdm/trunk/PKGBUILD
  lightdm/trunk/lightdm-use-login1.patch

--------------------------+
 PKGBUILD                 |    6 
 lightdm-use-login1.patch |  639 +++++++++++++++++++++++++++------------------
 2 files changed, 394 insertions(+), 251 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2013-06-13 08:34:56 UTC (rev 92707)
+++ PKGBUILD	2013-06-13 08:51:13 UTC (rev 92708)
@@ -5,7 +5,7 @@
 pkgbase=lightdm
 pkgname=('lightdm' 'liblightdm-qt4' 'liblightdm-qt5')
 pkgver=1.6.0
-pkgrel=4
+pkgrel=5
 epoch=1
 pkgdesc="A lightweight display manager"
 arch=('i686' 'x86_64')
@@ -32,7 +32,7 @@
             'a89566307e1c81c24f037d854cbd472d2f94f8a4b759877a01563a332319f7d6'
             '6d5a754f41e9c7e52c51d2ff018b926ddaabb807e9a0b88c4a7bde1acffa3b1c'
             '4793eaee5915f5c519f569a4cd9158822d4c57c8b6e405895d2eddf82fa00822'
-            'bac646accb407c02c9cebf0b087b7a47f6353bc3829de4e82e10b2e4396a87e6'
+            '3247aa1e5e7c2c2f8653cfbb22e1f74252c556b6159ff4ec47c1c7d5ea6883ac'
             '7fb85a1b54406032a922e8fd6f45d869fcfe5681df630e74e8e50c040b786ee4')
 
 prepare() {
@@ -40,7 +40,7 @@
 
   patch -Np1 -i ../lightdm-default-config.patch
   patch -Np1 -i ../lightdm-lock-screen-before-switch.patch
-  patch -Np1 -i ../lightdm-use-login1.patch
+  patch -Np0 -i ../lightdm-use-login1.patch
   sed -i 's/MOC5 --qt=qt5/MOC5/' configure
 }
 

Modified: lightdm-use-login1.patch
===================================================================
--- lightdm-use-login1.patch	2013-06-13 08:34:56 UTC (rev 92707)
+++ lightdm-use-login1.patch	2013-06-13 08:51:13 UTC (rev 92708)
@@ -1,279 +1,101 @@
-diff -Naurp lightdm-1.6.0.orig/liblightdm-gobject/power.c lightdm-1.6.0/liblightdm-gobject/power.c
---- lightdm-1.6.0.orig/liblightdm-gobject/power.c 2013-03-06 03:40:10.000000000 +0100
-+++ lightdm-1.6.0/liblightdm-gobject/power.c  2013-06-08 00:45:07.411183727 +0200
-@@ -15,44 +15,67 @@
+=== modified file 'liblightdm-gobject/power.c'
+--- liblightdm-gobject/power.c	2013-01-31 20:56:09 +0000
++++ liblightdm-gobject/power.c	2013-04-15 02:21:06 +0000
+@@ -17,6 +17,7 @@
  
- #include "lightdm/power.h"
+ static GDBusProxy *upower_proxy = NULL;
+ static GDBusProxy *ck_proxy = NULL;
++static GDBusProxy *login1_proxy = NULL;
  
--static GDBusProxy *upower_proxy = NULL;
--static GDBusProxy *ck_proxy = NULL;
-+/* static GDBusProxy *upower_proxy = NULL;
-+ static GDBusProxy *ck_proxy = NULL;
-+ static GDBusProxy *login1_proxy = NULL;
-+ */
-+
-+struct proxy_info {
-+ /* proxy reference */
-+ GDBusProxy *proxy;
-+
-+ /* arguments to g_dbus_proxy_new_for_bus_sync() */
-+ const char *name;
-+ const char *object_path;
-+ const char *interface_name;
-+
-+};
-+
-+static struct proxy_info upower_proxy = {
-+ .proxy = NULL,
-+ .name = "org.freedesktop.UPower",
-+ .object_path = "/org/freedesktop/UPower",
-+ .interface_name = "org.freedesktop.UPower",
-+};
-+
-+static struct proxy_info ck_proxy = {
-+ .proxy = NULL,
-+ .name = "org.freedesktop.ConsoleKit",
-+ .object_path = "/org/freedesktop/ConsoleKit/Manager",
-+ .interface_name = "org.freedesktop.ConsoleKit.Manager",
-+};
-+
-+static struct proxy_info login1_proxy = {
-+ .proxy = NULL,
-+ .name = "org.freedesktop.login1",
-+ .object_path = "/org/freedesktop/login1",
-+ .interface_name = "org.freedesktop.login1.Manager",
-+};
+ static gboolean
+ upower_call_function (const gchar *function, gboolean default_result, GError **error)
+@@ -109,11 +110,10 @@
+     return upower_call_function ("Hibernate", TRUE, error);
+ }
  
 -static gboolean
--upower_call_function (const gchar *function, gboolean default_result, GError **error)
+-ck_call_function (const gchar *function, gboolean default_result, GError **error)
 +static GVariant *
-+do_call_function (const gchar *function, GVariant *parameters, GError **error, struct proxy_info *proxy)
++ck_call_function (const gchar *function, GError **error)
  {
 -    GVariant *result;
 -    gboolean function_result = FALSE;
--
--    if (!upower_proxy)
-+    if (!proxy->proxy)
++    GVariant *r;
+ 
+     if (!ck_proxy)
      {
--        upower_proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
--                                                      G_DBUS_PROXY_FLAGS_NONE,
--                                                      NULL,
--                                                      "org.freedesktop.UPower",
--                                                      "/org/freedesktop/UPower",
--                                                      "org.freedesktop.UPower",
--                                                      NULL,
--                                                      error);
--        if (!upower_proxy)
--            return FALSE;
--    }
--
--    result = g_dbus_proxy_call_sync (upower_proxy,
+@@ -129,22 +129,46 @@
+             return FALSE;
+     }
+ 
+-    result = g_dbus_proxy_call_sync (ck_proxy,
 -                                     function,
 -                                     NULL,
 -                                     G_DBUS_CALL_FLAGS_NONE,
 -                                     -1,
 -                                     NULL,
 -                                     error);
+-
 -    if (!result)
 -        return default_result;
 -
 -    if (g_variant_is_of_type (result, G_VARIANT_TYPE ("(b)")))
 -        g_variant_get (result, "(b)", &function_result);
-+        proxy->proxy = g_dbus_proxy_new_for_bus_sync(G_BUS_TYPE_SYSTEM,
-+                                                     G_DBUS_PROXY_FLAGS_NONE,
-+                                                     NULL,
-+                                                     proxy->name,
-+                                                     proxy->object_path,
-+                                                     proxy->interface_name,
-+                                                     NULL,
-+                                                     error);
-+        if (!proxy->proxy)
-+            return NULL;
-+    }
- 
+-
 -    g_variant_unref (result);
 -    return function_result;
-+    return g_dbus_proxy_call_sync(proxy->proxy,
-+                                   function,
-+          parameters,
-+                                   G_DBUS_CALL_FLAGS_NONE,
-+                                   -1,
-+                                   NULL,
-+                                   error);
- }
- 
- /**
-@@ -65,7 +88,29 @@ upower_call_function (const gchar *funct
- gboolean
- lightdm_get_can_suspend (void)
- {
--    return upower_call_function ("SuspendAllowed", FALSE, NULL);
-+    gboolean can_suspend = FALSE;
-+    GVariant *r;
++    r = g_dbus_proxy_call_sync (ck_proxy,
++                                function,
++                                NULL,
++                                G_DBUS_CALL_FLAGS_NONE,
++                                -1,
++                                NULL,
++                                error);
 +
-+    r = do_call_function ("CanSuspend", NULL, NULL, &login1_proxy);
-+    if (r)
-+    {
-+        gchar *result;
-+        if (g_variant_is_of_type (r, G_VARIANT_TYPE ("(s)")))
-+        {
-+            g_variant_get (r, "(&s)", &result);
-+            can_suspend = g_strcmp0 (result, "yes") == 0;
-+        }
-+    }
-+    else
-+    {
-+        r = do_call_function ("SuspendAllowed", NULL, NULL, &upower_proxy);
-+        if (r && g_variant_is_of_type (r, G_VARIANT_TYPE ("(b)")))
-+            g_variant_get (r, "(b)", &can_suspend);
-+    }
-+    if (r)
-+        g_variant_unref (r);
++    return r;
++}
 +
-+    return can_suspend;
- }
- 
- /**
-@@ -73,13 +118,29 @@ lightdm_get_can_suspend (void)
-  * @error: return location for a #GError, or %NULL
-  *
-  * Triggers a system suspend.
-- * 
-+ *
-  * Return value: #TRUE if suspend initiated.
-  **/
- gboolean
- lightdm_suspend (GError **error)
- {
--    return upower_call_function ("Suspend", TRUE, error);
-+    GVariant *result;
-+    gboolean suspended;
++static GVariant *
++login1_call_function (const gchar *function, GVariant *parameters, GError **error)
++{
++    GVariant *r;
++    gchar *str_result;
 +
-+    result = do_call_function ("Suspend", g_variant_new("(b)", FALSE), error, &login1_proxy);
-+    if (!result)
++    if (!login1_proxy)
 +    {
-+        if (error)
-+            g_debug ("Can't suspend using logind; falling back to UPower: %s", (*error)->message);
-+        g_clear_error (error);
-+        result = do_call_function ("Suspend", NULL, error, &upower_proxy);
++        login1_proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
++                                                      G_DBUS_PROXY_FLAGS_NONE,
++                                                      NULL,
++                                                      "org.freedesktop.login1",
++                                                      "/org/freedesktop/login1",
++                                                      "org.freedesktop.login1.Manager",
++                                                      NULL,
++                                                      error);
++        if (!login1_proxy)
++            return NULL;
 +    }
 +
-+    suspended = result != NULL;
-+    if (result)
-+        g_variant_unref (result);
++    r = g_dbus_proxy_call_sync (login1_proxy,
++                                function,
++                                parameters,
++                                G_DBUS_CALL_FLAGS_NONE,
++                                -1,
++                                NULL,
++                                error);
 +
-+    return suspended;
++    return r;
  }
  
  /**
-@@ -92,7 +153,29 @@ lightdm_suspend (GError **error)
+@@ -157,7 +181,29 @@
  gboolean
- lightdm_get_can_hibernate (void)
- {
--    return upower_call_function ("HibernateAllowed", FALSE, NULL);
-+    gboolean can_hibernate = FALSE;
-+    GVariant *r;
-+
-+    r = do_call_function ("CanHibernate", NULL, NULL, &login1_proxy);
-+    if (r)
-+    {
-+        gchar *result;
-+        if (g_variant_is_of_type (r, G_VARIANT_TYPE ("(s)")))
-+        {
-+            g_variant_get (r, "(&s)", &result);
-+            can_hibernate = g_strcmp0 (result, "yes") == 0;
-+        }
-+    }
-+    else
-+    {
-+        r = do_call_function ("HibernateAllowed", NULL, NULL, &upower_proxy);
-+        if (r && g_variant_is_of_type (r, G_VARIANT_TYPE ("(b)")))
-+            g_variant_get (r, "(b)", &can_hibernate);
-+    }
-+    if (r)
-+        g_variant_unref (r);
-+
-+    return can_hibernate;
- }
- 
- /**
-@@ -100,53 +183,32 @@ lightdm_get_can_hibernate (void)
-  * @error: return location for a #GError, or %NULL
-  *
-  * Triggers a system hibernate.
-- * 
-+ *
-  * Return value: #TRUE if hibernate initiated.
-  **/
- gboolean
- lightdm_hibernate (GError **error)
- {
--    return upower_call_function ("Hibernate", TRUE, error);
--}
--
--static gboolean
--ck_call_function (const gchar *function, gboolean default_result, GError **error)
--{
-     GVariant *result;
--    gboolean function_result = FALSE;
--
--    if (!ck_proxy)
--    {
--        ck_proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
--                                                  G_DBUS_PROXY_FLAGS_NONE,
--                                                  NULL,
--                                                  "org.freedesktop.ConsoleKit",
--                                                  "/org/freedesktop/ConsoleKit/Manager",
--                                                  "org.freedesktop.ConsoleKit.Manager",
--                                                  NULL,
--                                                  error);
--        if (!ck_proxy)
--            return FALSE;
--    }
--
--    result = g_dbus_proxy_call_sync (ck_proxy,
--                                     function,
--                                     NULL,
--                                     G_DBUS_CALL_FLAGS_NONE,
--                                     -1,
--                                     NULL,
--                                     error);
-+    gboolean hibernated;
- 
-+    result = do_call_function ("Hibernate", g_variant_new("(b)", FALSE), error, &login1_proxy);
-     if (!result)
--        return default_result;
-+    {
-+        if (error)
-+            g_debug ("Can't hibernate using logind; falling back to UPower: %s", (*error)->message);
-+        g_clear_error (error);
-+        result = do_call_function ("Hibernate", NULL, error, &upower_proxy);
-+    }
- 
--    if (g_variant_is_of_type (result, G_VARIANT_TYPE ("(b)")))
--        g_variant_get (result, "(b)", &function_result);
-+    hibernated = result != NULL;
-+    if (result)
-+        g_variant_unref (result);
- 
--    g_variant_unref (result);
--    return function_result;
-+    return hibernated;
- }
- 
-+
- /**
-  * lightdm_get_can_restart:
-  *
-@@ -157,7 +219,29 @@ ck_call_function (const gchar *function,
- gboolean
  lightdm_get_can_restart (void)
  {
 -    return ck_call_function ("CanRestart", FALSE, NULL);
 +    gboolean can_restart = FALSE;
 +    GVariant *r;
 +
-+    r = do_call_function ("CanReboot", NULL, NULL, &login1_proxy);
++    r = login1_call_function ("CanReboot", NULL, NULL);
 +    if (r)
 +    {
 +        gchar *result;
@@ -285,7 +107,7 @@
 +    }
 +    else
 +    {
-+        r = do_call_function ("CanRestart", NULL, NULL, &ck_proxy);
++        r = ck_call_function ("CanRestart", NULL);
 +        if (r && g_variant_is_of_type (r, G_VARIANT_TYPE ("(b)")))
 +            g_variant_get (r, "(b)", &can_restart);
 +    }
@@ -296,7 +118,7 @@
  }
  
  /**
-@@ -171,7 +255,20 @@ lightdm_get_can_restart (void)
+@@ -171,7 +217,20 @@
  gboolean
  lightdm_restart (GError **error)
  {
@@ -304,11 +126,11 @@
 +    GVariant *r;
 +    gboolean restarted;
 +
-+    r = do_call_function ("Reboot", g_variant_new("(b)", FALSE), error, &login1_proxy);
++    r = login1_call_function ("Reboot", g_variant_new("(b)", FALSE), error);
 +    if (!r)
 +    {
 +        g_clear_error (error);
-+        r = do_call_function ("Restart", NULL, error, &ck_proxy);
++        r = ck_call_function ("Restart", error);
 +    }
 +    restarted = r != NULL;
 +    if (r)
@@ -318,15 +140,15 @@
  }
  
  /**
-@@ -184,7 +281,29 @@ lightdm_restart (GError **error)
+@@ -184,7 +243,29 @@
  gboolean
  lightdm_get_can_shutdown (void)
  {
 -    return ck_call_function ("CanStop", FALSE, NULL);
 +    gboolean can_shutdown = FALSE;
 +    GVariant *r;
-+
-+    r = do_call_function ("CanPowerOff", NULL, NULL, &login1_proxy);
++  
++    r = login1_call_function ("CanPowerOff", NULL, NULL);
 +    if (r)
 +    {
 +        gchar *result;
@@ -338,7 +160,7 @@
 +    }
 +    else
 +    {
-+        r = do_call_function ("CanStop", NULL, NULL, &ck_proxy);
++        r = ck_call_function ("CanStop", NULL);
 +        if (r && g_variant_is_of_type (r, G_VARIANT_TYPE ("(b)")))
 +            g_variant_get (r, "(b)", &can_shutdown);
 +    }
@@ -349,7 +171,7 @@
  }
  
  /**
-@@ -198,5 +317,18 @@ lightdm_get_can_shutdown (void)
+@@ -198,5 +279,18 @@
  gboolean
  lightdm_shutdown (GError **error)
  {
@@ -357,11 +179,11 @@
 +    GVariant *r;
 +    gboolean shutdown;
 +
-+    r = do_call_function ("PowerOff", g_variant_new("(b)", FALSE), error, &login1_proxy);
++    r = login1_call_function ("PowerOff", g_variant_new("(b)", FALSE), error);
 +    if (!r)
 +    {
 +        g_clear_error (error);
-+        r = do_call_function ("Stop", NULL, error, &ck_proxy);
++        r = ck_call_function ("Stop", error);
 +    }
 +    shutdown = r != NULL;
 +    if (r)
@@ -369,3 +191,324 @@
 +
 +    return shutdown;
  }
+
+=== modified file 'liblightdm-qt/power.cpp'
+--- liblightdm-qt/power.cpp	2013-02-06 14:08:25 +0000
++++ liblightdm-qt/power.cpp	2013-04-14 23:00:34 +0000
+@@ -15,6 +15,7 @@
+ #include <QtCore/QVariant>
+ #include <QtDBus/QDBusInterface>
+ #include <QtDBus/QDBusReply>
++#include <QDebug>
+ 
+ #include "config.h"
+ 
+@@ -26,11 +27,13 @@
+     PowerInterfacePrivate();
+     QScopedPointer<QDBusInterface> powerManagementInterface;
+     QScopedPointer<QDBusInterface> consoleKitInterface;
++    QScopedPointer<QDBusInterface> login1Interface;
+ };
+ 
+ PowerInterface::PowerInterfacePrivate::PowerInterfacePrivate() :
+     powerManagementInterface(new QDBusInterface("org.freedesktop.UPower","/org/freedesktop/UPower", "org.freedesktop.UPower", QDBusConnection::systemBus())),
+-    consoleKitInterface(new QDBusInterface("org.freedesktop.ConsoleKit", "/org/freedesktop/ConsoleKit/Manager", "org.freedesktop.ConsoleKit.Manager", QDBusConnection::systemBus()))
++    consoleKitInterface(new QDBusInterface("org.freedesktop.ConsoleKit", "/org/freedesktop/ConsoleKit/Manager", "org.freedesktop.ConsoleKit.Manager", QDBusConnection::systemBus())),
++    login1Interface(new QDBusInterface("org.freedesktop.login1", "/org/freedesktop/login1", "org.freedesktop.login1.Manager", QDBusConnection::systemBus()))
+ {
+ }
+ 
+@@ -80,34 +83,54 @@
+ 
+ bool PowerInterface::canShutdown()
+ {
++    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();
+     }
+-    else {
+-        return false;
+-    }
++
++    return false;
+ }
+ 
+ void PowerInterface::shutdown()
+ {
+-    d->consoleKitInterface->call("Stop");
++    if (d->login1Interface->isValid())
++        d->login1Interface->call("PowerOff", false);
++    else
++        d->consoleKitInterface->call("Stop");
+ }
+ 
+ bool PowerInterface::canRestart()
+ {
++    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()) {
+         return reply.value();
+     }
+-    else {
+-        return false;
+-    }
++
++    return false;
+ }
+ 
+ void PowerInterface::restart()
+ {
+-    d->consoleKitInterface->call("Restart");
++    if (d->login1Interface->isValid())
++        d->login1Interface->call("Reboot", false);
++    else
++        d->consoleKitInterface->call("Restart");
+ }
+ 
+ #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+
+=== modified file 'tests/Makefile.am'
+--- tests/Makefile.am	2013-04-12 03:46:06 +0000
++++ tests/Makefile.am	2013-04-14 22:54:54 +0000
+@@ -135,6 +135,8 @@
+ 	test-no-accounts-service \
+ 	test-console-kit \
+ 	test-no-console-kit \
++	test-no-login1 \
++	test-no-console-kit-or-login1 \
+ 	test-open-file-descriptors \
+ 	test-xdmcp-open-file-descriptors
+ 
+@@ -284,8 +286,10 @@
+ 	scripts/no-accounts-service.conf \
+ 	scripts/no-config.conf \
+ 	scripts/no-console-kit.conf \
++	scripts/no-console-kit-or-login1.conf \
+ 	scripts/no-keyboard-layout.conf \
+ 	scripts/no-language.conf \
++	scripts/no-login1.conf \
+ 	scripts/open-file-descriptors.conf \
+ 	scripts/pam.conf \
+ 	scripts/plymouth-active-vt.conf \
+
+=== added file 'tests/scripts/no-console-kit-or-login1.conf'
+--- tests/scripts/no-console-kit-or-login1.conf	1970-01-01 00:00:00 +0000
++++ tests/scripts/no-console-kit-or-login1.conf	2013-04-14 22:54:54 +0000
+@@ -0,0 +1,34 @@
++#
++# Check still works when neither ConsoleKit or login1 is available
++#
++
++[test-runner-config]
++disable-console-kit=true
++disable-login1=true
++
++[LightDM]
++minimum-display-number=50
++
++[SeatDefaults]
++autologin-user=have-password1
++
++#?RUNNER DAEMON-START
++
++# X server starts
++#?XSERVER :50 START
++#?XSERVER :50 INDICATE-READY
++
++# LightDM connects to X server
++#?XSERVER :50 ACCEPT-CONNECT
++
++# Session starts
++#?SESSION :50 START USER=have-password1
++#?XSERVER :50 ACCEPT-CONNECT
++#?SESSION :50 CONNECT-XSERVER
++
++# Cleanup
++#?*STOP-DAEMON
++# Don't know what order they will terminate
++#?(SESSION :50 TERMINATE SIGNAL=15|XSERVER :50 TERMINATE SIGNAL=15)
++#?(SESSION :50 TERMINATE SIGNAL=15|XSERVER :50 TERMINATE SIGNAL=15)
++#?RUNNER DAEMON-EXIT STATUS=0
+
+=== added file 'tests/scripts/no-login1.conf'
+--- tests/scripts/no-login1.conf	1970-01-01 00:00:00 +0000
++++ tests/scripts/no-login1.conf	2013-04-14 22:54:54 +0000
+@@ -0,0 +1,33 @@
++#
++# Check still works when login1 is not available
++#
++
++[test-runner-config]
++disable-login1=true
++
++[LightDM]
++minimum-display-number=50
++
++[SeatDefaults]
++autologin-user=have-password1
++
++#?RUNNER DAEMON-START
++
++# X server starts
++#?XSERVER :50 START
++#?XSERVER :50 INDICATE-READY
++
++# LightDM connects to X server
++#?XSERVER :50 ACCEPT-CONNECT
++
++# Session starts
++#?SESSION :50 START USER=have-password1
++#?XSERVER :50 ACCEPT-CONNECT
++#?SESSION :50 CONNECT-XSERVER
++
++# Cleanup
++#?*STOP-DAEMON
++# Don't know what order they will terminate
++#?(SESSION :50 TERMINATE SIGNAL=15|XSERVER :50 TERMINATE SIGNAL=15)
++#?(SESSION :50 TERMINATE SIGNAL=15|XSERVER :50 TERMINATE SIGNAL=15)
++#?RUNNER DAEMON-EXIT STATUS=0
+
+=== modified file 'tests/src/test-runner.c'
+--- tests/src/test-runner.c	2013-03-27 00:48:48 +0000
++++ tests/src/test-runner.c	2013-04-14 22:54:54 +0000
+@@ -838,6 +838,101 @@
+ }
+ 
+ static void
++handle_login1_call (GDBusConnection       *connection,
++                    const gchar           *sender,
++                    const gchar           *object_path,
++                    const gchar           *interface_name,
++                    const gchar           *method_name,
++                    GVariant              *parameters,
++                    GDBusMethodInvocation *invocation,
++                    gpointer               user_data)
++{
++    if (strcmp (method_name, "CanReboot") == 0)
++        g_dbus_method_invocation_return_value (invocation, g_variant_new ("(s)", "yes"));
++    else if (strcmp (method_name, "Reboot") == 0)
++    {
++        gboolean interactive;
++        g_variant_get (parameters, "(b)", &interactive);
++        g_dbus_method_invocation_return_value (invocation, g_variant_new ("()"));
++    }
++    if (strcmp (method_name, "CanPowerOff") == 0)
++        g_dbus_method_invocation_return_value (invocation, g_variant_new ("(s)", "yes"));
++    else if (strcmp (method_name, "PowerOff") == 0)
++    {
++        gboolean interactive;
++        g_variant_get (parameters, "(b)", &interactive);
++        g_dbus_method_invocation_return_value (invocation, g_variant_new ("()"));
++    }
++    else
++        g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_FAILED, "No such method: %s", method_name);
++}
++
++static void
++login1_name_acquired_cb (GDBusConnection *connection,
++                         const gchar     *name,
++                         gpointer         user_data)
++{
++    const gchar *login1_interface =
++        "<node>"
++        "  <interface name='org.freedesktop.login1.Manager'>"
++        "    <method name='CanReboot'>"
++        "      <arg name='result' direction='out' type='s'/>"
++        "    </method>"
++        "    <method name='Reboot'>"
++        "      <arg name='interactive' direction='in' type='b'/>"
++        "    </method>"
++        "    <method name='CanPowerOff'>"
++        "      <arg name='result' direction='out' type='s'/>"
++        "    </method>"
++        "    <method name='PowerOff'>"
++        "      <arg name='interactive' direction='in' type='b'/>"
++        "    </method>"
++        "  </interface>"
++        "</node>";
++    static const GDBusInterfaceVTable login1_vtable =
++    {
++        handle_login1_call,
++    };
++    GDBusNodeInfo *login1_info;
++    GError *error = NULL;
++
++    login1_info = g_dbus_node_info_new_for_xml (login1_interface, &error);
++    if (error)
++        g_warning ("Failed to parse D-Bus interface: %s", error->message);  
++    g_clear_error (&error);
++    if (!login1_info)
++        return;
++    g_dbus_connection_register_object (connection,
++                                       "/org/freedesktop/login1",
++                                       login1_info->interfaces[0],
++                                       &login1_vtable,
++                                       NULL, NULL,
++                                       &error);
++    if (error)
++        g_warning ("Failed to register login1 service: %s", error->message);
++    g_clear_error (&error);
++    g_dbus_node_info_unref (login1_info);
++
++    service_count--;
++    if (service_count == 0)
++        run_lightdm ();
++}
++
++static void
++start_login1_daemon ()
++{
++    service_count++;
++    g_bus_own_name (G_BUS_TYPE_SYSTEM,
++                    "org.freedesktop.login1",
++                    G_BUS_NAME_OWNER_FLAGS_NONE,
++                    login1_name_acquired_cb,
++                    NULL,
++                    NULL,
++                    NULL,
++                    NULL);
++}
++
++static void
+ load_passwd_file ()
+ {
+     gchar *path, *data, **lines;
+@@ -1474,6 +1569,8 @@
+     /* Start D-Bus services */
+     if (!g_key_file_get_boolean (config, "test-runner-config", "disable-console-kit", NULL))
+         start_console_kit_daemon ();
++    if (!g_key_file_get_boolean (config, "test-runner-config", "disable-login1", NULL))
++        start_login1_daemon ();
+     if (!g_key_file_get_boolean (config, "test-runner-config", "disable-accounts-service", NULL))
+         start_accounts_service_daemon ();
+ 
+
+=== added file 'tests/test-no-console-kit-or-login1'
+--- tests/test-no-console-kit-or-login1	1970-01-01 00:00:00 +0000
++++ tests/test-no-console-kit-or-login1	2013-04-14 22:54:54 +0000
+@@ -0,0 +1,2 @@
++#!/bin/sh
++./src/dbus-env ./src/test-runner no-console-kit-or-login1 test-gobject-greeter
+
+=== added file 'tests/test-no-login1'
+--- tests/test-no-login1	1970-01-01 00:00:00 +0000
++++ tests/test-no-login1	2013-04-14 22:54:54 +0000
+@@ -0,0 +1,2 @@
++#!/bin/sh
++./src/dbus-env ./src/test-runner no-login1 test-gobject-greeter
+




More information about the arch-commits mailing list