comparison modules/ReAction_PossessBar/ReAction_PossessBar.lua @ 60:44649a10378d

Fixed options handling to create a separate table for each bar instead of a shared table with proxy handler. Also simplified options registration and moved some options around.
author Flick <flickerstreak@gmail.com>
date Sat, 10 May 2008 00:08:01 +0000
parents 7430a8dd4e90
children 768be7eb22a0
comparison
equal deleted inserted replaced
59:7430a8dd4e90 60:44649a10378d
24 buttons = { } 24 buttons = { }
25 } 25 }
26 } 26 }
27 ) 27 )
28 self.buttons = { } 28 self.buttons = { }
29 29 self.options = setmetatable({},{__mode="k"})
30 ReAction:RegisterOptions("global", self, { 30
31 hideEmptyPossess = { 31 ReAction:RegisterOptions(self, {
32 type = "toggle", 32 [moduleID] = {
33 name = L["Hide Empty Possess Bar Buttons"], 33 type = "group",
34 get = function() return self.db.profile.hideEmptyButtons end, 34 name = L["Possess Bar"],
35 set = function(info, val) module:SetHideEmptyButtons(val) end, 35 args = {
36 } 36 hideEmptyPossess = {
37 }) 37 type = "toggle",
38 38 name = L["Hide Empty Possess Bar Buttons"],
39 ReAction:RegisterOptions("bar", self, { 39 get = function() return self.db.profile.hideEmptyButtons end,
40 type = "group", 40 set = function(info, val) module:SetHideEmptyButtons(val) end,
41 name = L["Possess Buttons"], 41 }
42 hidden = "BarOptionsHidden", 42 }
43 args = { 43 }
44 } 44 })
45 })
46 end 45 end
47 46
48 function module:OnEnable() 47 function module:OnEnable()
49 ReAction:RegisterBarType(L["Possess Bar"], 48 ReAction:RegisterBarType(L["Possess Bar"],
50 { 49 {
254 previous = f 253 previous = f
255 end 254 end
256 end 255 end
257 end 256 end
258 257
259 ---- Options handlers ---- 258 ---- Options ----
260 function module:BarOptionsHidden(bar) 259 function module:GetBarOptions(bar)
261 return bar.config.type ~= moduleID 260 if not self.options[bar] then
261 self.options[bar] = {
262 type = "group",
263 name = L["Possess Buttons"],
264 hidden = function() return bar.config.type ~= moduleID end,
265 args = {
266 }
267 }
268 end
269 return self.options[bar]
262 end 270 end
263 271
264 272
265 -- use-count of action IDs 273 -- use-count of action IDs
266 local minActionID = 121 274 local minActionID = 121