Skip to content

Commit

Permalink
Fix dropdown configs
Browse files Browse the repository at this point in the history
  • Loading branch information
solocommand committed Jul 26, 2024
1 parent d405a17 commit 465fa7c
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,15 @@ local function buildCheckbox(key, order)
name = L[key],
order = order or 0,
desc = L[key.."Description"],
get = function(info) return addon.db[info[#info]] end,
set = function(info, value) return addon:setDB(info[#info], value) end,
}
end

local function buildDropdown(key, label, opts, order)
local function buildDropdown(label, opts, order)
return {
type = 'select',
name = label,
order = order or 0,
values = opts,
disabled = true, -- @todo fix dropdowns!
get = function(info) return addon.db[info[#info]] end,
set = function(info, value) addon.setDB(info[#info], value) end,
style = 'dropdown',
}
end
Expand All @@ -30,6 +25,8 @@ local function build()
local t = {
name = "Socialite",
type = 'group',
get = function(info) return addon.db[info[#info]] end,
set = function(info, value) return addon:setDB(info[#info], value) end,
args = {
showMinimapIcon = {
type = 'toggle',
Expand All @@ -49,7 +46,6 @@ local function build()
name = L.showInAddonCompartment,
desc = L.showInAddonCompartmentDescription,
order = 1,
get = function(info) return addon.db[info[#info]] end,
set = function(info, value)
addon:setDB(info[#info], value)
if value then
Expand Down Expand Up @@ -95,12 +91,12 @@ local function build()
order = 30,
args = {
-- @todo review these, they don't seem to work!
ShowStatus = buildDropdown("ShowStatus", L.MENU_STATUS, {
ShowStatus = buildDropdown(L.MENU_STATUS, {
icon = L.MENU_STATUS_ICON,
text = L.MENU_STATUS_TEXT,
none = L.MENU_STATUS_NONE,
}, 31),
TooltipInteraction = buildDropdown("TooltipInteraction", L.MENU_INTERACTION, {
TooltipInteraction = buildDropdown(L.MENU_INTERACTION, {
always = L.MENU_INTERACTION_ALWAYS,
outofcombat = L.MENU_INTERACTION_OOC,
never = L.MENU_INTERACTION_NEVER,
Expand All @@ -125,7 +121,7 @@ local function build()
},
GuildSort = buildCheckbox("GuildSort", 47),
-- @todo
GuildSortKey = buildDropdown("GuildSortKey", L.MENU_GUILD_SORT, {
GuildSortKey = buildDropdown(L.MENU_GUILD_SORT, {
name = L.MENU_GUILD_SORT_NAME,
rank = L.MENU_GUILD_SORT_RANK,
class = L.MENU_GUILD_SORT_CLASS,
Expand All @@ -142,6 +138,6 @@ local function build()
return t
end

LibStub("AceConfig-3.0"):RegisterOptionsTable("Socialite", build, "/socialite")
LibStub("AceConfig-3.0"):RegisterOptionsTable("Socialite", build)
addon.optionsFrame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions(addonName, "Socialite")
-- LibStub("AceConsole-3.0"):RegisterChatCommand("socialite", function() Settings.OpenToCategory(addonName) end)
LibStub("AceConsole-3.0"):RegisterChatCommand("socialite", function() Settings.OpenToCategory(addonName) end)

0 comments on commit 465fa7c

Please sign in to comment.