Quantcast

Updates for WoD

Jim Whitehead [07-26-14 - 15:10]
Updates for WoD

 - Handle 1nil change for Region:IsEnabled()
 - Update TOC version
Filename
AddonCore.lua
BindConfig.lua
Clique.toc
Clique.xml
OptionsPanel.lua
diff --git a/AddonCore.lua b/AddonCore.lua
index a765133..6de3696 100755
--- a/AddonCore.lua
+++ b/AddonCore.lua
@@ -52,6 +52,21 @@ if EMERGENCY_DEBUG then
 end

 --[[-------------------------------------------------------------------------
+--  API compatibility support
+-------------------------------------------------------------------------]]--
+
+-- Returns true if the API value is true-ish (handles old 1/nil returns)
+function addon:APIIsTrue(val, ...)
+	if type(val) == "boolean" then
+		return val
+	elseif type(val) == "number" then
+		return val == 1
+	else
+		return false
+	end
+end
+
+--[[-------------------------------------------------------------------------
 --  Print/Printf support
 -------------------------------------------------------------------------]]--

diff --git a/BindConfig.lua b/BindConfig.lua
index 988de8c..d08eb07 100755
--- a/BindConfig.lua
+++ b/BindConfig.lua
@@ -148,7 +148,7 @@ function CliqueConfig:EnableSpellbookButtons()

     if self.spellbookButtons then
         for idx, button in ipairs(self.spellbookButtons) do
-            if enabled and button.spellbutton:IsEnabled() == 1 then
+            if enabled and addon:APIIsTrue(button.spellbutton:IsEnabled()) then
                 button:Show()
             else
                 button:Hide()
diff --git a/Clique.toc b/Clique.toc
index cafc65b..d7fa293 100755
--- a/Clique.toc
+++ b/Clique.toc
@@ -1,4 +1,4 @@
-## Interface: 50400
+## Interface: 60000
 ## Title: Clique
 ## Author: Cladhaire
 ## Version: @project-version@
diff --git a/Clique.xml b/Clique.xml
index cde147d..4b93364 100755
--- a/Clique.xml
+++ b/Clique.xml
@@ -88,7 +88,7 @@
         <Scripts>
             <OnEnter>
                 local parent = self:GetParent()
-                if parent:IsEnabled() == 1 then
+                if Clique:APIIsTrue(parent:IsEnabled()) then
                     SpellButton_OnEnter(parent)
                 else
                     self:GetHighlightTexture():Hide()
diff --git a/OptionsPanel.lua b/OptionsPanel.lua
index 5bf9dba..c692b6e 100755
--- a/OptionsPanel.lua
+++ b/OptionsPanel.lua
@@ -159,13 +159,14 @@ StaticPopupDialogs["CLIQUE_NEW_PROFILE"] = {
 		_G[self:GetName().."EditBox"]:SetFocus();
 	end,
 	EditBoxOnEnterPressed = function(self)
-		if (_G[self:GetParent():GetName().."Button1"]:IsEnabled() == 1) then
-            local base = self:GetParent():GetName()
-            local editbox = _G[base .. "EditBox"]
-            local profileName = editbox:GetText()
-            addon.db:SetProfile(profileName)
-        end
-        self:GetParent():Hide();
+		local button = _G[self:GetParent():GetName().."Button1"]
+		if addon:APIIsTrue(button:IsEnabled()) then
+			local base = self:GetParent():GetName()
+			local editbox = _G[base .. "EditBox"]
+			local profileName = editbox:GetText()
+			addon.db:SetProfile(profileName)
+		end
+		self:GetParent():Hide();
 	end,
 	EditBoxOnTextChanged = function (self)
 		local editBox = _G[self:GetParent():GetName().."EditBox"];