diff gui.lua @ 148:113dd7c86222

Update how LoadOnDemand modules are treated for 6.0. Blizzard API change, different return values. Adds finer-grained handling. Users who don't want to see a module at all can disable the module's "addon", and then later restore it from OL's option tab.
author Farmbuyer of US-Kilrogg <farmbuyer@gmail.com>
date Wed, 07 Jan 2015 17:37:43 -0500
parents e4bfe7a8b1c9
children df0ca8ed1aff
line wrap: on
line diff
--- a/gui.lua	Tue Dec 30 20:26:41 2014 -0500
+++ b/gui.lua	Wed Jan 07 17:37:43 2015 -0500
@@ -300,7 +300,7 @@
 			else
 				what.disabled = true
 				gui.tabtexts[tabtitle] = what -- restore this for mouseovers
-				addon:Print("%s could not load (game client reason was '%s').", tabtitle, whynot)
+				addon:Print("%s could not load and will be disabled (game client reason was '%s').", tabtitle, whynot)
 				DisableAddOn(addon_index)
 			end
 			dirty_tabs = true
@@ -311,9 +311,9 @@
 			-- totally loadable, go for it
 			LOAD()
 		else
-			-- was disabled at addons menu
+			-- probably was disabled at addons menu
 			StaticPopupDialogs["OUROL_LOD_DISABLED"] = flib.StaticPopup{
-				text = tabtitle.." was disabled at the character selection screen.  Do you want to enable it?",
+				text = [[%s is marked "%s".  Do you want to enable and load it?]],
 				button1 = YES,
 				button2 = NO,
 				OnAccept = function()
@@ -327,7 +327,7 @@
 					StaticPopupDialogs["OUROL_LOD_DISABLED"] = nil
 				end,
 			}
-			StaticPopup_Show("OUROL_LOD_DISABLED")
+			StaticPopup_Show ("OUROL_LOD_DISABLED", tabtitle, _G['ADDON_' .. what.LOD_why_not])
 		end
 	end
 
@@ -347,6 +347,17 @@
 		dirty_tabs = true
 	end
 
+	-- Called when the "include disabled plugins" option box is toggled on.
+	function addon:_gui_add_disabled_LOD_tabs()
+		while self._disabled_LOD_modules and #self._disabled_LOD_modules > 0 do
+			local t = tremove(self._disabled_LOD_modules)
+			self:_gui_add_LOD_tab (t.tabtitle, t.folder, t.addon_index, false, 'DISABLED')
+		end
+
+		self._disabled_LOD_modules = nil
+		self._gui_add_disabled_LOD_tabs = flib.nullfunc
+	end
+
 	-- Registering truly arbitrary tab controls, not just text generators.
 	-- (This is slightly out of place, but no more so than the LOD stuff.)
 	-- The arguments are nearly the same as those of :register_text_generator