[gnome-shell] LoginManager: Add canRebootToBootLoaderMenu and setRebootToBootLoaderMenu methods



commit 2af7264cffa2fad65936c76c184b1c6ec5efc284
Author: Hans de Goede <hdegoede redhat com>
Date:   Wed Jul 29 14:22:58 2020 +0200

    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

 .../org.freedesktop.login1.Manager.xml             |  6 ++++++
 js/misc/loginManager.js                            | 24 ++++++++++++++++++++++
 2 files changed, 30 insertions(+)
---
diff --git a/data/dbus-interfaces/org.freedesktop.login1.Manager.xml 
b/data/dbus-interfaces/org.freedesktop.login1.Manager.xml
index 647afc6cfb..f40d498dcc 100644
--- a/data/dbus-interfaces/org.freedesktop.login1.Manager.xml
+++ b/data/dbus-interfaces/org.freedesktop.login1.Manager.xml
@@ -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>
diff --git a/js/misc/loginManager.js b/js/misc/loginManager.js
index 0f9ee1703f..55e928986c 100644
--- a/js/misc/loginManager.js
+++ b/js/misc/loginManager.js
@@ -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([]);
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]