[gnome-shell] loginDialog: only emit session-activated on user action



commit e1d9bdbbd61d03cd6d3c5dec79b398122aeff832
Author: Ray Strode <rstrode redhat com>
Date:   Thu Nov 13 09:26:52 2014 -0500

    loginDialog: only emit session-activated on user action
    
    Right now we emit session-activated any time the bullet
    moves in the session menu. That includes at startup when
    picking an item arbitrarily, and any time GDM reports the
    session was read from the user's account settings.
    
    session-activated informs GDM about the newly selected session,
    so emitting it in response to GDM reporting a session is a
    bad idea.
    
    This commit changes the code to only emit session-activated when
    the user explicitly activates a session item from the gear menu.
    
    Note, we no longer set the active session explicitly at start up.
    This is a good thing since the item we were picking wasn't
    necessarily correct.  It does means if GDM fails to inform us
    about the correct default session we'll now show no bullet instead
    of a bullet on the wrong item.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=740142

 js/gdm/loginDialog.js | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
---
diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js
index dd7116ce3..aafa9636a 100644
--- a/js/gdm/loginDialog.js
+++ b/js/gdm/loginDialog.js
@@ -380,8 +380,6 @@ var SessionMenuButton = new Lang.Class({
 
          this._activeSessionId = sessionId;
          this._updateOrnament();
-
-         this.emit('session-activated', this._activeSessionId);
     },
 
     close: function() {
@@ -405,11 +403,9 @@ var SessionMenuButton = new Lang.Class({
             this._menu.addMenuItem(item);
             this._items[id] = item;
 
-            if (!this._activeSessionId)
-                this.setActiveSession(id);
-
             item.connect('activate', Lang.bind(this, function() {
                 this.setActiveSession(id);
+                this.emit('session-activated', this._activeSessionId);
             }));
         }
     }


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