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
This commit is contained in:
Jasper St. Pierre 2015-03-16 10:54:37 -07:00 committed by Ray Strode
parent 6d40cb98e7
commit 681861c8c7

View File

@ -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() {