Fixed the bad SV bug
PProvost-35627 [04-04-09 - 21:27]
diff --git a/NinjaPanel.lua b/NinjaPanel.lua
index c43e9b4..2086950 100644
--- a/NinjaPanel.lua
+++ b/NinjaPanel.lua
@@ -5,6 +5,9 @@ local ldb = LibStub:GetLibrary("LibDataBroker-1.1")
local jostle = LibStub:GetLibrary("LibJostle-3.0", true)
local db
+local debugf = tekDebug and tekDebug:GetFrame("NinjaPanel")
+local function Debug(...) if debugf then debugf:AddMessage(string.join(", ", tostringall(...))) end end
+
local eventFrame = CreateFrame("Frame", "NinjaPanelEventFrame", UIParent)
eventFrame:RegisterEvent("ADDON_LOADED")
eventFrame:SetScript("OnEvent", function(self, event, arg1, ...)
@@ -17,6 +20,9 @@ eventFrame:SetScript("OnEvent", function(self, event, arg1, ...)
db.panels = db.panels or {}
db.plugins = db.plugins or {}
+ -- Clean up old SV issues
+ for k,v in pairs(db.plugins) do if type(v.panel) ~= "string" then v.panel = nil end end
+
self:UnregisterEvent("ADDON_LOADED")
NinjaPanel:SpawnPanel("NinjaPanelTop", "TOP")
if db.DEVELOPMENT then
@@ -305,7 +311,7 @@ function NinjaPanel:UpdatePanels()
for name,entry in pairs(self.plugins) do
local opt = db.plugins[name]
if not entry.panel then
- opt.panel = opt.panel and self.panels[opt.panel] or head
+ opt.panel = opt.panel and self.panels[opt.panel].name or head.name
end
self:AttachPlugin(entry, opt.panel)
end
@@ -347,9 +353,10 @@ function NinjaPanel:UpdatePanels()
end
end
-function NinjaPanel:AttachPlugin(plugin, panel)
+function NinjaPanel:AttachPlugin(plugin, panelName)
+ local panel = self.panels[panelName] or self.panels[1]
panel.plugins[plugin.name] = plugin
- plugin.panel = panel
+ plugin.panel = panel.self
plugin.button:SetParent(panel)
end