#import "StatzSource.h"
-#import "StatzProtocols.h"
@interface StatzSink : StatzSource {
NSString *lastKnownStatus_;
@@ -39,7 +38,6 @@
- (void)setLastKnownStatus:(NSString *)value;
- (BOOL)isEnabled;
- (NSObject<StatzSinkPlugin>*)plugin;
-- (StatzState)state;
- (void)setState:(StatzState)state;
@end
Index: StatzSink.m
===================================================================
--- StatzSink.m (revision 65)
+++ StatzSink.m (working copy)
@@ -208,7 +208,7 @@
if (menuMask != kStatzStateNone) {
stateMenu_ = [[StatzSink stateMenuWithStates:menuMask
target:self] retain];
- [[stateMenu_ itemWithTag:[self state]] setState:NSOnState];
+
}
}
return stateMenu_;
@@ -267,12 +267,15 @@
}
- (void)setState:(StatzState)state {
- state_ = state;
- NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
- [nc postNotificationName:StatzStateChangedNotification
- object:self
- userInfo:[NSDictionary dictionaryWithObject:
[NSNumber numberWithInt:state]
-
forKey:StatzStateChangedState]];
+ state &= [plugin_ stateMenuMask];
+ if (state != state_) {
+ state_ = state;
+ NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
+ [nc postNotificationName:StatzStateChangedNotification
+ object:self
+ userInfo:[NSDictionary dictionaryWithObject:
[NSNumber numberWithInt:state]
+
forKey:StatzStateChangedState]];
+ }
}
- (void)stateSelected:(id)sender {
Index: StatusSettingsController.m
===================================================================
--- StatusSettingsController.m (revision 65)
+++ StatusSettingsController.m (working copy)
@@ -450,6 +450,7 @@
[sourcesController_ setSelectedObjects:[NSArray
arrayWithObject:source]];
[statusTable_ selectRow:[source currentStatusIndex]
byExtendingSelection:NO];
[statePopup_ setMenu:[source stateMenu]];
+ [statePopup_ selectItemWithTag:[source state]];
}
}
Index: StatzSource.h
===================================================================
--- StatzSource.h (revision 64)
+++ StatzSource.h (working copy)
@@ -20,6 +20,7 @@
//
#import <Cocoa/Cocoa.h>
+#import "StatzProtocols.h"
@class Status;
@class StatzTextAttachment;
@@ -52,4 +53,5 @@
- (BOOL)isEnabled;
- (id)plugin;
- (NSMenu*)stateMenu;
+- (StatzState)state;
@end