Quantcast

-Left button on DataBroker button and Minimap button will open Search Window.

Xruptor [01-06-11 - 13:25]
-Left button on DataBroker button and Minimap button will open Search Window.
-Right button on Databroker button and Minimap button will open Tokens Window.
Filename
BagSync.lua
BagSync_Minimap.lua
diff --git a/BagSync.lua b/BagSync.lua
index 63e5953..c9f62a1 100644
--- a/BagSync.lua
+++ b/BagSync.lua
@@ -49,11 +49,17 @@ local dataobj = ldb:NewDataObject("BagSyncLDB", {
 	text = "BagSync",

 	OnClick = function(self, button)
-		if getglobal("BagSync_SearchFrame") then
-			if getglobal("BagSync_SearchFrame"):IsVisible() then
-				getglobal("BagSync_SearchFrame"):Hide()
+		if button == 'LeftButton' and BagSync_SearchFrame then
+			if BagSync_SearchFrame:IsVisible() then
+				BagSync_SearchFrame:Hide()
 			else
-				getglobal("BagSync_SearchFrame"):Show()
+				BagSync_SearchFrame:Show()
+			end
+		elseif button == 'RightButton' and BagSync_TokensFrame then
+			if BagSync_TokensFrame:IsVisible() then
+				BagSync_TokensFrame:Hide()
+			else
+				BagSync_TokensFrame:Show()
 			end
 		end
 	end,
diff --git a/BagSync_Minimap.lua b/BagSync_Minimap.lua
index 1a3dfd5..4eae3c2 100644
--- a/BagSync_Minimap.lua
+++ b/BagSync_Minimap.lua
@@ -20,12 +20,18 @@ bgMinimapButtonTexture:SetTexture('Interface\\AddOns\\BagSync\\media\\minimap.tg
 bgMinimapButtonTexture:SetPoint('CENTER')

 bgMinimapButton:SetScript('OnMouseUp', function(self, button)
-	if button == 'LeftButton' then
+	if button == 'LeftButton' and BagSync_SearchFrame then
 		if BagSync_SearchFrame:IsVisible() then
 			BagSync_SearchFrame:Hide()
 		else
 			BagSync_SearchFrame:Show()
 		end
+	elseif button == 'RightButton' and BagSync_TokensFrame then
+		if BagSync_TokensFrame:IsVisible() then
+			BagSync_TokensFrame:Hide()
+		else
+			BagSync_TokensFrame:Show()
+		end
 	end
 end)