local addonName, addon = ...
local childName = addon['childName']
local child = addon[childName]
local L = LibStub("AceLocale-3.0"):GetLocale(childName, true)
local origME, db
local function hideMapMail()
	origME = MiniMapMailFrame:GetScript("OnEvent")
	MiniMapMailFrame:Hide()
	MiniMapMailFrame:SetScript("OnEvent", nil)
end
local function showMapMail()
	MiniMapMailFrame:Show()
	MiniMapMailFrame:SetScript("OnEvent", origME)
	origME = nil
end
function child:PrefChanged(...)
	if(not db['showOrgMail'] and not origME) then
		hideMapMail()
	elseif(db['showOrgMail']) then
		showMapMail()
	end
end
local init = {
	Setup = function(self)
		db = child['db']
		local config = LibStub:GetLibrary("zzConfig")
		local options = child['options']
		local main = options['args'][childName]
		config:AddConfigEntry(main, "showOrgMail", "toggle", L['Show Mail'], L['Show original Minimap Symbol'],1)
		if(not db['showOrgMail']) then hideMapMail() end
	end
}
addon.RegisterCallback(init, format("Init%s", childName), 'Setup')