messageTray: Don't add ourselves more than once to CtrlAltTabManager

This way _sessionUpdated() can be called multiple times without side
effects.

https://bugzilla.gnome.org/show_bug.cgi?id=689959
This commit is contained in:
Rui Matos 2012-12-07 12:09:42 +01:00
parent cfacb05461
commit c11f89e72a

View File

@ -1485,6 +1485,7 @@ const MessageTray = new Lang.Class({
this._reNotifyAfterHideNotification = null;
this._inFullscreen = false;
this._desktopClone = null;
this._inCtrlAltTab = false;
this._lightbox = new Lightbox.Lightbox(global.window_group,
{ inhibitEvents: true,
@ -1562,12 +1563,15 @@ const MessageTray = new Lang.Class({
},
_sessionUpdated: function() {
if (Main.sessionMode.isLocked || Main.sessionMode.isGreeter)
if ((Main.sessionMode.isLocked || Main.sessionMode.isGreeter) && this._inCtrlAltTab) {
Main.ctrlAltTabManager.removeGroup(this._summary);
else
this._inCtrlAltTab = false;
} else if (!this._inCtrlAltTab) {
Main.ctrlAltTabManager.addGroup(this._summary, _("Message Tray"), 'user-available-symbolic',
{ focusCallback: Lang.bind(this, this.toggleAndNavigate),
sortGroup: CtrlAltTab.SortGroup.BOTTOM });
this._inCtrlAltTab = true;
}
this._updateState();
},