summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Slimber/MenuletController.cpp')
-rw-r--r--Slimber/MenuletController.cpp64
1 files changed, 31 insertions, 33 deletions
diff --git a/Slimber/MenuletController.cpp b/Slimber/MenuletController.cpp
index 078275b..5ea5bc9 100644
--- a/Slimber/MenuletController.cpp
+++ b/Slimber/MenuletController.cpp
@@ -1,55 +1,53 @@
/*
- * Copyright (c) 2010 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
-#include "Slimber/MenuletController.h"
+#include <Slimber/MenuletController.h>
-#include <Swiften/Base/foreach.h>
#include <string>
-#include "Slimber/Menulet.h"
-#include <iostream>
+#include <Slimber/Menulet.h>
-MenuletController::MenuletController(Menulet* menulet) :
- menulet(menulet), xmppStatus(Offline) {
- menulet->onRestartClicked.connect(boost::ref(onRestartRequested));
- update();
+MenuletController::MenuletController(Menulet* menulet) :
+ menulet(menulet), xmppStatus(Offline) {
+ menulet->onRestartClicked.connect(boost::ref(onRestartRequested));
+ update();
}
MenuletController::~MenuletController() {
}
void MenuletController::setXMPPStatus(const std::string& message, Status status) {
- xmppStatus = status;
- xmppStatusMessage = message;
- update();
+ xmppStatus = status;
+ xmppStatusMessage = message;
+ update();
}
void MenuletController::setUserNames(const std::vector<std::string>& users) {
- linkLocalUsers = users;
- update();
+ linkLocalUsers = users;
+ update();
}
void MenuletController::update() {
- menulet->clear();
- if (linkLocalUsers.empty()) {
- menulet->setIcon("UsersOffline");
- menulet->addItem("No online users");
- }
- else {
- menulet->setIcon("UsersOnline");
- menulet->addItem("Online users:");
- foreach(const std::string& user, linkLocalUsers) {
- menulet->addItem(std::string(" ") + user);
- }
- }
- menulet->addSeparator();
- menulet->addItem(xmppStatusMessage, (xmppStatus == Online ? "Online" : "Offline"));
- menulet->addSeparator();
- menulet->addAboutItem();
- menulet->addSeparator();
- menulet->addRestartItem();
- menulet->addExitItem();
+ menulet->clear();
+ if (linkLocalUsers.empty()) {
+ menulet->setIcon("UsersOffline");
+ menulet->addItem("No online users");
+ }
+ else {
+ menulet->setIcon("UsersOnline");
+ menulet->addItem("Online users:");
+ for (const auto& user : linkLocalUsers) {
+ menulet->addItem(std::string(" ") + user);
+ }
+ }
+ menulet->addSeparator();
+ menulet->addItem(xmppStatusMessage, (xmppStatus == Online ? "Online" : "Offline"));
+ menulet->addSeparator();
+ menulet->addAboutItem();
+ menulet->addSeparator();
+ menulet->addRestartItem();
+ menulet->addExitItem();
}