diff modules/ReAction_Action/ReAction_Action.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_Action/ReAction_Action.lua	Mon Apr 28 23:34:17 2008 +0000
+++ b/modules/ReAction_Action/ReAction_Action.lua	Sat May 10 00:08:01 2008 +0000
@@ -27,23 +27,22 @@
     }
   )
   self.buttons = { }
+  self.options = setmetatable({},{__mode="k"})
 
-  ReAction:RegisterOptions("global", self, {
-    hideEmpty = {
-      type = "toggle",
-      name = L["Hide Empty Buttons"],
-      get  = function() return self.db.profile.hideEmptyButtons end,
-      set  = function(info, val) module:SetHideEmptyButtons(val) end,
-    }
-  })
-
-  ReAction:RegisterOptions("bar", self, {
-    type = "group",
-    name = L["Action Buttons"],
-    hidden = "BarOptionsHidden",
-    args = {
-    }
-  })
+  ReAction:RegisterOptions(self, {
+      [moduleID] = {
+        type = "group",
+        name = L["Action Bars"],
+        args = {
+          hideEmpty = {
+            type = "toggle",
+            name = L["Hide Empty Buttons"],
+            get  = function() return self.db.profile.hideEmptyButtons end,
+            set  = function(info, val) module:SetHideEmptyButtons(val) end,
+          }
+        }
+      }
+    })
 end
 
 function module:OnEnable()
@@ -178,9 +177,18 @@
 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["Action Buttons"],
+      hidden = function() return bar.config.type ~= moduleID end,
+      args = {
+      }
+    }
+  end
+  return self.options[bar]
 end