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/wifi.lua | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'widgets/wifi.lua') diff --git a/widgets/wifi.lua b/widgets/wifi.lua index 61dee12..2e400bc 100644 --- a/widgets/wifi.lua +++ b/widgets/wifi.lua @@ -21,20 +21,20 @@ local string = { module("vicious.widgets.wifi") +-- Initialize function tables +local winfo = { + ["{ssid}"] = "N/A", + ["{mode}"] = "N/A", + ["{chan}"] = 0, + ["{rate}"] = 0, + ["{link}"] = 0, + ["{sign}"] = 0 +} + -- {{{ Wireless widget type local function worker(format, warg) if not warg then return end - -- Default values - local winfo = { - ["{ssid}"] = "N/A", - ["{mode}"] = "N/A", - ["{chan}"] = 0, - ["{rate}"] = 0, - ["{link}"] = 0, - ["{sign}"] = 0 - } - -- Get data from iwconfig where available local iwconfig = "/sbin/iwconfig" local f = io.open(iwconfig, "rb") -- cgit v1.2.3