[gnome-shell] loginDialog: Better handle setting the active session



commit 681861c8c76cb96ab2a6199df1153202a5c9e292
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Mon Mar 16 10:54:37 2015 -0700

    loginDialog: Better handle setting the active session
    
    We currently use the setActiveSession method to both mark a menu item as
    selected, and also tell gdm about the current session the user selected.
    
    Since gdm is ultimately in charge of the state, we should decouple this
    and simply ask gdm to set the session, and have the menu item reflect
    what gdm thinks is the current session.
    
    This prevents state getting mismatched and oscillations from happening,
    where we get in a loop of constantly telling gdm what the session is.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=740142

 js/gdm/loginDialog.js |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js
index 6b90bb0..c269cb3 100644
--- a/js/gdm/loginDialog.js
+++ b/js/gdm/loginDialog.js
@@ -323,13 +323,15 @@ const SessionMenuButton = new Lang.Class({
         }
     },
 
-    setActiveSession: function(sessionId) {
+    activeSessionChanged: function(sessionId) {
          if (sessionId == this._activeSessionId)
              return;
 
          this._activeSessionId = sessionId;
          this._updateOrnament();
+    },
 
+    setActiveSession: function(sessionId) {
          this.emit('session-activated', this._activeSessionId);
     },
 
@@ -788,7 +790,7 @@ const LoginDialog = new Lang.Class({
     },
 
     _onDefaultSessionChanged: function(client, sessionId) {
-        this._sessionMenuButton.setActiveSession(sessionId);
+        this._sessionMenuButton.activeSessionChanged(sessionId);
     },
 
     _shouldShowSessionMenuButton: function() {


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