Mercurial > wow > inventory
changeset 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 | 1ed7ce9b1c5d |
children | fdb1b21c3198 |
files | Core.lua Modules/Config.lua Modules/MinimapIcon.lua |
diffstat | 3 files changed, 40 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/Core.lua Sat Feb 05 20:09:03 2011 +0100 +++ b/Core.lua Sat Feb 05 20:28:55 2011 +0100 @@ -66,6 +66,7 @@ summaryHidePriceThreshold = false, -- Global (can't be overridden) + minimapIcon = true, hideHelp = false, scanInterval = "0.1", -- string because the associated select requires it to be summary = {
--- a/Modules/Config.lua Sat Feb 05 20:09:03 2011 +0100 +++ b/Modules/Config.lua Sat Feb 05 20:28:55 2011 +0100 @@ -1885,6 +1885,23 @@ inline = true, name = "Miscellaneous", args = { + minimapIcon = { + order = 0, + type = "toggle", + width = "full", + name = "Display the minimap icon", + desc = "Display the minimap icon for Inventorium allowing functionality to be used without typing slash commands.", + get = function() return addon.db.profile.defaults.minimapIcon; end, + set = function(i, v) + addon.db.profile.defaults.minimapIcon = v; + + if v then + addon:GetModule("MinimapIcon"):ShowIcon(); + else + addon:GetModule("MinimapIcon"):HideIcon(); + end + end, + }, hideHelp = { order = 10, type = "toggle",
--- 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