From f554060ffe3abd29732c8847f9e5bc2503ea58a5 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Tue, 30 Jun 2009 13:56:08 +0200 Subject: [PATCH] telak: use timer Signed-off-by: Julien Danjou --- lib/telak.lua.in | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/telak.lua.in b/lib/telak.lua.in index 6f70afe4..80121435 100644 --- a/lib/telak.lua.in +++ b/lib/telak.lua.in @@ -11,9 +11,9 @@ local http = require("socket.http") local ltn12 = require("ltn12") local setmetatable = setmetatable local util = require("awful.util") -local hooks = require("awful.hooks") local capi = { + timer = timer, wibox = wibox, widget = widget, image = image @@ -55,8 +55,9 @@ local function new(_, args) local wimg = capi.widget({ type = "imagebox" }) w.widgets = wimg - data[w].cb = function () update(w) end - hooks.timer.register(args.timer or 300, data[w].cb) + data[w].timer = capi.timer { timeout = args.timer or 300 } + data[w].timer:add_signal("timeout", function update(w) end) + data[w].timer:start() update(w) @@ -67,7 +68,7 @@ end -- @param w The wibox. function delete(w) if data[w] then - hooks.timer.unregister(data[w].cb) + data[w].timer:stop() data[w] = nil end end