awful.widget.layoutbox: use attached_add_signal

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2009-08-18 16:44:14 +02:00
parent 121a229492
commit d7a961175f

View file

@ -8,6 +8,7 @@ local setmetatable = setmetatable
local ipairs = ipairs
local button = require("awful.button")
local layout = require("awful.layout")
local tag = require("awful.tag")
local beautiful = require("beautiful")
local capi = { image = image,
screen = screen,
@ -41,19 +42,9 @@ function new(screen, args)
return update(w, tag.screen)
end
capi.screen[screen]:add_signal("tag::attach", function(s, tag)
tag:add_signal("property::selected", update_on_tag_selection)
tag:add_signal("property::layout", update_on_tag_selection)
end)
capi.screen[screen]:add_signal("tag::detach", function(s, tag)
tag:remove_signal("property::selected", update_on_tag_selection)
tag:remove_signal("property::layout", update_on_tag_selection)
end)
tag.attached_add_signal(screen, "property::selected", update_on_tag_selection)
tag.attached_add_signal(screen, "property::layout", update_on_tag_selection)
for _, tag in ipairs(capi.screen[screen]:tags()) do
tag:add_signal("property::selected", update_on_tag_selection)
tag:add_signal("property::layout", update_on_tag_selection)
end
return w
end