Mercurial > wow > inventory
diff Modules/MinimapIcon.lua @ 210:1959e2b3dfe1
You can now toggle the minimap icon in the ?Extra? config category.
author | Zerotorescue |
---|---|
date | Sat, 05 Feb 2011 20:28:55 +0100 |
parents | 8cecfea6a254 |
children |
line wrap: on
line diff
--- a/Modules/MinimapIcon.lua Sat Feb 05 20:09:03 2011 +0100 +++ b/Modules/MinimapIcon.lua Sat Feb 05 20:28:55 2011 +0100 @@ -1,11 +1,17 @@ local addon = select(2, ...); local mod = addon:NewModule("MinimapIcon"); +local icon; + function mod:OnEnable() - self:Make(); + if addon.db.profile.defaults.minimapIcon then + self:MakeIcon(); + end end -function mod:Make() +function mod:MakeIcon() + icon = LibStub("LibDBIcon-1.0"); + local ldb = LibStub("LibDataBroker-1.1"); local dataobject = ldb:GetDataObjectByName("Inventorium") or ldb:NewDataObject("Inventorium", { @@ -39,8 +45,21 @@ end, }); - local icon = LibStub("LibDBIcon-1.0"); if icon and not icon:IsRegistered("Inventorium") then icon:Register("Inventorium", dataobject); end end + +function mod:ShowIcon() + if not icon then + self:MakeIcon(); + else + icon:Show("Inventorium"); + end +end + +function mod:HideIcon() + if icon then + icon:Hide("Inventorium"); + end +end