Skip to content

Commit

Permalink
Better handling of ReloadPackage() in settings
Browse files Browse the repository at this point in the history
* When reloading from settings, remember to use {IsSettings = true}
* Upon exitting settings, do a regular ReloadPackage()
  • Loading branch information
homo-programmatis committed Oct 23, 2016
1 parent d97b44a commit 31fa36a
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion _SettingsUI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ end
function g_Addon.SettingsUI_PageRoot_Create()
local frmPage = CreateFrame("Frame", "CatRotationHelper_DlgOptions", UIParent)
frmPage.name = THIS_ADDON_NAME;
frmPage.okay = g_Addon.SettingsUI_PageRoot_Okay;
frmPage.cancel = g_Addon.SettingsUI_PageRoot_Cancel;
InterfaceOptions_AddCategory(frmPage);

frmPage.m_LblHint = frmPage:CreateFontString(nil, 'ARTWORK', 'GameFontNormalLarge');
Expand All @@ -20,6 +22,14 @@ function g_Addon.SettingsUI_PageRoot_Create()
return frmPage;
end

function g_Addon.SettingsUI_PageRoot_Okay()
g_Addon.ReloadPackage();
end

function g_Addon.SettingsUI_PageRoot_Cancel()
g_Addon.ReloadPackage();
end

function g_Addon.SettingsUI_PageFrames_Create(a_FrmParent)
local frmPage = CreateFrame("Frame", a_FrmParent:GetName() .. "_PageFrames", a_FrmParent)
frmPage.name = "Frames";
Expand Down Expand Up @@ -149,7 +159,7 @@ function g_Addon.SettingsUI_PageIcons_ChkIcon_OnClick(a_ChkIcon)
g_Addon.Settings.DisabledIcons[iconLogic.ID] = true;
end

g_Addon.ReloadPackage();
g_Addon.ReloadPackage({IsSettings = true});
end

function g_Addon.SettingsUI_PageIcons_ChkIcon_OnEnter(a_ChkIcon)
Expand Down

0 comments on commit 31fa36a

Please sign in to comment.