Use the newly upstreamed container methods
This commit is contained in:
parent
5271ffd35c
commit
bf64eec5c9
|
@ -237,29 +237,25 @@ local function new(data)
|
|||
|
||||
--SWAP / MOVE / REMOVE
|
||||
data:connect_signal("item::swapped",function(_,item1,item2,index1,index2)
|
||||
l.widgets[index1],l.widgets[index2] = l.widgets[index2],l.widgets[index1]
|
||||
l:emit_signal("widget::updated")
|
||||
l:swap(index1, index2)
|
||||
end)
|
||||
data:connect_signal("item::moved",function(_,item,new_idx,old_idx)
|
||||
table.insert(l.widgets,new_idx,table.remove(l.widgets,old_idx))
|
||||
l:emit_signal("widget::updated")
|
||||
local w = l:get_children()[old_idx]
|
||||
l:remove(old_idx)
|
||||
l:insert(new_idx, w)
|
||||
end)
|
||||
data:connect_signal("item::removed",function(_,item,old_idx)
|
||||
table.remove(l.widgets,old_idx)
|
||||
l:emit_signal("widget::updated")
|
||||
l:remove(old_idx)
|
||||
end)
|
||||
data:connect_signal("item::appended",function(_,item)
|
||||
l.widgets[#l.widgets+1] = item.widget
|
||||
l:emit_signal("widget::updated")
|
||||
l:add(item.widget)
|
||||
end)
|
||||
data:connect_signal("widget::added",function(_,item,widget)
|
||||
wibox.layout.fixed.add(l,item.widget)
|
||||
l:emit_signal("widget::updated")
|
||||
end)
|
||||
data:connect_signal("prefix_widget::added",function(_,widget,args)
|
||||
table.insert(pref_l.widgets,1,widget)
|
||||
pref_l:emit_signal("widget::updated")
|
||||
real_l:emit_signal("widget::updated")
|
||||
pref_l:insert(1,widget)
|
||||
end)
|
||||
data:connect_signal("suffix_widget::added",function(_,widget,args)
|
||||
suf_l:add(widget)
|
||||
|
|
Loading…
Reference in New Issue