Mercurial > wow > reaction
diff modules/VehicleExit.lua @ 222:d08a74e86c96
un-namespace totem, pet, stance, vehicle exit
author | Flick <flickerstreak@gmail.com> |
---|---|
date | Sun, 21 Nov 2010 14:42:38 -0800 |
parents | e63aefb8a555 |
children | c4b134512c50 |
line wrap: on
line diff
--- a/modules/VehicleExit.lua Sun Nov 21 12:51:24 2010 -0800 +++ b/modules/VehicleExit.lua Sun Nov 21 14:42:38 2010 -0800 @@ -21,13 +21,6 @@ -- module methods function module:OnInitialize() - self.db = ReAction.db:RegisterNamespace( moduleID, - { - profile = { - buttons = { } - } - } - ) self.registered = { } self.buttons = { } @@ -36,8 +29,6 @@ ReAction.RegisterCallback(self, "OnCreateBar") ReAction.RegisterCallback(self, "OnDestroyBar") ReAction.RegisterCallback(self, "OnRefreshBar") - ReAction.RegisterCallback(self, "OnEraseBar") - ReAction.RegisterCallback(self, "OnRenameBar") end function module:OnEnable() @@ -55,18 +46,16 @@ end function module:OnRefreshBar(event, bar, name) - if bar.config.type == moduleID then - local profile = self.db.profile - if profile.buttons[name] == nil then - profile.buttons[name] = {} + local config = bar:GetConfig() + if config.type == moduleID then + if not config.buttons then + config.buttons = { } end - local btnCfg = profile.buttons[name] + local btnCfg = config.buttons + btnCfg[1] = btnCfg[1] or { } - if profile.buttons[name] == nil then - profile.buttons[name] = { } - end if self.buttons[bar] == nil then - local success, r = pcall(Button.New, Button, 1, profile.buttons[name], bar) + local success, r = pcall(Button.New, Button, 1, btnCfg[1], bar) if success and r then self.buttons[bar] = r bar:AddButton(1,r) @@ -86,19 +75,10 @@ end end -function module:OnEraseBar(event, bar, name) - self.db.profile.buttons[name] = nil -end - -function module:OnRenameBar(event, bar, oldname, newname) - local b = self.db.profile.buttons - b[newname], b[oldname] = b[oldname], nil -end - function module:UpdateRegistration(bar) -- auto show/hide when on a vehicle - local config = self.db.profile.buttons[bar:GetName()] + local config = bar:GetConfig() local f = bar:GetFrame() if config.withControls then if bar.vehicleExitStateRegistered then @@ -128,7 +108,7 @@ end function Handler:GetConfig() - return module.db.profile.buttons[self.bar:GetName()] + return self.bar:GetConfig() end function Handler:GetPassengerOnly()