REVIEW: states now track across UI

1 view
Skip to first unread message

Dave MacLachlan

unread,
Dec 3, 2007, 1:54:45 PM12/3/07
to statz-d...@groups.google.com
Index: StatzSource.m
===================================================================
--- StatzSource.m (revision 64)
+++ StatzSource.m (working copy)
@@ -218,4 +218,9 @@
- (NSMenu*)stateMenu {
return nil;
}
+
+- (StatzState)state {
+ return kStatzStateNone;
+}
+
@end
Index: StatzSink.h
===================================================================
--- StatzSink.h (revision 65)
+++ StatzSink.h (working copy)
@@ -20,7 +20,6 @@
//

#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

Reply all
Reply to author
Forward
0 new messages