keyboard: Make sure to set currentSource if we only have one source

This way, popping up and re-closing the switcher won't emit an error
trying to check for this._currentSource.

https://bugzilla.gnome.org/show_bug.cgi?id=693303
This commit is contained in:
Jasper St. Pierre 2013-02-07 03:27:55 -05:00
parent eaf184b585
commit 997f851031

View File

@ -410,6 +410,9 @@ const InputSourceIndicator = new Lang.Class({
let newSourceIndex = this._settings.get_uint(KEY_CURRENT_INPUT_SOURCE); let newSourceIndex = this._settings.get_uint(KEY_CURRENT_INPUT_SOURCE);
let newSource = this._inputSources[newSourceIndex]; let newSource = this._inputSources[newSourceIndex];
let oldSource;
[oldSource, this._currentSource] = [this._currentSource, newSource];
if (!newSource || (nVisibleSources < 2 && !newSource.properties)) { if (!newSource || (nVisibleSources < 2 && !newSource.properties)) {
// This source index might be invalid if we weren't able // This source index might be invalid if we weren't able
// to build a menu item for it, so we hide ourselves since // to build a menu item for it, so we hide ourselves since
@ -424,9 +427,6 @@ const InputSourceIndicator = new Lang.Class({
this.actor.show(); this.actor.show();
let oldSource;
[oldSource, this._currentSource] = [this._currentSource, newSource];
if (oldSource) { if (oldSource) {
oldSource.menuItem.setShowDot(false); oldSource.menuItem.setShowDot(false);
this._container.set_skip_paint(oldSource.indicatorLabel, true); this._container.set_skip_paint(oldSource.indicatorLabel, true);