diff options
-rw-r--r-- | SwifTools/Dock/Dock.h | 2 | ||||
-rw-r--r-- | SwifTools/Dock/MacOSXDock.h | 2 | ||||
-rw-r--r-- | SwifTools/Dock/MacOSXDock.mm | 4 | ||||
-rw-r--r-- | SwifTools/Dock/NullDock.h | 2 | ||||
-rw-r--r-- | Swift/Controllers/MainController.cpp | 2 |
5 files changed, 7 insertions, 5 deletions
diff --git a/SwifTools/Dock/Dock.h b/SwifTools/Dock/Dock.h index a1c652d..2dd312c 100644 --- a/SwifTools/Dock/Dock.h +++ b/SwifTools/Dock/Dock.h @@ -13,6 +13,6 @@ namespace Swift { public: virtual ~Dock(); - virtual void setMessage(const String& message) = 0; + virtual void setNumberOfPendingMessages(int i) = 0; }; } diff --git a/SwifTools/Dock/MacOSXDock.h b/SwifTools/Dock/MacOSXDock.h index e9667a6..511a652 100644 --- a/SwifTools/Dock/MacOSXDock.h +++ b/SwifTools/Dock/MacOSXDock.h @@ -16,6 +16,6 @@ namespace Swift { public: MacOSXDock(CocoaApplication* application); - void setMessage(const String& label); + virtual void setNumberOfPendingMessages(int i); }; } diff --git a/SwifTools/Dock/MacOSXDock.mm b/SwifTools/Dock/MacOSXDock.mm index d2a06b3..0438353 100644 --- a/SwifTools/Dock/MacOSXDock.mm +++ b/SwifTools/Dock/MacOSXDock.mm @@ -2,6 +2,7 @@ #include <AppKit/AppKit.h> #include <Cocoa/Cocoa.h> +#include <boost/lexical_cast.hpp> #include "Swiften/Base/String.h" @@ -10,7 +11,8 @@ namespace Swift { MacOSXDock::MacOSXDock(CocoaApplication*) { } -void MacOSXDock::setMessage(const String& label) { +void MacOSXDock::setNumberOfPendingMessages(int i) { + String label(i > 0 ? boost::lexical_cast<std::string>(i) : ""); NSString *labelString = [[NSString alloc] initWithUTF8String: label.getUTF8Data()]; [[NSApp dockTile] setBadgeLabel: labelString]; [labelString release]; diff --git a/SwifTools/Dock/NullDock.h b/SwifTools/Dock/NullDock.h index f2d27b7..1dbb892 100644 --- a/SwifTools/Dock/NullDock.h +++ b/SwifTools/Dock/NullDock.h @@ -13,7 +13,7 @@ namespace Swift { public: NullDock() {} - virtual void setMessage(const String&) { + virtual void setNumberOfPendingMessages(int i) { } }; } diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp index 9499e17..6e57a8f 100644 --- a/Swift/Controllers/MainController.cpp +++ b/Swift/Controllers/MainController.cpp @@ -261,7 +261,7 @@ void MainController::handleConnected() { } void MainController::handleEventQueueLengthChange(int count) { - dock_->setMessage(count == 0 ? "" : boost::lexical_cast<std::string>(count).c_str()); + dock_->setNumberOfPendingMessages(count); } void MainController::reconnectAfterError() { |