summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2010-10-01 19:32:14 (GMT)
committerKevin Smith <git@kismith.co.uk>2010-10-01 19:32:14 (GMT)
commit2fb3d3266bd22d84604688dc9ee18b17b211b91d (patch)
treefe48767aec79f65d37c2011e6de01844784815b0 /Swift/Controllers
parent31fc890d97c90a729e306c544a611f640ed00a0d (diff)
downloadswift-2fb3d3266bd22d84604688dc9ee18b17b211b91d.zip
swift-2fb3d3266bd22d84604688dc9ee18b17b211b91d.tar.bz2
Only show system tray message icon for message events.
Resolves: #583
Diffstat (limited to 'Swift/Controllers')
-rw-r--r--Swift/Controllers/SystemTrayController.cpp12
-rw-r--r--Swift/Controllers/XMPPEvents/EventController.h5
2 files changed, 14 insertions, 3 deletions
diff --git a/Swift/Controllers/SystemTrayController.cpp b/Swift/Controllers/SystemTrayController.cpp
index 23a94fa..d3824c9 100644
--- a/Swift/Controllers/SystemTrayController.cpp
+++ b/Swift/Controllers/SystemTrayController.cpp
@@ -19,8 +19,16 @@ SystemTrayController::SystemTrayController(EventController* eventController, Sys
eventController_->onEventQueueLengthChange.connect(boost::bind(&SystemTrayController::handleEventQueueLengthChange, this, _1));
}
-void SystemTrayController::handleEventQueueLengthChange(int length) {
- systemTray_->setUnreadMessages(length > 0);
+void SystemTrayController::handleEventQueueLengthChange(int /*length*/) {
+ EventList events = eventController_->getEvents();
+ bool found = false;
+ for (EventList::iterator it = events.begin(); it != events.end(); it++) {
+ if (boost::dynamic_pointer_cast<MessageEvent>(*it)) {
+ found = true;
+ break;
+ }
+ }
+ systemTray_->setUnreadMessages(found);
}
void SystemTrayController::setMyStatusType(StatusShow::Type type) {
diff --git a/Swift/Controllers/XMPPEvents/EventController.h b/Swift/Controllers/XMPPEvents/EventController.h
index b405556..ba3fd5b 100644
--- a/Swift/Controllers/XMPPEvents/EventController.h
+++ b/Swift/Controllers/XMPPEvents/EventController.h
@@ -16,16 +16,19 @@
#include "Swift/Controllers/XMPPEvents/MessageEvent.h"
namespace Swift {
+ typedef std::vector<boost::shared_ptr<StanzaEvent> > EventList;
class EventController {
public:
+
EventController();
void handleIncomingEvent(boost::shared_ptr<StanzaEvent> sourceEvent);
boost::signal<void (int)> onEventQueueLengthChange;
boost::signal<void (boost::shared_ptr<StanzaEvent>)> onEventQueueEventAdded;
+ const EventList getEvents() const {return events_;}
private:
void handleEventConcluded(boost::shared_ptr<StanzaEvent> event);
- std::vector<boost::shared_ptr<StanzaEvent> > events_;
+ EventList events_;
};
}
#endif