location: Don't show menu if geoclue is totally incapable

If geoclue can't provide location at all (no GPS or network), don't
bother to show controls that don't serve any purpose.

https://bugzilla.gnome.org/show_bug.cgi?id=723684
This commit is contained in:
Zeeshan Ali (Khattak) 2014-02-15 15:46:07 +00:00
parent 32a49b7846
commit 9217f2c916

View File

@ -127,6 +127,7 @@ const Indicator = new Lang.Class({
if (!this._availableAccuracyLevel) { if (!this._availableAccuracyLevel) {
this._availableAccuracyLevel = this._proxy.AvailableAccuracyLevel; this._availableAccuracyLevel = this._proxy.AvailableAccuracyLevel;
this._maxAccuracyLevel = this._availableAccuracyLevel; this._maxAccuracyLevel = this._availableAccuracyLevel;
this._updateMenuVisibility();
} }
this._syncIndicator(); this._syncIndicator();
@ -183,6 +184,10 @@ const Indicator = new Lang.Class({
var variant = new GLib.Variant('u', this._maxAccuracyLevel); var variant = new GLib.Variant('u', this._maxAccuracyLevel);
this._agent.emit_property_changed ('MaxAccuracyLevel', variant); this._agent.emit_property_changed ('MaxAccuracyLevel', variant);
this._userSetAccuracy = false; this._userSetAccuracy = false;
},
_updateMenuVisibility: function() {
this.menu.actor.visible = (this._availableAccuracyLevel != 0);
} }
}); });