network: Don't use StButtons for items in selector

Their use blocks activation of the default button by keyboard, which
is important for accessibility. Use a Clutter.ClickAction instead,
which doesn't have this problem as it only considers mouse events.

https://bugzilla.gnome.org/show_bug.cgi?id=710144
This commit is contained in:
Florian Müllner 2013-10-17 19:04:13 +02:00
parent 2f39f3d146
commit af1f9cd76d
2 changed files with 15 additions and 19 deletions

View File

@ -306,16 +306,13 @@ StScrollBar StButton#vhandle:active {
font-size: 12pt;
border-bottom: 1px solid #666;
padding: 12px;
}
.nm-dialog-item:checked {
background-color: #333;
}
.nm-dialog-item-box {
spacing: 20px;
}
.nm-dialog-item:selected {
background-color: #333;
}
.nm-dialog-icons {
spacing: .5em;
}

View File

@ -549,31 +549,30 @@ const NMWirelessDialogItem = new Lang.Class({
this._network = network;
this._ap = network.accessPoints[0];
this.actor = new St.Button({ style_class: 'nm-dialog-item',
can_focus: true,
x_fill: true });
this.actor = new St.BoxLayout({ style_class: 'nm-dialog-item',
can_focus: true,
reactive: true });
this.actor.connect('key-focus-in', Lang.bind(this, function() {
this.emit('selected');
}));
this.actor.connect('clicked', Lang.bind(this, function() {
let action = new Clutter.ClickAction();
action.connect('clicked', Lang.bind(this, function() {
this.actor.grab_key_focus();
}));
this._content = new St.BoxLayout({ style_class: 'nm-dialog-item-box' });
this.actor.set_child(this._content);
this.actor.add_action(action);
let title = ssidToLabel(this._ap.get_ssid());
this._label = new St.Label({ text: title });
this.actor.label_actor = this._label;
this._content.add(this._label, { x_align: St.Align.START });
this.actor.add(this._label, { x_align: St.Align.START });
this._selectedIcon = new St.Icon({ style_class: 'nm-dialog-icon',
icon_name: 'object-select-symbolic' });
this._content.add(this._selectedIcon);
this.actor.add(this._selectedIcon);
this._icons = new St.BoxLayout({ style_class: 'nm-dialog-icons' });
this._content.add(this._icons, { expand: true, x_fill: false, x_align: St.Align.END });
this.actor.add(this._icons, { expand: true, x_fill: false, x_align: St.Align.END });
this._secureIcon = new St.Icon({ style_class: 'nm-dialog-icon' });
if (this._ap._secType != NMAccessPointSecurity.NONE)
@ -956,13 +955,13 @@ const NMWirelessDialog = new Lang.Class({
_selectNetwork: function(network) {
if (this._selectedNetwork)
this._selectedNetwork.item.actor.checked = false;
this._selectedNetwork.item.actor.remove_style_pseudo_class('selected');
this._selectedNetwork = network;
this._updateSensitivity();
if (this._selectedNetwork)
this._selectedNetwork.item.actor.checked = true;
this._selectedNetwork.item.actor.add_style_pseudo_class('selected');
},
_createNetworkItem: function(network) {