The LDB plugin will only try to add itself if LDB is present

This commit is contained in:
Hendrik Leppkes
2008-09-05 17:20:09 +02:00
parent dadab99c7c
commit cf3a121b03
+30 -27
View File
@@ -109,32 +109,35 @@ function Bartender4.modulePrototype:ToggleOptions()
end end
Bartender4:SetDefaultModulePrototype(Bartender4.modulePrototype) Bartender4:SetDefaultModulePrototype(Bartender4.modulePrototype)
local L_BT_LEFT = L["|cffffff00Click|r to toggle bar lock"] local LDB = LibStub("LibDataBroker-1.1", true)
local L_BT_RIGHT = L["|cffffff00Right-click|r to open the options menu"] if LDB then
local L_BT_LEFT = L["|cffffff00Click|r to toggle bar lock"]
local L_BT_RIGHT = L["|cffffff00Right-click|r to open the options menu"]
LibStub("LibDataBroker-1.1"):NewDataObject("Bartender4", { LibStub("LibDataBroker-1.1"):NewDataObject("Bartender4", {
type = "launcher", type = "launcher",
text = "Bartender4", text = "Bartender4",
OnClick = function(_, msg) OnClick = function(_, msg)
if msg == "LeftButton" then if msg == "LeftButton" then
if Bartender4.Locked then if Bartender4.Locked then
Bartender4["Unlock"](Bartender4) Bartender4["Unlock"](Bartender4)
else else
Bartender4["Lock"](Bartender4) Bartender4["Lock"](Bartender4)
end
elseif msg == "RightButton" then
if LibStub("AceConfigDialog-3.0").OpenFrames["Bartender4"] then
LibStub("AceConfigDialog-3.0"):Close("Bartender4")
else
LibStub("AceConfigDialog-3.0"):Open("Bartender4")
end
end end
elseif msg == "RightButton" then end,
if LibStub("AceConfigDialog-3.0").OpenFrames["Bartender4"] then icon = "Interface\\Icons\\INV_Drink_05",
LibStub("AceConfigDialog-3.0"):Close("Bartender4") OnTooltipShow = function(tooltip)
else if not tooltip or not tooltip.AddLine then return end
LibStub("AceConfigDialog-3.0"):Open("Bartender4") tooltip:AddLine("Bartender4")
end tooltip:AddLine(L_BT_LEFT)
end tooltip:AddLine(L_BT_RIGHT)
end, end,
icon = "Interface\\Icons\\INV_Drink_05", })
OnTooltipShow = function(tooltip) end
if not tooltip or not tooltip.AddLine then return end
tooltip:AddLine("Bartender4")
tooltip:AddLine(L_BT_LEFT)
tooltip:AddLine(L_BT_RIGHT)
end,
})