~lightdm-team/lightdm/1.18

« back to all changes in this revision

Viewing changes to tests/src/test-runner.c

  • Committer: Robert Ancell
  • Date: 2017-01-12 02:08:10 UTC
  • Revision ID: robert.ancell@canonical.com-20170112020810-gdfkvtu2bzuaf7ev
Use power management functions from ConsoleKit2 if available.

Suspend and hibernate functionality was removed from upower 0.99.0, so systems
not using systemd had now suspend/hibernate functionality. Support for this
was added into ConsoleKit2.

Most systems will either be systemd or ConsoleKit2 now, so we try the following:
1. Power management in logind
2. Power management in ConsoleKit
3. upower for suspend/resume (really only here to not break backwards
   compatibility)

Based on a patch for Gentoo by Fitzcarraldo.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1336
1336
        check_status ("CONSOLE-KIT CAN-STOP");
1337
1337
        g_dbus_method_invocation_return_value (invocation, g_variant_new ("(b)", TRUE));
1338
1338
    }
 
1339
    else if (strcmp (method_name, "CanSuspend") == 0)
 
1340
    {
 
1341
        check_status ("CONSOLE-KIT CAN-SUSPEND");
 
1342
        g_dbus_method_invocation_return_value (invocation, g_variant_new ("(b)", TRUE));
 
1343
    }
 
1344
    else if (strcmp (method_name, "CanHibernate") == 0)
 
1345
    {
 
1346
        check_status ("CONSOLE-KIT CAN-HIBERNATE");
 
1347
        g_dbus_method_invocation_return_value (invocation, g_variant_new ("(b)", TRUE));
 
1348
    }
1339
1349
    else if (strcmp (method_name, "CloseSession") == 0)
1340
1350
        g_dbus_method_invocation_return_value (invocation, g_variant_new ("(b)", TRUE));
1341
1351
    else if (strcmp (method_name, "OpenSession") == 0)
1379
1389
        check_status ("CONSOLE-KIT STOP");
1380
1390
        g_dbus_method_invocation_return_value (invocation, g_variant_new ("()"));
1381
1391
    }
 
1392
    else if (strcmp (method_name, "Suspend") == 0)
 
1393
    {
 
1394
        check_status ("CONSOLE-KIT SUSPEND");
 
1395
        g_dbus_method_invocation_return_value (invocation, g_variant_new ("()"));
 
1396
    }
 
1397
    else if (strcmp (method_name, "Hibernate") == 0)
 
1398
    {
 
1399
        check_status ("CONSOLE-KIT HIBERNATE");
 
1400
        g_dbus_method_invocation_return_value (invocation, g_variant_new ("()"));
 
1401
    }
1382
1402
    else
1383
1403
        g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_FAILED, "No such method: %s", method_name);
1384
1404
}
1439
1459
        "    <method name='CanStop'>"
1440
1460
        "      <arg name='can_stop' direction='out' type='b'/>"
1441
1461
        "    </method>"
 
1462
        "    <method name='CanSuspend'>"
 
1463
        "      <arg name='can_suspend' direction='out' type='b'/>"
 
1464
        "    </method>"
 
1465
        "    <method name='CanHibernate'>"
 
1466
        "      <arg name='can_hibernate' direction='out' type='b'/>"
 
1467
        "    </method>"
1442
1468
        "    <method name='CloseSession'>"
1443
1469
        "      <arg name='cookie' direction='in' type='s'/>"
1444
1470
        "      <arg name='result' direction='out' type='b'/>"
1456
1482
        "    </method>"
1457
1483
        "    <method name='Restart'/>"
1458
1484
        "    <method name='Stop'/>"
 
1485
        "    <method name='Suspend'>"
 
1486
        "      <arg name='policykit_interactivity' direction='in' type='b'/>"
 
1487
        "    </method>"
 
1488
        "    <method name='Hibernate'>"
 
1489
        "      <arg name='policykit_interactivity' direction='in' type='b'/>"
 
1490
        "    </method>"
1459
1491
        "    <signal name='SeatAdded'>"
1460
1492
        "      <arg name='seat' type='o'/>"
1461
1493
        "    </signal>"