# HG changeset patch # User Zerotorescue # Date 1296934135 -3600 # Node ID 1959e2b3dfe14a60b2de2091951eeeeebe79714f # Parent 1ed7ce9b1c5d7770e6188ff222728d85bf0c5be8 You can now toggle the minimap icon in the ?Extra? config category. diff -r 1ed7ce9b1c5d -r 1959e2b3dfe1 Core.lua --- 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 = { diff -r 1ed7ce9b1c5d -r 1959e2b3dfe1 Modules/Config.lua --- 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", diff -r 1ed7ce9b1c5d -r 1959e2b3dfe1 Modules/MinimapIcon.lua --- 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