LoginManager: Add canRebootToBootLoaderMenu and setRebootToBootLoaderMenu methods

Add wrappers for the new logind Manager CanRebootToBootLoaderMenu and
SetRebootToBootLoaderMenu dbus methods.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/199
This commit is contained in:
Hans de Goede 2020-07-29 14:22:58 +02:00 committed by Florian Müllner
parent a96c8d91b5
commit 2af7264cff
2 changed files with 30 additions and 0 deletions

View File

@ -20,6 +20,12 @@
<method name="ListSessions">
<arg name="sessions" type="a(susso)" direction="out"/>
</method>
<method name="CanRebootToBootLoaderMenu">
<arg type="s" direction="out"/>
</method>
<method name="SetRebootToBootLoaderMenu">
<arg type="t" direction="in"/>
</method>
<signal name="PrepareForSleep">
<arg type="b" direction="out"/>
</signal>

View File

@ -158,6 +158,23 @@ var LoginManagerSystemd = class {
});
}
canRebootToBootLoaderMenu(asyncCallback) {
this._proxy.CanRebootToBootLoaderMenuRemote((result, error) => {
if (error) {
asyncCallback(false, false);
} else {
const needsAuth = result[0] === 'challenge';
const canRebootToBootLoaderMenu = needsAuth || result[0] === 'yes';
asyncCallback(canRebootToBootLoaderMenu, needsAuth);
}
});
}
setRebootToBootLoaderMenu() {
/* Parameter is timeout in usec, show to menu for 60 seconds */
this._proxy.SetRebootToBootLoaderMenuRemote(60000000);
}
listSessions(asyncCallback) {
this._proxy.ListSessionsRemote((result, error) => {
if (error)
@ -203,6 +220,13 @@ var LoginManagerDummy = class {
asyncCallback(false, false);
}
canRebootToBootLoaderMenu(asyncCallback) {
asyncCallback(false, false);
}
setRebootToBootLoaderMenu() {
}
listSessions(asyncCallback) {
asyncCallback([]);
}