From e522c715faa56c0d778a7b0acd2f5ab0d4777ea1 Mon Sep 17 00:00:00 2001 From: Neroth Date: Wed, 16 May 2012 04:34:31 +0200 Subject: [PATCH] Changes in weather-settings auto-complete --- src/weather-settings.js.in | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/weather-settings.js.in b/src/weather-settings.js.in index 4fcf54f..921f3d2 100644 --- a/src/weather-settings.js.in +++ b/src/weather-settings.js.in @@ -103,25 +103,19 @@ WeatherSetting.prototype = var testLocation = function(location) { - that.loadJsonAsync(encodeURI("http://query.yahooapis.com/v1/public/yql?format=json&q=select woeid from geo.places where text = '"+location+"' limit 2"),function() + that.loadJsonAsync(encodeURI("http://query.yahooapis.com/v1/public/yql?format=json&q=select woeid from geo.places where text = '"+location+"' limit 1"),function() { d.sensitive = 0; var city = arguments[0].query; - if(typeof city == "object" && typeof city.results == "object") - city = city.results.place; - else + if(typeof city == "object" && city.results == null) return 0; - if(typeof city.woeid == "undefined") - return 0; - else - d.sensitive = 1; + d.sensitive = 1; }); }; entry.signal.changed.connect(function() { var location = entry.get_text(); -print(location); testLocation(location); that.loadJsonAsync(encodeURI("http://query.yahooapis.com/v1/public/yql?q=select woeid,name,admin1,country from geo.places where text = '*"+location+"*' or text = '"+location+"' limit 10&format=json"),function() @@ -166,7 +160,7 @@ print(location); dialog.signal.response.connect(function(w, response_id) { if(response_id) { - that.loadJsonAsync(encodeURI("http://query.yahooapis.com/v1/public/yql?format=json&q=select woeid,name,admin1,country from geo.places where text = '"+entry.get_text()+"'"),function() + that.loadJsonAsync(encodeURI("http://query.yahooapis.com/v1/public/yql?format=json&q=select woeid,name,admin1,country from geo.places where text = '"+entry.get_text()+"' limit 1"),function() { var city = arguments[0].query; if(typeof city == "object" && typeof city.results == "object")