Quantcast

Made the addon name a constant, in case I decide to rename it at some point

KyrosKrane [06-06-18 - 22:42]
Made the addon name a constant, in case I decide to rename it at some point
Filename
Broker_RaidMakeup.lua
diff --git a/Broker_RaidMakeup.lua b/Broker_RaidMakeup.lua
index cb6b0d8..d5b0a44 100644
--- a/Broker_RaidMakeup.lua
+++ b/Broker_RaidMakeup.lua
@@ -244,6 +244,10 @@ BRM.UnknownIcon = IconClass("Interface\\LFGFRAME\\UI-LFG-ICON-ROLES.blp", 256, 2
 --# Constants
 --#########################################

+-- The strings that define the addon
+BRM.ADDON_NAME="Broker_RaidMakeup" -- the internal addon name for LibStub and other addons
+BRM.USER_ADDON_NAME="Broker_RaidMakeup" -- the name displayed to the user
+
 -- The strings used by the game to represent the roles. I don't think these are localized in the game.
 BRM.ROLE_HEALER = "HEALER"
 BRM.ROLE_TANK = "TANK"
@@ -416,15 +420,15 @@ end -- BRM:UpdateComposition()
 --# Actual LibDataBroker object
 --#########################################

-BRM.LDO = _G.LibStub("LibDataBroker-1.1"):NewDataObject("Broker_RaidMakeup", {
+BRM.LDO = _G.LibStub("LibDataBroker-1.1"):NewDataObject(BRM.ADDON_NAME, {
 	type = "data source",
 	text = BRM:GetDisplayString(),
 	value = "0",
 	icon = BRM.MainIcon:GetIconString(),
-	label = "Broker_RaidMakeup",
+	label = BRM.USER_ADDON_NAME,
 	OnTooltipShow = function(tooltip)
 		if not tooltip or not tooltip.AddLine then return end
-		tooltip:AddLine("Broker_RaidMakeup")
+		tooltip:AddLine(BRM.USER_ADDON_NAME)
 		tooltip:AddLine("Click to refresh")
 	end,
 }) -- BRM.LDO creation
@@ -491,7 +495,7 @@ end -- BRM.Events:PLAYER_LOGIN()
 -- This event is for loading our saved settings.
 function BRM.Events:ADDON_LOADED(addon)
 	BRM:DebugPrint("Got ADDON_LOADED for " .. addon)
-	if addon ~= "Broker_RaidMakeup" then return end
+	if addon ~= BRM.ADDON_NAME then return end


 	--#########################################
@@ -527,7 +531,7 @@ function BRM.Events:ADDON_LOADED(addon)
 	-- So, this is the earliest point we can create the minimap icon.

 	BRM.MinimapIcon = LibStub("LibDBIcon-1.0")
-	BRM.MinimapIcon:Register("Broker_RaidMakeup", BRM.LDO, BRM.DB.MinimapSettings)
+	BRM.MinimapIcon:Register(BRM.ADDON_NAME, BRM.LDO, BRM.DB.MinimapSettings)
 end -- BRM.Events:ADDON_LOADED()