-
Matthias Clasen authored
When there are multiple sessions, we may get a polkit dialog after the user confirms the power off dialog. Previously, we didn't handle this situation very nicely, since we were already in the EndSession phase when calling PowerOff, and there is no way back to the Running phase from there, even if the user cancels the polkit dialog. This commit rearranges things so that we call PowerOff before leaving the QueryEndSession phase. To prevent the system from going down right away, we take a delay inhibitor, and listen for the PrepareForShutdown signal to know when we can safely transition into EndSession. If the user cancels the polkit dialog, the PowerOff call fails with an AccessDenied error, which we handle and return to the Running phase. In order to tell gnome-shell that the session is back to running, we call a new Close() method on the EndSessionDialog interface. All of this only works with systemd. The ConsoleKit implementation works the same as before. https://bugzilla.gnome.org/show_bug.cgi?id=688076
1c84d283