diff modules/ReAction_PetAction/ReAction_PetAction.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
line wrap: on
line diff
--- a/modules/ReAction_PetAction/ReAction_PetAction.lua	Mon Apr 28 23:34:17 2008 +0000
+++ b/modules/ReAction_PetAction/ReAction_PetAction.lua	Sat May 10 00:08:01 2008 +0000
@@ -27,17 +27,7 @@
     }
   )
   self.buttons = { }
-
-  ReAction:RegisterOptions("global", self, {
-  })
-
-  ReAction:RegisterOptions("bar", self, {
-    type = "group",
-    name = L["Pet Buttons"],
-    hidden = "BarOptionsHidden",
-    args = {
-    }
-  })
+  self.options = setmetatable({},{__mode="k"})
 end
 
 function module:OnEnable()
@@ -133,7 +123,6 @@
           if mode then
             self:showActionIDLabel(b)
           else
-            ReAction:Print("Hiding action id "..b:GetActionID())
             self:hideActionIDLabel(b)
           end
         end
@@ -166,14 +155,21 @@
 function module:hideActionIDLabel(button)
   if button:GetFrame().actionIDLabel then
     button:GetFrame().actionIDLabel:Hide()
-  else
-    ReAction:Print("actionIDLabel not found")
   end
 end
 
----- Options handlers ----
-function module:BarOptionsHidden(bar)
-  return bar.config.type ~= moduleID
+---- Options ----
+function module:GetBarOptions(bar)
+  if not self.options[bar] then
+    self.options[bar] = {
+      type = "group",
+      name = L["Pet Buttons"],
+      hidden = function() return bar.config.type ~= moduleID end,
+      args = {
+      }
+    }
+  end
+  return self.options[bar]
 end