diff options
author | Robert Ancell <robert.ancell@canonical.com> | 2018-01-23 12:39:09 +1300 |
---|---|---|
committer | Robert Ancell <robert.ancell@canonical.com> | 2018-01-23 12:40:07 +1300 |
commit | d022d764d5f8d1b6e389610490974306278bff02 (patch) | |
tree | c3040c15e92c89bb6b0e8bd3b3e093b98b3688e0 | |
parent | ffb2c9729f065064c28890bce6176175dd7778c1 (diff) | |
download | lightdm-git-lightdm-1-24.tar.gz |
Fix incorrect use of ConsoleKit CanSuspend/Hibernate APIlightdm-1-24
-rw-r--r-- | liblightdm-gobject/power.c | 16 | ||||
-rw-r--r-- | tests/src/test-runner.c | 8 |
2 files changed, 16 insertions, 8 deletions
diff --git a/liblightdm-gobject/power.c b/liblightdm-gobject/power.c index bc1ddefd..c2467e56 100644 --- a/liblightdm-gobject/power.c +++ b/liblightdm-gobject/power.c @@ -139,9 +139,13 @@ lightdm_get_can_suspend (void) } if (!r) { + const gchar *result; r = ck_call_function ("CanSuspend", NULL, NULL); - if (r && g_variant_is_of_type (r, G_VARIANT_TYPE ("(b)"))) - g_variant_get (r, "(b)", &can_suspend); + if (r && g_variant_is_of_type (r, G_VARIANT_TYPE ("(s)"))) + { + g_variant_get (r, "(&s)", &result); + can_suspend = g_strcmp0 (result, "yes") == 0; + } } if (!r) { @@ -217,9 +221,13 @@ lightdm_get_can_hibernate (void) } if (!r) { + const gchar *result; r = ck_call_function ("CanHibernate", NULL, NULL); - if (r && g_variant_is_of_type (r, G_VARIANT_TYPE ("(b)"))) - g_variant_get (r, "(b)", &can_hibernate); + if (r && g_variant_is_of_type (r, G_VARIANT_TYPE ("(s)"))) + { + g_variant_get (r, "(&s)", &result); + can_hibernate = g_strcmp0 (result, "yes") == 0; + } } if (!r) { diff --git a/tests/src/test-runner.c b/tests/src/test-runner.c index 70d10a7a..e0e37e4e 100644 --- a/tests/src/test-runner.c +++ b/tests/src/test-runner.c @@ -1404,12 +1404,12 @@ handle_ck_call (GDBusConnection *connection, else if (strcmp (method_name, "CanSuspend") == 0) { check_status ("CONSOLE-KIT CAN-SUSPEND"); - g_dbus_method_invocation_return_value (invocation, g_variant_new ("(b)", TRUE)); + g_dbus_method_invocation_return_value (invocation, g_variant_new ("(s)", "yes")); } else if (strcmp (method_name, "CanHibernate") == 0) { check_status ("CONSOLE-KIT CAN-HIBERNATE"); - g_dbus_method_invocation_return_value (invocation, g_variant_new ("(b)", TRUE)); + g_dbus_method_invocation_return_value (invocation, g_variant_new ("(s)", "yes")); } else if (strcmp (method_name, "CloseSession") == 0) g_dbus_method_invocation_return_value (invocation, g_variant_new ("(b)", TRUE)); @@ -1525,10 +1525,10 @@ ck_name_acquired_cb (GDBusConnection *connection, " <arg name='can_stop' direction='out' type='b'/>" " </method>" " <method name='CanSuspend'>" - " <arg name='can_suspend' direction='out' type='b'/>" + " <arg name='can_suspend' direction='out' type='s'/>" " </method>" " <method name='CanHibernate'>" - " <arg name='can_hibernate' direction='out' type='b'/>" + " <arg name='can_hibernate' direction='out' type='s'/>" " </method>" " <method name='CloseSession'>" " <arg name='cookie' direction='in' type='s'/>" |