GNOME Bugzilla – Bug 764508
power: respect the value of CanSuspend() to show Suspend/Power Off section
Last modified: 2016-04-06 03:34:18 UTC
See patches.
Created attachment 325231 [details] [review] power: remove unneeded call This function is already called from add_suspend_and_power_off_section() a few lines above.
Created attachment 325232 [details] [review] power: move function call into section method This function logically belongs into the section constructor. Move it there.
Created attachment 325233 [details] [review] power: show "Suspend & Power Off" section only when system can suspend Ask logind's D-Bus service 'org.freedesktop.login1.Manager.CanSuspend' to determine whether it should be visible or not, similar to what GDM and the Shell already do.
Created attachment 325234 [details] [review] power: show "Suspend & Power Off" section only when system can suspend Ask logind's D-Bus service 'org.freedesktop.login1.Manager.CanSuspend' to determine whether it should be visible or not, similar to what GDM and the Shell already do.
Review of attachment 325231 [details] [review]: OK.
Review of attachment 325232 [details] [review]: Sure.
Review of attachment 325234 [details] [review]: ::: panels/power/cc-power-panel.c @@ +2477,3 @@ add_power_saving_section (self); + + if (can_suspend (self)) If you can't suspend but can hibernate, then this will hide the "power button" row, which is probably not what we'd want to do.
Created attachment 325449 [details] [review] power: show "Suspend & Power Off" section only when relevant We now ask logind whether the system can suspend or hibernate, and change the visibility of the items in the panel based on that. Based on a patch by Mario Sanchez Prada <mario@endlessm.com>.
Review of attachment 325449 [details] [review]: Looks fine to me.
Attachment 325231 [details] pushed as eb94d06 - power: remove unneeded call Attachment 325232 [details] pushed as 0e54ee8 - power: move function call into section method Attachment 325449 [details] pushed as b1e2bc6 - power: show "Suspend & Power Off" section only when relevant