Skip to content

Commit

Permalink
changes to the settings interface api
Browse files Browse the repository at this point in the history
  • Loading branch information
Pinta365 committed Jul 27, 2024
1 parent 7b53e67 commit ded258d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion EZTrade.toc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

src\Config.lua
src\Utilities.lua
src\SlashCommand.lua
src\OptionsPanel.lua
src\SlashCommand.lua
src\TradePanel.lua
EZTrade.lua
3 changes: 3 additions & 0 deletions src/Config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ EZT.addon = {
version = C_AddOns.GetAddOnMetadata("EZTrade", "Version")
}

--Placeholder for settings category
EZT.settingsCategory = nil

--Default configuration
EZT.addonDefaults = {
debug = false,
Expand Down
12 changes: 10 additions & 2 deletions src/OptionsPanel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,14 @@ EZT.InitOptions = function()
optionsPanel.versionInfo = optionsPanel:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
optionsPanel.versionInfo:SetPoint("BOTTOMRIGHT", optionsPanel, -10, 10)
optionsPanel.versionInfo:SetText(addonName .. " v" .. EZT.addon.version)
--Add panel to interface
InterfaceOptions_AddCategory(optionsPanel)

--Add panel to interface
if InterfaceOptions_AddCategory then
InterfaceOptions_AddCategory(optionsPanel)
else
local category, layout = Settings.RegisterCanvasLayoutCategory(optionsPanel, optionsPanel.name);
Settings.RegisterAddOnCategory(category);
EZT.settingsCategory = category
end

end
6 changes: 5 additions & 1 deletion src/SlashCommand.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ SlashCmdList["EZTrade_CMD"] = function(args)
end

else
InterfaceOptionsFrame_OpenToCategory("EZTrade")
if InterfaceOptionsFrame_OpenToCategory then
InterfaceOptionsFrame_OpenToCategory("EZTrade")
else
Settings.OpenToCategory(EZT.settingsCategory.ID)
end
end
end

0 comments on commit ded258d

Please sign in to comment.