widget: Move the identifier index into _private

This commit is contained in:
Emmanuel Lepage Vallee 2016-05-26 14:37:58 -04:00
parent fdf86ba84d
commit 9630f3c3ed
1 changed files with 14 additions and 2 deletions

View File

@ -494,7 +494,13 @@ function base.widget:setup(args)
-- Avoid being dropped by wibox metatable -> drawin -- Avoid being dropped by wibox metatable -> drawin
rawset(self, id, w) rawset(self, id, w)
end end
if rawget(self, "_private") then
self._private.by_id = ids
else
rawset(self, "_by_id", ids) rawset(self, "_by_id", ids)
end
rawset(self, "get_children_by_id", get_children_by_id) rawset(self, "get_children_by_id", get_children_by_id)
end end
@ -514,7 +520,13 @@ function base.make_widget_declarative(args)
local mt = getmetatable(w) or {} local mt = getmetatable(w) or {}
local orig_string = tostring(w) local orig_string = tostring(w)
if rawget(w, "_private") then
w._private.by_id = ids
else
rawset(w, "_by_id", ids) rawset(w, "_by_id", ids)
end
rawset(w, "get_children_by_id", get_children_by_id) rawset(w, "get_children_by_id", get_children_by_id)
mt.__tostring = function() mt.__tostring = function()