From 448275a3865d1db82a6fc37d60548da8b865e5e0 Mon Sep 17 00:00:00 2001 From: "Adrian C. (anrxc)" Date: Fri, 2 Apr 2010 01:08:12 +0200 Subject: widgets: reuse existing datasets where appropriate Gmail, mbox, raid, weather and wifi could return the old value in case there isn't new data, no need for N/A to be so common on our wibox. --- widgets/weather.lua | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'widgets/weather.lua') diff --git a/widgets/weather.lua b/widgets/weather.lua index 7a114c0..f54fbc3 100644 --- a/widgets/weather.lua +++ b/widgets/weather.lua @@ -17,24 +17,24 @@ local helpers = require("vicious.helpers") module("vicious.widgets.weather") +-- Initialize function tables +local weather = { + ["{city}"] = "N/A", + ["{wind}"] = "N/A", + ["{windmph}"] = "N/A", + ["{windkmh}"] = "N/A", + ["{sky}"] = "N/A", + ["{weather}"] = "N/A", + ["{tempf}"] = "N/A", + ["{tempc}"] = "N/A", + ["{humid}"] = "N/A", + ["{press}"] = "N/A" +} + -- {{{ Weather widget type local function worker(format, warg) if not warg then return end - -- Default values - local weather = { - ["{city}"] = "N/A", - ["{wind}"] = "N/A", - ["{windmph}"] = "N/A", - ["{windkmh}"] = "N/A", - ["{sky}"] = "N/A", - ["{weather}"] = "N/A", - ["{tempf}"] = "N/A", - ["{tempc}"] = "N/A", - ["{humid}"] = "N/A", - ["{press}"] = "N/A" - } - -- Get weather forceast by the station ICAO code, from: -- * US National Oceanic and Atmospheric Administration local noaa = "http://weather.noaa.gov/pub/data/observations/metar/decoded/" -- cgit v1.2.3