|
|
13bb5b |
From 7f19d43041c8402904012c89c53060208efe5016 Mon Sep 17 00:00:00 2001
|
|
|
13bb5b |
From: Ray Strode <rstrode@redhat.com>
|
|
|
13bb5b |
Date: Thu, 13 Nov 2014 09:26:52 -0500
|
|
|
13bb5b |
Subject: [PATCH] loginDialog: only emit session-activated on user action
|
|
|
13bb5b |
|
|
|
13bb5b |
Right now we emit session-activated any time the bullet
|
|
|
13bb5b |
moves in the session menu. That includes at start up when
|
|
|
13bb5b |
picking an item arbitrarily, and any time GDM reports the
|
|
|
13bb5b |
session was read from the user's account settings.
|
|
|
13bb5b |
|
|
|
13bb5b |
session-activated informs GDM about the newly selected session,
|
|
|
13bb5b |
so emitting it in response to GDM reporting a session is a
|
|
|
13bb5b |
bad idea (it's not only pointless, but it can least to
|
|
|
13bb5b |
oscillations)
|
|
|
13bb5b |
|
|
|
13bb5b |
This commit changes the code to only emit session-activated when
|
|
|
13bb5b |
the user explicitly activates a session item from the gear menu.
|
|
|
13bb5b |
---
|
|
|
13bb5b |
js/gdm/loginDialog.js | 6 +-----
|
|
|
13bb5b |
1 file changed, 1 insertion(+), 5 deletions(-)
|
|
|
13bb5b |
|
|
|
13bb5b |
diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js
|
|
|
13bb5b |
index 9ee259f..ec88c73 100644
|
|
|
13bb5b |
--- a/js/gdm/loginDialog.js
|
|
|
13bb5b |
+++ b/js/gdm/loginDialog.js
|
|
|
13bb5b |
@@ -327,90 +327,86 @@ const SessionMenuButton = new Lang.Class({
|
|
|
13bb5b |
this._menu.toggle();
|
|
|
13bb5b |
}));
|
|
|
13bb5b |
|
|
|
13bb5b |
this._items = {};
|
|
|
13bb5b |
this._activeSessionId = null;
|
|
|
13bb5b |
this._populate();
|
|
|
13bb5b |
},
|
|
|
13bb5b |
|
|
|
13bb5b |
updateSensitivity: function(sensitive) {
|
|
|
13bb5b |
this._button.reactive = sensitive;
|
|
|
13bb5b |
this._button.can_focus = sensitive;
|
|
|
13bb5b |
this._menu.close(BoxPointer.PopupAnimation.NONE);
|
|
|
13bb5b |
},
|
|
|
13bb5b |
|
|
|
13bb5b |
_updateOrnament: function() {
|
|
|
13bb5b |
let itemIds = Object.keys(this._items);
|
|
|
13bb5b |
for (let i = 0; i < itemIds.length; i++) {
|
|
|
13bb5b |
if (itemIds[i] == this._activeSessionId)
|
|
|
13bb5b |
this._items[itemIds[i]].setShowDot(true);
|
|
|
13bb5b |
else
|
|
|
13bb5b |
this._items[itemIds[i]].setShowDot(false);
|
|
|
13bb5b |
}
|
|
|
13bb5b |
},
|
|
|
13bb5b |
|
|
|
13bb5b |
setActiveSession: function(sessionId) {
|
|
|
13bb5b |
if (sessionId == this._activeSessionId)
|
|
|
13bb5b |
return;
|
|
|
13bb5b |
|
|
|
13bb5b |
this._activeSessionId = sessionId;
|
|
|
13bb5b |
this._updateOrnament();
|
|
|
13bb5b |
-
|
|
|
13bb5b |
- this.emit('session-activated', this._activeSessionId);
|
|
|
13bb5b |
},
|
|
|
13bb5b |
|
|
|
13bb5b |
close: function() {
|
|
|
13bb5b |
this._menu.close();
|
|
|
13bb5b |
},
|
|
|
13bb5b |
|
|
|
13bb5b |
_populate: function() {
|
|
|
13bb5b |
let ids = Gdm.get_session_ids();
|
|
|
13bb5b |
ids.sort();
|
|
|
13bb5b |
|
|
|
13bb5b |
if (ids.length <= 1) {
|
|
|
13bb5b |
this._button.hide();
|
|
|
13bb5b |
return;
|
|
|
13bb5b |
}
|
|
|
13bb5b |
|
|
|
13bb5b |
for (let i = 0; i < ids.length; i++) {
|
|
|
13bb5b |
let [sessionName, sessionDescription] = Gdm.get_session_name_and_description(ids[i]);
|
|
|
13bb5b |
|
|
|
13bb5b |
let id = ids[i];
|
|
|
13bb5b |
let item = new PopupMenu.PopupMenuItem(sessionName);
|
|
|
13bb5b |
this._menu.addMenuItem(item);
|
|
|
13bb5b |
this._items[id] = item;
|
|
|
13bb5b |
|
|
|
13bb5b |
- if (!this._activeSessionId)
|
|
|
13bb5b |
- this.setActiveSession(id);
|
|
|
13bb5b |
-
|
|
|
13bb5b |
item.connect('activate', Lang.bind(this, function() {
|
|
|
13bb5b |
this.setActiveSession(id);
|
|
|
13bb5b |
+ this.emit('session-activated', this._activeSessionId);
|
|
|
13bb5b |
}));
|
|
|
13bb5b |
}
|
|
|
13bb5b |
}
|
|
|
13bb5b |
});
|
|
|
13bb5b |
Signals.addSignalMethods(SessionMenuButton.prototype);
|
|
|
13bb5b |
|
|
|
13bb5b |
const LoginDialog = new Lang.Class({
|
|
|
13bb5b |
Name: 'LoginDialog',
|
|
|
13bb5b |
|
|
|
13bb5b |
_init: function(parentActor) {
|
|
|
13bb5b |
this.actor = new Shell.GenericContainer({ style_class: 'login-dialog',
|
|
|
13bb5b |
visible: false });
|
|
|
13bb5b |
this.actor.get_accessible().set_role(Atk.Role.WINDOW);
|
|
|
13bb5b |
|
|
|
13bb5b |
this.actor.add_constraint(new Layout.MonitorConstraint({ primary: true }));
|
|
|
13bb5b |
this.actor.connect('allocate', Lang.bind(this, this._onAllocate));
|
|
|
13bb5b |
this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
|
|
|
13bb5b |
parentActor.add_child(this.actor);
|
|
|
13bb5b |
|
|
|
13bb5b |
this._userManager = AccountsService.UserManager.get_default()
|
|
|
13bb5b |
let gdmClient = new Gdm.Client();
|
|
|
13bb5b |
|
|
|
13bb5b |
if (GLib.getenv('GDM_GREETER_TEST') != '1') {
|
|
|
13bb5b |
this._greeter = gdmClient.get_greeter_sync(null);
|
|
|
13bb5b |
|
|
|
13bb5b |
this._greeter.connect('default-session-name-changed',
|
|
|
13bb5b |
Lang.bind(this, this._onDefaultSessionChanged));
|
|
|
13bb5b |
|
|
|
13bb5b |
this._greeter.connect('session-opened',
|
|
|
13bb5b |
Lang.bind(this, this._onSessionOpened));
|
|
|
13bb5b |
--
|
|
|
13bb5b |
2.1.0
|
|
|
13bb5b |
|