# HG changeset patch # User Flick # Date 1290364854 28800 # Node ID a4e7475633b34d23052a8bace0e83e6f04a7baf4 # Parent a5d91d7fd485c6f89a074db04194f0f6f5646180 un-namespace action button config diff -r a5d91d7fd485 -r a4e7475633b3 Profile.lua --- a/Profile.lua Fri Nov 19 23:20:32 2010 -0800 +++ b/Profile.lua Sun Nov 21 10:40:54 2010 -0800 @@ -43,6 +43,20 @@ bf:ResetProfile() end + -- (4) Action is no longer a module, uses the bar config directly + local action = db:GetNamespace("Action",true) or db:RegisterNamespace("Action") + if action then + for name, ac in pairs(action.profile.bars) do + local c = db.profile.bars[name] + if c then + for key, value in pairs(ac) do + c[key] = value + end + end + end + action:ResetProfile() + end + db.profile.dbversion = 1 end diff -r a5d91d7fd485 -r a4e7475633b3 classes/ActionButton.lua --- a/classes/ActionButton.lua Fri Nov 19 23:20:32 2010 -0800 +++ b/classes/ActionButton.lua Sun Nov 21 10:40:54 2010 -0800 @@ -180,7 +180,8 @@ btnHeight = 36, btnRows = 1, btnColumns = 12, - spacing = 3 + spacing = 3, + buttons = { }, }, barType = L["Action Bar"] diff -r a5d91d7fd485 -r a4e7475633b3 modules/Action.lua --- a/modules/Action.lua Fri Nov 19 23:20:32 2010 -0800 +++ b/modules/Action.lua Sun Nov 21 10:40:54 2010 -0800 @@ -19,13 +19,6 @@ -- Event handlers function module:OnInitialize() - self.db = ReAction.db:RegisterNamespace( moduleID, - { - profile = { - bars = { }, - } - } - ) self.handles = setmetatable({ }, weak) ReAction:RegisterBarOptionGenerator(self, "GetBarOptions") @@ -33,8 +26,6 @@ ReAction.RegisterCallback(self, "OnCreateBar") ReAction.RegisterCallback(self, "OnRefreshBar") ReAction.RegisterCallback(self, "OnDestroyBar") - ReAction.RegisterCallback(self, "OnEraseBar") - ReAction.RegisterCallback(self, "OnRenameBar") end function module:OnEnable() @@ -49,14 +40,8 @@ function module:OnCreateBar(event, bar, name) if bar.config.type == moduleID then - local profile = self.db.profile - if profile.bars[name] == nil then - profile.bars[name] = { - buttons = { } - } - end if self.handles[bar] == nil then - self.handles[bar] = Handle:New(bar, profile.bars[name]) + self.handles[bar] = Handle:New(bar) end end end @@ -74,14 +59,6 @@ end end -function module:OnEraseBar(event, bar, name) - self.db.profile.bars[name] = nil -end - -function module:OnRenameBar(event, bar, oldname, newname) - b = self.db.profile.bars - b[newname], b[oldname] = b[oldname], nil -end ---- Interface ---- function module:GetBarOptions(bar) @@ -228,7 +205,8 @@ local meta = { __index = Handle } - function Handle:New( bar, config ) + function Handle:New( bar ) + local config = bar:GetConfig() local self = setmetatable( { bar = bar, @@ -559,29 +537,25 @@ }, } - local function GetBarConfig(bar) - return module.db.profile.bars[bar:GetName()] - end - function PropHandler.GetOptions() return pageOptions end function PropHandler:IsPageDisabled() - local c = GetBarConfig(self.bar) + local c = self.bar:GetConfig() local n = c and c.nPages or 1 return not (n > 1) end function PropHandler:IsPageHidden() - return not GetBarConfig(self.bar) + return not self.bar:GetConfig() end function PropHandler:GetPageValues() if not self._pagevalues then self._pagevalues = { } end - local c = GetBarConfig(self.bar) + local c = self.bar:GetConfig() if c then local n = c.nPages -- cache the results