From 1b7b4e982bd80e5ce528827d80e55c73d6053c44 Mon Sep 17 00:00:00 2001 From: Eyal Solnik Date: Fri, 2 Oct 2015 21:34:07 +0300 Subject: [PATCH] Rename functions --- Menu.lua | 52 ++++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/Menu.lua b/Menu.lua index 6040dc7..57d2f1b 100644 --- a/Menu.lua +++ b/Menu.lua @@ -42,13 +42,31 @@ local function getMenuText(text, command) -- We cannot inline this because GetBindingKey may return more than one binding for a single command, -- and so when it returns more than one it messes up GetBindingText and we only need the first one. local binding = GetBindingKey(command) - return text .. " (|cff82c5ff" .. GetBindingText(binding) .. FONT_COLOR_CODE_CLOSE .. ")"; + return text .. " (|cff82c5ff" .. GetBindingText(binding) .. FONT_COLOR_CODE_CLOSE .. ")" else - return text; + return text end end -local function insertItem(name, order) +local function insertItem(text, func) + table.insert(menu, { + text = text, + notCheckable = 1, + func = func, + }) +end + +local function insertSeparator() + if #menu > 0 then + table.insert(menu, { + text = "", + notCheckable = 1, + disabled = true, + }) + end +end + +local function insertInterface(name, order) local interface = addon.display:GetInterface(name) if interface and order > 0 then local inCombat = UnitAffectingCombat("player") @@ -77,24 +95,6 @@ local function insertItem(name, order) end end -local function insertSimpleItem(text, func) - table.insert(menu, { - text = text, - notCheckable = 1, - func = func, - }) -end - -local function insertSeparator() - if #menu > 0 then - table.insert(menu, { - text = "", - notCheckable = 1, - disabled = true, - }) - end -end - local function comp(a, b) return a.order < b.order end @@ -106,20 +106,20 @@ function addon:BuildMenu() wipe(menu) for name, order in pairs(self.db.profile.menu) do - insertItem(name, order) + insertInterface(name, order) end table.sort(menu, comp) if not self.db.profile.hideLogoutButtons then insertSeparator() - insertSimpleItem(LOGOUT, function() + insertItem(LOGOUT, function() Logout() HideUIPanel(GameMenuFrame) end) end if not self.db.profile.hideLogoutButtons then - insertSimpleItem(EXIT_GAME, function() + insertItem(EXIT_GAME, function() Quit() HideUIPanel(GameMenuFrame) end) @@ -127,14 +127,14 @@ function addon:BuildMenu() if not self.db.profile.hideReloadUIButton then insertSeparator() - insertSimpleItem(L["Reload UI"], function() + insertItem(L["Reload UI"], function() ReloadUI() end) end if not self.db.profile.hideOptionsButton then insertSeparator() - insertSimpleItem(L["Options"], function() + insertItem(L["Options"], function() if not InterfaceOptionsFrame:IsVisible() then HideUIPanel(GameMenuFrame) InterfaceOptionsFrame_OpenToCategory(addon.name) -- 1.7.9.5