Control: reassign -1 lightdm 1.8.5-2 Control: retitle -1 lightdm_get_can_hibernate and lightdm_get_can_restart return FALSE after first login/logout
On 2013-12-19 15:09:01 +0100, Vincent Lefevre wrote: > Package: lightdm-gtk-greeter > Version: 1.6.1-4 > Severity: normal > > Initially the following buttons are present in the top-right menu: > > Suspend > Hibernate > Restart... > Shutdown... > > But after the first login/logout, the Hibernate and Restart ones > disappear. I don't see any reason for that. This is not a bug in lightdm-gtk-greeter itself, as the greeter just calls the lightdm_get_can_* functions to decide whether the menu items should be visible or not. If I modify the liblightdm-gobject/power.c lightdm file to return TRUE in all these functions, the problem no longer occurs. So, this confirms that the problem comes from there. Thus reassigning. I've tried to add some debug messages in these functions, but they do not appear in the log files! I've attached the patch I've used. -- Vincent Lefèvre <vinc...@vinc17.net> - Web: <http://www.vinc17.net/> 100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/> Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
--- liblightdm-gobject/power.c 2013-10-09 05:16:00.000000000 +0200 +++ liblightdm-gobject/power.c 2013-12-20 16:13:29.559203457 +0100 @@ -88,6 +88,7 @@ gboolean can_suspend = FALSE; GVariant *r; + g_debug ("lightdm_get_can_suspend: calling login1_call_function (CanSuspend)"); r = login1_call_function ("CanSuspend", NULL, NULL); if (r) { @@ -96,18 +97,23 @@ { g_variant_get (r, "(&s)", &result); can_suspend = g_strcmp0 (result, "yes") == 0; + g_debug ("lightdm_get_can_suspend: can_suspend == %d via login1_call_function", (int) can_suspend); } } else { + g_debug ("lightdm_get_can_suspend: calling upower_call_function (SuspendAllowed)"); r = upower_call_function ("SuspendAllowed", NULL); if (r && g_variant_is_of_type (r, G_VARIANT_TYPE ("(b)"))) + { g_variant_get (r, "(b)", &can_suspend); + g_debug ("lightdm_get_can_suspend: can_suspend == %d via upower_call_function", (int) can_suspend); + } } if (r) g_variant_unref (r); - return can_suspend; + return TRUE; } /** @@ -153,6 +159,7 @@ gboolean can_hibernate = FALSE; GVariant *r; + g_debug ("lightdm_get_can_hibernate: calling login1_call_function (CanHibernate)"); r = login1_call_function ("CanHibernate", NULL, NULL); if (r) { @@ -161,18 +168,23 @@ { g_variant_get (r, "(&s)", &result); can_hibernate = g_strcmp0 (result, "yes") == 0; + g_debug ("lightdm_get_can_hibernate: can_hibernate == %d via login1_call_function", (int) can_hibernate); } } else { + g_debug ("lightdm_get_can_hibernate: calling upower_call_function (HibernateAllowed)"); r = upower_call_function ("HibernateAllowed", NULL); if (r && g_variant_is_of_type (r, G_VARIANT_TYPE ("(b)"))) + { g_variant_get (r, "(b)", &can_hibernate); + g_debug ("lightdm_get_can_hibernate: can_hibernate == %d via upower_call_function", (int) can_hibernate); + } } if (r) g_variant_unref (r); - return can_hibernate; + return TRUE; } /** @@ -248,6 +260,7 @@ gboolean can_restart = FALSE; GVariant *r; + g_debug ("lightdm_get_can_restart: calling login1_call_function (CanReboot)"); r = login1_call_function ("CanReboot", NULL, NULL); if (r) { @@ -256,18 +269,23 @@ { g_variant_get (r, "(&s)", &result); can_restart = g_strcmp0 (result, "yes") == 0; + g_debug ("lightdm_get_can_restart: can_restart == %d via login1_call_function", (int) can_restart); } } else { + g_debug ("lightdm_get_can_restart: calling ck_call_function (CanRestart)"); 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); + g_debug ("lightdm_get_can_restart: can_restart == %d via ck_call_function", (int) can_restart); + } } if (r) g_variant_unref (r); - return can_restart; + return TRUE; } /** @@ -310,6 +328,7 @@ gboolean can_shutdown = FALSE; GVariant *r; + g_debug ("lightdm_get_can_shutdown: calling login1_call_function (CanPowerOff)"); r = login1_call_function ("CanPowerOff", NULL, NULL); if (r) { @@ -318,18 +337,23 @@ { g_variant_get (r, "(&s)", &result); can_shutdown = g_strcmp0 (result, "yes") == 0; + g_debug ("lightdm_get_can_shutdown: can_shutdown == %d via login1_call_function", (int) can_shutdown); } } else { + g_debug ("lightdm_get_can_shutdown: calling ck_call_function (CanStop)"); 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); + g_debug ("lightdm_get_can_shutdown: can_shutdown == %d via ck_call_function", (int) can_shutdown); + } } if (r) g_variant_unref (r); - return can_shutdown; + return TRUE; } /**