[gnome-shell] location: React to changes in available accuracy level
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] location: React to changes in available accuracy level
- Date: Sat, 15 Feb 2014 17:41:23 +0000 (UTC)
commit 3113bac8e6de00668121f77a7e52a96f298ba105
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Sat Feb 15 16:28:58 2014 +0000
location: React to changes in available accuracy level
GPS could be plugged in and out, network can go up and down and
therefore available accuracy level can also change.
https://bugzilla.gnome.org/show_bug.cgi?id=723684
js/ui/status/location.js | 23 +++++++++++++++--------
1 files changed, 15 insertions(+), 8 deletions(-)
---
diff --git a/js/ui/status/location.js b/js/ui/status/location.js
index 7f68b36..fb78b15 100644
--- a/js/ui/status/location.js
+++ b/js/ui/status/location.js
@@ -41,7 +41,6 @@ const Indicator = new Lang.Class({
this._indicator = this._addIndicator();
this._indicator.icon_name = 'find-location-symbolic';
- this._syncIndicator();
this._item = new PopupMenu.PopupSubMenuMenuItem(_("Location"), true);
this._item.icon.icon_name = 'find-location-symbolic';
@@ -122,14 +121,9 @@ const Indicator = new Lang.Class({
}
this._proxy = proxy;
- this._proxy.connect('g-properties-changed', Lang.bind(this, this._syncIndicator));
-
- if (!this._availableAccuracyLevel) {
- this._availableAccuracyLevel = this._proxy.AvailableAccuracyLevel;
- this._maxAccuracyLevel = this._availableAccuracyLevel;
- this._updateMenuVisibility();
- }
+ this._proxy.connect('g-properties-changed', Lang.bind(this, this._onGeocluePropsChanged));
+ this._updateMenuVisibility();
this._syncIndicator();
this._proxy.AddAgentRemote('gnome-shell', Lang.bind(this, this._onAgentRegistered));
@@ -187,7 +181,20 @@ const Indicator = new Lang.Class({
},
_updateMenuVisibility: function() {
+ this._availableAccuracyLevel = this._proxy.AvailableAccuracyLevel;
+ if (!this._maxAccuracyLevelInitialized) {
+ this._maxAccuracyLevel = this._availableAccuracyLevel;
+ this._maxAccuracyLevelInitialized = true;
+ }
this.menu.actor.visible = (this._availableAccuracyLevel != 0);
+ },
+
+ _onGeocluePropsChanged: function(proxy, properties) {
+ let unpacked = properties.deep_unpack();
+ if ("InUse" in unpacked)
+ this._syncIndicator();
+ if ("AvailableAccuracyLevel" in unpacked)
+ this._updateMenuVisibility();
}
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]