Forward pending notification count to the systray service

sip-call-params
Ingo Bauersachs 10 years ago
parent 8c1b1b17cd
commit 7f08c0d239

@ -74,7 +74,8 @@ public class UIServiceImpl
implements UIService,
ShutdownService,
ServiceListener,
PropertyChangeListener
PropertyChangeListener,
UINotificationListener
{
/**
* The <tt>Logger</tt> used by the <tt>UIServiceImpl</tt> class and its
@ -140,6 +141,7 @@ public class UIServiceImpl
*/
public UIServiceImpl()
{
UINotificationManager.addNotificationListener(this);
}
/**
@ -1642,4 +1644,41 @@ public void showChatRoomAutoOpenConfigDialog(
ChatRoomAutoOpenConfigDialog.showChatRoomAutoOpenConfigDialog(
pps, chatRoomId);
}
/**
* Counts the number of unread notifications and forwards the sum to the
* systray service.
*/
@Override
public void notificationReceived(UINotification notification)
{
forwardNotificationCount();
}
/**
* Counts the number of unread notifications and forwards the sum to the
* systray service.
*/
@Override
public void notificationCleared(UINotification notification)
{
forwardNotificationCount();
}
private void forwardNotificationCount()
{
int count = 0;
for (UINotificationGroup g : UINotificationManager
.getNotificationGroups())
{
Iterator<UINotification> it =
UINotificationManager.getUnreadNotifications(g);
while (it.hasNext())
{
count += it.next().getUnreadObjects();
}
}
GuiActivator.getSystrayService().setNotificationCount(count);
}
}

@ -127,6 +127,15 @@ public void showPopupMessage(PopupMessage popupMessage)
activePopupHandler.showPopupMessage(popupMessage);
}
/**
* Stub method that does nothing.
* @param count ignored
*/
@Override
public void setNotificationCount(int count)
{
}
/**
* Implements the <tt>SystrayService.addPopupMessageListener</tt> method.
* If <tt>activePopupHandler</tt> is still not available record the listener

@ -130,4 +130,10 @@ public PopupMessageHandler setActivePopupMessageHandler(
* @return True if the systray is initialized, false otherwise.
*/
public boolean checkInitialized();
/**
* Set the number that should be shown as an overlay on the try icon.
* @param count The number of pending notifications.
*/
public void setNotificationCount(int count);
}

Loading…
Cancel
Save