[gnome-shell] endSessionDialog: Initialize Polkit permission asynchronously



commit 05b345cc92fe0f58aaacfaa0b3134dbcd20b4916
Author: Jonas Dreßler <verdre v0yd nl>
Date:   Fri Aug 23 14:48:36 2019 +0200

    endSessionDialog: Initialize Polkit permission asynchronously
    
    The updatesPermission is currently initialized synchronously, which
    blocks the Mainloop for quite some time and therefore slows down startup
    of the shell, let's do it asynchronously instead.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/689

 js/ui/endSessionDialog.js | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/js/ui/endSessionDialog.js b/js/ui/endSessionDialog.js
index 0b475b6f96..f51eb7bee0 100644
--- a/js/ui/endSessionDialog.js
+++ b/js/ui/endSessionDialog.js
@@ -352,12 +352,15 @@ class EndSessionDialog extends ModalDialog.ModalDialog {
         }
 
         // It only makes sense to check for this permission if PackageKit is available.
-        try {
-            this._updatesPermission = Polkit.Permission.new_sync(
-                'org.freedesktop.packagekit.trigger-offline-update', null, null);
-        } catch (e) {
-            log('No permission to trigger offline updates: %s'.format(e.toString()));
-        }
+        Polkit.Permission.new(
+            'org.freedesktop.packagekit.trigger-offline-update', null, null,
+            (source, res) => {
+                try {
+                    this._updatesPermission = Polkit.Permission.new_finish(res);
+                } catch (e) {
+                    log(`No permission to trigger offline updates: ${e}`);
+                }
+            });
     }
 
     _onDestroy() {


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