diff modules/Totem.lua @ 163:ab5c37989986

- totem bar now stores which page was selected across sessions - totem bar shouldn't be messed up if resized around on non-shaman toons now
author Flick <flickerstreak@gmail.com>
date Sat, 22 Aug 2009 00:12:44 +0000
parents fc08372f0c7a
children 363dd8130205
line wrap: on
line diff
--- a/modules/Totem.lua	Fri Aug 21 23:50:17 2009 +0000
+++ b/modules/Totem.lua	Sat Aug 22 00:12:44 2009 +0000
@@ -83,17 +83,19 @@
     local btnCfg = profile.buttons[name]
 
     local r, c = bar:GetButtonGrid()
-    local n = r*c
-    n = min(n,Button.SetupBarHeader(bar))
+    local n = min(r*c,6)
+    Button.SetupBarHeader(bar)
     for i = 1, n do
       if btnCfg[i] == nil then
         btnCfg[i] = {}
       end
       if btns[i] == nil then
         local success, r = pcall(Button.New,Button,i,btnCfg,bar)
-        if success and r then
+        if success then
           btns[i] = r
-          bar:AddButton(i,r)
+          if r then
+            bar:AddButton(i,r)
+          end
         else
           geterrorhandler()(r)
           n = i - 1
@@ -101,7 +103,9 @@
           break
         end
       end
-      btns[i]:Refresh()
+      if btns[i] then
+        btns[i]:Refresh()
+      end
     end
     for i = n+1, #btns do
       if btns[i] then