Saturday, April 14, 2012

CalendarIsActionPending()

[:1]I would like to modify FuBar_CalendarFu so it changes his FuBar icon based on a new event....like Calendar minimap icon that changes to a question mark when there is a new event.

I have set what custom icons addon should use:


Code:
local files = {
icon = "Interface\\AddOns\\FuBar_CalendarFu\\icon",
iconnew = "Interface\\AddOns\\FuBar_CalendarFu\\iconnew",
}

I also have a repeating event:


Code:
function CalendarFu:OnEnable()
self:ScheduleRepeatingTimer(self.OnUpdate, 2, self);
end

...that leads to:


Code:
function CalendarFu:OnUpdate()
self:OnUpdateFuBarText()
self:OnUpdateFuBarIcon()
end

Now to the acctual changing code:


Code:
function CalendarFu:OnUpdateFuBarIcon()
if CalendarIsActionPending() then
self:SetFuBarIcon(files.icon)
else
self:SetFuBarIcon(files.iconnew)
end
end

The addon seems to be working fine (No errors and such) but it does not changes the icon when a new event is posted on calendar.

Any suggestions on how can I get that state when some calendar action is pending?

Edit: Forget to note what mods it is using:


Code:
CalendarFu = LibStub("AceAddon-3.0"):NewAddon("CalendarFu", "AceConsole-3.0", "AceEvent-3.0", "AceTimer-3.0", "LibFuBarPlugin-3.0")
local L = LibStub("AceLocale-3.0"):GetLocale("CalendarFu", true)

No comments:

Post a Comment