[gnome-shell] network: Don't use StButtons for items in selector



commit af1f9cd76d561d9de349933ccdd88b34f9e3a92c
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Oct 17 19:04:13 2013 +0200

    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

 data/theme/gnome-shell.css |    7 ++-----
 js/ui/status/network.js    |   23 +++++++++++------------
 2 files changed, 13 insertions(+), 17 deletions(-)
---
diff --git a/data/theme/gnome-shell.css b/data/theme/gnome-shell.css
index 9d7952a..a90412e 100644
--- a/data/theme/gnome-shell.css
+++ b/data/theme/gnome-shell.css
@@ -306,16 +306,13 @@ StScrollBar StButton#vhandle:active {
     font-size: 12pt;
     border-bottom: 1px solid #666;
     padding: 12px;
+    spacing: 20px;
 }
 
-.nm-dialog-item:checked {
+.nm-dialog-item:selected {
     background-color: #333;
 }
 
-.nm-dialog-item-box {
-    spacing: 20px;
-}
-
 .nm-dialog-icons {
     spacing: .5em;
 }
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
index fdd95a7..1df01b6 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -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) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]