location: Make _connectToGeoclue() reentrent

https://bugzilla.gnome.org/show_bug.cgi?id=723684
This commit is contained in:
Zeeshan Ali (Khattak) 2014-02-15 15:17:58 +00:00
parent e70e4a21f2
commit 12ef034b7b

View File

@ -41,13 +41,19 @@ const Indicator = new Lang.Class({
}, },
_connectToGeoclue: function() { _connectToGeoclue: function() {
if (this._proxy != null || this._connecting)
return false;
this._connecting = true;
new GeoclueManager(Gio.DBus.system, new GeoclueManager(Gio.DBus.system,
'org.freedesktop.GeoClue2', 'org.freedesktop.GeoClue2',
'/org/freedesktop/GeoClue2/Manager', '/org/freedesktop/GeoClue2/Manager',
Lang.bind(this, this._onProxyReady)); Lang.bind(this, this._onProxyReady));
return true;
}, },
_onProxyReady: function (proxy, error) { _onProxyReady: function (proxy, error) {
this._connecting = false;
if (error != null) { if (error != null) {
log (error.message); log (error.message);
return; return;