[gnome-shell] BluetoothStatus: hide the icon when no adapter is present



commit b2bb0bf10f9634c01cfa887cc6c976c75d54e3cc
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Thu Dec 30 15:34:42 2010 +0100

    BluetoothStatus: hide the icon when no adapter is present
    
    There is no point in showing the bluetooth status, when the required
    hardware is missing. Just hide in that case.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=638306

 js/ui/status/bluetooth.js |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/js/ui/status/bluetooth.js b/js/ui/status/bluetooth.js
index 7a6206d..06e16e4 100644
--- a/js/ui/status/bluetooth.js
+++ b/js/ui/status/bluetooth.js
@@ -104,12 +104,18 @@ Indicator.prototype = {
     _updateKillswitch: function() {
         let current_state = this._applet.killswitch_state;
         let on = current_state == GnomeBluetoothApplet.KillswitchState.UNBLOCKED;
+        let has_adapter = current_state != GnomeBluetoothApplet.KillswitchState.NO_ADAPTER;
         let can_toggle = current_state != GnomeBluetoothApplet.KillswitchState.NO_ADAPTER &&
                          current_state != GnomeBluetoothApplet.KillswitchState.HARD_BLOCKED;
 
         this._killswitch.setToggleState(on);
         this._killswitch.actor.reactive = can_toggle;
 
+        if (has_adapter)
+            this.actor.show();
+        else
+            this.actor.hide();
+
         if (on) {
             this._discoverable.actor.show();
             this.setIcon('bluetooth-active');
@@ -130,7 +136,7 @@ Indicator.prototype = {
         let devices = this._applet.get_devices();
 
         for (let i = 0; i < this._deviceItems.length; i++) {
-            let item = this._deviceItems.length;
+            let item = this._deviceItems[i];
             let destroy = true;
             for (let j = 0; j < devices.length; j++) {
                 // we need to deep compare because BluetoothSimpleDevice is a boxed type



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