[gnome-shell] screenShield: Drop fallback implementation



commit 3b1e536822d8a925d5dbb410e69414b5455bbf93
Author: Florian Müllner <fmuellner gnome org>
Date:   Mon Mar 4 19:33:36 2013 +0100

    screenShield: Drop fallback implementation
    
    With fallback mode gone, we can no longer rely on gnome-screensaver
    being installed. Rather than handling three different cases (GDM,
    gnome-screensaver, no lock), disable the lock functionality when
    not running under GDM.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=693403

 js/ui/main.js         |    4 +--
 js/ui/screenShield.js |   59 -------------------------------------------------
 js/ui/userMenu.js     |    8 ++++--
 3 files changed, 6 insertions(+), 65 deletions(-)
---
diff --git a/js/ui/main.js b/js/ui/main.js
index 229acc4..c95be0a 100644
--- a/js/ui/main.js
+++ b/js/ui/main.js
@@ -82,7 +82,7 @@ function _sessionUpdated() {
                                   Shell.KeyBindingMode.NORMAL |
                                   Shell.KeyBindingMode.OVERVIEW,
                                   sessionMode.hasRunDialog ? openRunDialog : null);
-    if (sessionMode.isGreeter)
+    if (sessionMode.isGreeter && screenShield)
         screenShield.showDialog();
 }
 
@@ -142,8 +142,6 @@ function startSession() {
     magnifier = new Magnifier.Magnifier();
     if (LoginManager.canLock())
         screenShield = new ScreenShield.ScreenShield();
-    else
-        screenShield = new ScreenShield.ScreenShieldFallback();
 
     panel = new Panel.Panel();
     messageTray = new MessageTray.MessageTray();
diff --git a/js/ui/screenShield.js b/js/ui/screenShield.js
index 4580814..57d5ac5 100644
--- a/js/ui/screenShield.js
+++ b/js/ui/screenShield.js
@@ -1178,62 +1178,3 @@ const ScreenShield = new Lang.Class({
     },
 });
 Signals.addSignalMethods(ScreenShield.prototype);
-
-/* Fallback code to handle session locking using gnome-screensaver,
-   in case the required GDM dependency is not there
-*/
-const ScreenShieldFallback = new Lang.Class({
-    Name: 'ScreenShieldFallback',
-
-    _init: function() {
-        Util.spawn(['gnome-screensaver']);
-
-        this._proxy = new Gio.DBusProxy({ g_connection: Gio.DBus.session,
-                                          g_name: 'org.gnome.ScreenSaver',
-                                          g_object_path: '/org/gnome/ScreenSaver',
-                                          g_interface_name: 'org.gnome.ScreenSaver',
-                                          g_flags: (Gio.DBusProxyFlags.DO_NOT_AUTO_START |
-                                                    Gio.DBusProxyFlags.DO_NOT_LOAD_PROPERTIES),
-                                        });
-        this._proxy.init(null);
-
-        this._proxy.connect('g-signal', Lang.bind(this, this._onSignal));
-        this._proxy.connect('notify::g-name-owner', Lang.bind(this, this._onNameOwnerChanged));
-    },
-
-    _onNameOwnerChanged: function(object, pspec) {
-        if (this._proxy.g_name_owner)
-            [this._locked] = this._proxy.call_sync('GetActive', null,
-                                                   Gio.DBusCallFlags.NONE, -1, null).deep_unpack();
-        else
-            this._locked = false;
-
-        this.emit('active-changed', this._locked);
-    },
-
-    _onSignal: function(proxy, senderName, signalName, params) {
-        if (signalName == 'ActiveChanged') {
-            [this._locked] = params.deep_unpack();
-            this.emit('active-changed', this._locked);
-        }
-    },
-
-    get locked() {
-        return this._locked;
-    },
-
-    lock: function() {
-        this._proxy.call('Lock', null, Gio.DBusCallFlags.NONE, -1, null,
-                         Lang.bind(this, function(proxy, result) {
-                             proxy.call_finish(result);
-
-                             this.emit('lock-screen-shown');
-                         }));
-    },
-
-    unlock: function() {
-        this._proxy.call('SetActive', GLib.Variant.new('(b)', false),
-                         Gio.DBusCallFlags.NONE, -1, null, null);
-    },
-});
-Signals.addSignalMethods(ScreenShieldFallback.prototype);
diff --git a/js/ui/userMenu.js b/js/ui/userMenu.js
index d784e75..c6b60a6 100644
--- a/js/ui/userMenu.js
+++ b/js/ui/userMenu.js
@@ -600,7 +600,8 @@ const UserMenuButton = new Lang.Class({
                                        Lang.bind(this, this._updateHaveShutdown));
 
         Main.sessionMode.connect('updated', Lang.bind(this, this._sessionUpdated));
-        Main.screenShield.connect('locked-changed', Lang.bind(this, this._updatePresenceIcon));
+        if (Main.screenShield)
+            Main.screenShield.connect('locked-changed', Lang.bind(this, this._updatePresenceIcon));
         this._sessionUpdated();
     },
 
@@ -656,7 +657,7 @@ const UserMenuButton = new Lang.Class({
 
     _updateLockScreen: function() {
         let allowLockScreen = !this._lockdownSettings.get_boolean(DISABLE_LOCK_SCREEN_KEY);
-        this._lockScreenItem.actor.visible = allowLockScreen;
+        this._lockScreenItem.actor.visible = allowLockScreen && LoginManager.canLock();
     },
 
     _updateInstallUpdates: function() {
@@ -864,7 +865,8 @@ const UserMenuButton = new Lang.Class({
     _onLoginScreenActivate: function() {
         this.menu.close(BoxPointer.PopupAnimation.NONE);
         Main.overview.hide();
-        Main.screenShield.lock(false);
+        if (Main.screenShield)
+            Main.screenShield.lock(false);
         Gdm.goto_login_session_sync(null);
     },
 


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