network: being able to use keyboard to connect to a Wireless

https://bugzilla.gnome.org/show_bug.cgi?id=710144
This commit is contained in:
Alejandro Piñeiro 2013-10-14 17:42:55 +02:00 committed by Florian Müllner
parent 4bb41f2f66
commit d175a588f7

View File

@ -559,6 +559,8 @@ const NMWirelessDialogItem = new Lang.Class({
this.actor.grab_key_focus(); this.actor.grab_key_focus();
})); }));
this.actor.connect('key-press-event', Lang.bind(this, this._onKeyPressEvent));
this._content = new St.BoxLayout({ style_class: 'nm-dialog-item-box' }); this._content = new St.BoxLayout({ style_class: 'nm-dialog-item-box' });
this.actor.set_child(this._content); this.actor.set_child(this._content);
@ -604,6 +606,16 @@ const NMWirelessDialogItem = new Lang.Class({
return 'network-workgroup-symbolic'; return 'network-workgroup-symbolic';
else else
return 'network-wireless-signal-' + signalToIcon(this._ap.strength) + '-symbolic'; return 'network-wireless-signal-' + signalToIcon(this._ap.strength) + '-symbolic';
},
_onKeyPressEvent: function(actor, event) {
let symbol = event.get_key_symbol();
if (symbol == Clutter.KEY_space || symbol == Clutter.KEY_Return
|| symbol == Clutter.KEY_KP_Enter) {
this.emit('connect');
return true;
}
return false;
} }
}); });
Signals.addSignalMethods(NMWirelessDialogItem.prototype); Signals.addSignalMethods(NMWirelessDialogItem.prototype);
@ -972,6 +984,9 @@ const NMWirelessDialog = new Lang.Class({
Util.ensureActorVisibleInScrollView(this._scrollView, network.item.actor); Util.ensureActorVisibleInScrollView(this._scrollView, network.item.actor);
this._selectNetwork(network); this._selectNetwork(network);
})); }));
network.item.connect('connect', Lang.bind(this, function() {
this._connect();
}));
}, },
}); });