File gnome-shell-hide-authentication-dialogs-while-locked.patch of Package gnome-shell.openSUSE_Leap_42.3_Update

Index: gnome-shell-3.20.4/js/ui/components/polkitAgent.js
===================================================================
--- gnome-shell-3.20.4.orig/js/ui/components/polkitAgent.js
+++ gnome-shell-3.20.4/js/ui/components/polkitAgent.js
@@ -19,6 +19,7 @@ const ModalDialog = imports.ui.modalDial
 const ShellEntry = imports.ui.shellEntry;
 const UserWidget = imports.ui.userWidget;
 const Tweener = imports.ui.tweener;
+const Main = imports.ui.main;
 
 const DIALOG_ICON_SIZE = 48;
 
@@ -38,6 +39,10 @@ const AuthenticationDialog = new Lang.Cl
         this.userNames = userNames;
         this._wasDismissed = false;
 
+        this._sessionUpdatedId = Main.sessionMode.connect('updated', Lang.bind(this, function() {
+            this._group.visible = !Main.sessionMode.isLocked;
+        }));
+
         let mainContentBox = new St.BoxLayout({ style_class: 'prompt-dialog-main-layout',
                                                 vertical: false });
         this.contentLayout.add(mainContentBox,
@@ -362,6 +367,14 @@ const AuthenticationDialog = new Lang.Cl
         }
     },
 
+    close: function(timestamp) {
+        this.parent(timestamp);
+
+        if (this._sessionUpdatedId)
+            Main.sessionMode.disconnect(this._sessionUpdatedId);
+        this._sessionUpdatedId = 0;
+    },
+
     cancel: function() {
         this._wasDismissed = true;
         this.close(global.get_current_time());
Index: gnome-shell-3.20.4/js/ui/shellMountOperation.js
===================================================================
--- gnome-shell-3.20.4.orig/js/ui/shellMountOperation.js
+++ gnome-shell-3.20.4/js/ui/shellMountOperation.js
@@ -331,6 +331,10 @@ const ShellMountPasswordDialog = new Lan
         let strings = message.split('\n');
         this.parent({ styleClass: 'prompt-dialog' });
 
+        this._sessionUpdatedId = Main.sessionMode.connect('updated', Lang.bind(this, function() {
+            this._group.visible = !Main.sessionMode.isLocked;
+        }));
+
         let mainContentBox = new St.BoxLayout({ style_class: 'prompt-dialog-main-layout',
                                                 vertical: false });
         this.contentLayout.add(mainContentBox);
@@ -413,6 +417,14 @@ const ShellMountPasswordDialog = new Lan
         this._errorMessageLabel.show();
     },
 
+    close: function(timestamp) {
+        this.parent(timestamp);
+
+        if (this._sessionUpdatedId)
+            Main.sessionMode.disconnect(this._sessionUpdatedId);
+        this._sessionUpdatedId = 0;
+    },
+
     _onCancelButton: function() {
         this.emit('response', -1, '', false);
     },
@@ -573,6 +585,8 @@ const GnomeShellMountOpHandler = new Lan
         this._dialog = null;
         this._volumeMonitor = Gio.VolumeMonitor.get();
 
+        this._sessionUpdatedId = 0;
+
         this._ensureEmptyRequest();
     },
 
@@ -643,6 +657,17 @@ const GnomeShellMountOpHandler = new Lan
      * attempt went wrong.
      */
     AskPasswordAsync: function(params, invocation) {
+        // Don't pop up a dialog while locked
+        if (Main.sessionMode.isLocked) {
+            this._sessionUpdatedId = Main.sessionMode.connect('updated', Lang.bind(this, function() {
+                Main.sessionMode.disconnect(this._sessionUpdatedId);
+                this._sessionUpdatedId = 0;
+
+                this.AskPasswordAsync(params, invocation);
+            }));
+            return;
+        }
+
         let [id, message, iconName, defaultUser, defaultDomain, flags] = params;
 
         if (this._setCurrentRequest(invocation, id, ShellMountOperationType.ASK_PASSWORD)) {
@@ -770,5 +795,9 @@ const GnomeShellMountOpHandler = new Lan
     Close: function(params, invocation) {
         this._clearCurrentRequest(Gio.MountOperationResult.UNHANDLED, {});
         this._closeDialog();
+
+        if (this._sessionUpdatedId)
+            Main.sessionMode.disconnect(this._sessionUpdatedId);
+        this._sessionUpdatedId = 0;
     }
 });
openSUSE Build Service is sponsored by