Quantcast

* Fix for moving the panel to the bottom instead of the top.. kind of

James Whitehead II [04-05-09 - 23:22]
* Fix for moving the panel to the bottom instead of the top.. kind of
Filename
NinjaPanel.lua
diff --git a/NinjaPanel.lua b/NinjaPanel.lua
index 5217353..dfad0b1 100644
--- a/NinjaPanel.lua
+++ b/NinjaPanel.lua
@@ -24,7 +24,13 @@ eventFrame:SetScript("OnEvent", function(self, event, arg1, ...)
 		for k,v in pairs(db.plugins) do if type(v.panel) ~= "string" then v.panel = nil end end

 		self:UnregisterEvent("ADDON_LOADED")
+
+        -- In order to set the bar on the bottom instead of the top
+        -- comment out the first line, and uncomment the second
+
 		NinjaPanel:SpawnPanel("NinjaPanelTop", "TOP")
+        --NinjaPanel:SpawnPanel("NinjaPanelBottom", "BOTTOM")
+
 		if db.DEVELOPMENT then
 			-- Spawn all four bars so we can test
 			NinjaPanel:SpawnPanel("NinjaPanelBottom", "BOTTOM")
@@ -313,8 +319,14 @@ function NinjaPanel:UpdatePanels()
 	local head = self.panels[1]
 	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].name or head.name
+        -- If the plugin hasn't been claimed
+        if not entry.panel then
+            if opt.panel and not self.panels[opt.panel] then
+                -- The assigned panel does not exist
+                -- do nothing, skip
+            else
+                opt.panel = opt.panel and self.panels[opt.panel].name or head.name
+            end
 		end
 		self:AttachPlugin(entry, opt.panel)
 	end