diff --git a/.pkgmeta b/.pkgmeta
index 839680b..84e231e 100644
--- a/.pkgmeta
+++ b/.pkgmeta
@@ -19,3 +19,4 @@ externals:
Libs/CallbackHandler-1.0: https://repos.wowace.com/wow/callbackhandler/trunk/CallbackHandler-1.0
Libs/LibStub: https://repos.wowace.com/wow/libstub/trunk
Libs/LibSharedMedia-3.0: https://repos.wowace.com/wow/libsharedmedia-3-0/trunk/LibSharedMedia-3.0
+ Libs/LibDBIcon-1.0: https://repos.curseforge.com/wow/libdbicon-1-0/trunk/libdbicon-1-0
diff --git a/Broker.lua b/Broker.lua
new file mode 100644
index 0000000..18e2406
--- /dev/null
+++ b/Broker.lua
@@ -0,0 +1,37 @@
+local GT = LibStub("AceAddon-3.0"):GetAddon("GatheringTracker")
+local ldb = LibStub("LibDataBroker-1.1")
+local LibDBIcon = LibStub("LibDBIcon-1.0")
+
+function GT:InitializeBroker()
+ GT.Debug("InitializeBroker", 1)
+ -- Create LibDataBroker data object
+ local dataObj = ldb:NewDataObject(GT.metaData.name, {
+ type = "launcher",
+ icon = "Interface\\Addons\\GatheringTracker\\Media\\GT_Icon",
+ OnClick = function(frame, button)
+ if button == "LeftButton" then
+ GT:GenerateFiltersMenu(frame)
+ elseif button == "RightButton" then
+ Settings.OpenToCategory(GT.metaData.name, true)
+ end
+ end,
+ OnTooltipShow = function(tooltip)
+ tooltip:AddLine(GT.metaData.name .. " |cffff6f00v" .. GT.metaData.version .. "|r")
+ tooltip:AddLine(" ")
+ tooltip:AddLine("|cff8080ffLeft-Click|r to open the Filter Menu")
+ tooltip:AddLine("|cff8080ffRight-Click|r to open the addon options")
+ end,
+ })
+
+ -- Register with LibDBIcon
+ LibDBIcon:Register(GT.metaData.name, dataObj, GT.db.profile.miniMap)
+end
+
+function GT:MinimapHandler(key)
+ GT.Debug("MinimapHandler", 1, key)
+ if key then
+ LibDBIcon:Show(GT.metaData.name)
+ else
+ LibDBIcon:Hide(GT.metaData.name)
+ end
+end
diff --git a/Config.lua b/Config.lua
index 3a1d10d..38a50cd 100644
--- a/Config.lua
+++ b/Config.lua
@@ -66,6 +66,9 @@ GT.defaults = {
},
Aliases = {
},
+ miniMap = {
+ hide = true,
+ },
},
}
@@ -100,6 +103,18 @@ local generalOptions = {
end,
order = 2
},
+ miniMap = {
+ type = "toggle",
+ name = "Minimap Button",
+ desc = "Enable this to show the minimap button.\nLeft Click shows filters menu.\nRight Click opens the addon options.",
+ width = 1.70,
+ get = function() return not GT.db.profile.miniMap.hide end,
+ set = function(_, key)
+ GT.db.profile.miniMap.hide = not key
+ GT:MinimapHandler(key)
+ end,
+ order = 3
+ },
buttonHeader = {
type = "header",
name = "Filter Button",
@@ -1475,6 +1490,8 @@ function Config:OnInitialize()
GT:OnDisable()
end
+ GT:InitializeBroker()
+
GT:SetChatType()
--Pause Notifications to prevent spam after reloading the UI
diff --git a/FilterButton.lua b/FilterButton.lua
index 2774227..f604de7 100644
--- a/FilterButton.lua
+++ b/FilterButton.lua
@@ -48,7 +48,20 @@ function GT:FiltersButton(profileChanged)
filterButton:SetFrameStrata("BACKGROUND")
filterButton:Show()
- local function FiltersMenu(filterButton, rootDescription)
+ filterButton:SetScript("OnClick", function(self, button, down)
+ if button == "LeftButton" then
+ GT:GenerateFiltersMenu(self)
+ elseif button == "RightButton" then
+ GT:ClearFilters()
+ end
+ end)
+
+ GT.baseFrame.button = filterButton
+ GT:FiltersButtonFade()
+end
+
+function GT:GenerateFiltersMenu(frame)
+ local function FiltersMenu(frame, rootDescription)
for expansionIndex, expansion in ipairs(GT.expansionsOrder) do
local function IsSelected_Expansion()
local checked = true
@@ -217,16 +230,7 @@ function GT:FiltersButton(profileChanged)
GT:CreateProfilesList(rootDescription)
end
- filterButton:SetScript("OnClick", function(self, button, down)
- if button == "LeftButton" then
- MenuUtil.CreateContextMenu(filterButton, FiltersMenu)
- elseif button == "RightButton" then
- GT:ClearFilters()
- end
- end)
-
- GT.baseFrame.button = filterButton
- GT:FiltersButtonFade()
+ MenuUtil.CreateContextMenu(frame, FiltersMenu)
end
function GT:FiltersButtonFade(alpha)
diff --git a/GatheringTracker.toc b/GatheringTracker.toc
index aefbfa2..3a0c45c 100644
--- a/GatheringTracker.toc
+++ b/GatheringTracker.toc
@@ -2,7 +2,7 @@
## Title: Gathering Tracker
## Notes: Addon for tracking gathered items, supports solo players and groups
## Author: Noshei
-## Version: 2.3.1
+## Version: 2.4.0
## OptionalDeps: TradeSkillMaster
## SavedVariables: GatheringTrackerDB
## AddonCompartmentFunc: GatheringTracker_OnAddonCompartmentClick
@@ -11,9 +11,11 @@
embeds.xml
GatheringTracker.lua
DisplayCreation.lua
+Fade.lua
Utilities.lua
FilterButton.lua
NotificationHandler.lua
Constants.lua
Config.lua
+Broker.lua
Bindings.lua
\ No newline at end of file
diff --git a/Media/GT_Icon.tga b/Media/GT_Icon.tga
new file mode 100644
index 0000000..56cb3c5
Binary files /dev/null and b/Media/GT_Icon.tga differ
diff --git a/embeds.xml b/embeds.xml
index b9b93db..4222744 100644
--- a/embeds.xml
+++ b/embeds.xml
@@ -12,4 +12,5 @@
+
\ No newline at end of file