Permalink
Browse files

prefs window

  • Loading branch information...
1 parent 2bc91ba commit fbd2f57a6c925d484720d5ce3d92084df5c7df8f Greg Allen committed Mar 11, 2010
View
@@ -12,7 +12,7 @@
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="81"/>
+ <integer value="57"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -875,6 +875,14 @@
</object>
<int key="connectionID">879</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">showPreferences:</string>
+ <reference key="source" ref="976324537"/>
+ <reference key="destination" ref="609285721"/>
+ </object>
+ <int key="connectionID">880</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -1565,7 +1573,7 @@
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">879</int>
+ <int key="maxID">880</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -1615,8 +1623,17 @@
<string key="className">MilkMaidAppDelegate</string>
<string key="superclassName">NSObject</string>
<object class="NSMutableDictionary" key="actions">
- <string key="NS.key.0">openNewWindow:</string>
- <string key="NS.object.0">id</string>
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>openNewWindow:</string>
+ <string>showPreferences:</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>id</string>
+ <string>id</string>
+ </object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
View
@@ -23,14 +23,16 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleShortVersionString</key>
- <string>0.7.4</string>
+ <string>0.7.5</string>
<key>LSMinimumSystemVersion</key>
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
<key>CFBundleVersion</key>
- <string>0.7.4</string>
+ <string>0.7.5</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
+ <key>LSUIElement</key>
+ <true/>
</dict>
</plist>
@@ -14,6 +14,8 @@
76646D501147F28C00803310 /* icon_main.png in Resources */ = {isa = PBXBuildFile; fileRef = 76646D4E1147F28C00803310 /* icon_main.png */; };
76646D531147F2C200803310 /* icon_main.icns in Resources */ = {isa = PBXBuildFile; fileRef = 76646D521147F2C200803310 /* icon_main.icns */; };
76646D5F1147F46500803310 /* icon_menu.png in Resources */ = {isa = PBXBuildFile; fileRef = 76646D5E1147F46500803310 /* icon_menu.png */; };
+ 76646D851147F83500803310 /* Preferences.xib in Resources */ = {isa = PBXBuildFile; fileRef = 76646D841147F83500803310 /* Preferences.xib */; };
+ 76646D891147F96B00803310 /* PreferencesWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 76646D881147F96B00803310 /* PreferencesWindowController.m */; };
767A8743112AF51E00A77326 /* MultiAdd.xib in Resources */ = {isa = PBXBuildFile; fileRef = 767A8742112AF51E00A77326 /* MultiAdd.xib */; };
767A8758112AF58E00A77326 /* MultiAddWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 767A8757112AF58E00A77326 /* MultiAddWindowController.m */; };
76DF8422113B687400B2A3B2 /* ComboInput.xib in Resources */ = {isa = PBXBuildFile; fileRef = 76DF8421113B687400B2A3B2 /* ComboInput.xib */; };
@@ -79,6 +81,9 @@
76646D4E1147F28C00803310 /* icon_main.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon_main.png; sourceTree = "<group>"; };
76646D521147F2C200803310 /* icon_main.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = icon_main.icns; sourceTree = "<group>"; };
76646D5E1147F46500803310 /* icon_menu.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon_menu.png; sourceTree = "<group>"; };
+ 76646D841147F83500803310 /* Preferences.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = Preferences.xib; sourceTree = "<group>"; };
+ 76646D871147F96B00803310 /* PreferencesWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PreferencesWindowController.h; sourceTree = "<group>"; };
+ 76646D881147F96B00803310 /* PreferencesWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PreferencesWindowController.m; sourceTree = "<group>"; };
767A8742112AF51E00A77326 /* MultiAdd.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MultiAdd.xib; sourceTree = "<group>"; };
767A8756112AF58E00A77326 /* MultiAddWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MultiAddWindowController.h; sourceTree = "<group>"; };
767A8757112AF58E00A77326 /* MultiAddWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MultiAddWindowController.m; sourceTree = "<group>"; };
@@ -219,6 +224,7 @@
767A8742112AF51E00A77326 /* MultiAdd.xib */,
762EAB04113AD8FF0093921D /* MilkMaid.xib */,
76DF8421113B687400B2A3B2 /* ComboInput.xib */,
+ 76646D841147F83500803310 /* Preferences.xib */,
);
name = Resources;
sourceTree = "<group>";
@@ -254,6 +260,8 @@
767A8757112AF58E00A77326 /* MultiAddWindowController.m */,
762EAA29113ACB8E0093921D /* MilkMaidWindowController.h */,
762EAA2A113ACB8E0093921D /* MilkMaidWindowController.m */,
+ 76646D871147F96B00803310 /* PreferencesWindowController.h */,
+ 76646D881147F96B00803310 /* PreferencesWindowController.m */,
);
name = Controllers;
sourceTree = "<group>";
@@ -363,6 +371,7 @@
76646D501147F28C00803310 /* icon_main.png in Resources */,
76646D531147F2C200803310 /* icon_main.icns in Resources */,
76646D5F1147F46500803310 /* icon_menu.png in Resources */,
+ 76646D851147F83500803310 /* Preferences.xib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -391,6 +400,7 @@
762EAA2B113ACB8E0093921D /* MilkMaidWindowController.m in Sources */,
C9C148F0113B1AA400F292B7 /* MilkMaidPanel.m in Sources */,
76DF8434113B693900B2A3B2 /* ComboInputWindowController.m in Sources */,
+ 76646D891147F96B00803310 /* PreferencesWindowController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
View
@@ -7,15 +7,19 @@
//
#import <Cocoa/Cocoa.h>
+#import "PreferencesWindowController.h"
@class MilkMaidWindowController;
@interface MilkMaidAppDelegate : NSObject {
NSMutableArray *windowControllers;
+ PreferencesWindowController *prefsWindowController;
NSStatusItem *statusItem;
BOOL windowsVisible;
}
-(IBAction)openNewWindow:(id)sender;
+-(void)updateMenuIcon;
+-(IBAction)showPreferences:(id)sender;
@end
View
@@ -14,27 +14,48 @@ @implementation MilkMaidAppDelegate
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
windowsVisible = YES;
- NSStatusBar *statusBar = [NSStatusBar systemStatusBar];
- statusItem = [[statusBar statusItemWithLength:NSVariableStatusItemLength] retain];
-
- NSImage *statusIcon = [[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"icon_menu" ofType:@"png"]];
-
- [statusItem setImage:statusIcon];
- [statusItem setToolTip:@"MilkMaid"];
- [statusItem setHighlightMode:YES];
+
+ [self registerDefaultSettings];
+ [self updateMenuIcon];
- [statusItem setAction:@selector(toggleWindows)];
- [statusItem setTarget:self];
+ if ([[NSUserDefaults standardUserDefaults] boolForKey:@"dockicon"]) {
+ ProcessSerialNumber psn = { 0, kCurrentProcess };
+ TransformProcessType(&psn, kProcessTransformToForegroundApplication);
+ }
windowControllers = [[NSMutableArray alloc] init];
[self openNewWindow:nil];
}
+-(void)registerDefaultSettings {
+ [[NSUserDefaults standardUserDefaults] registerDefaults:[[NSDictionary alloc] initWithObjectsAndKeys:[NSNumber numberWithInt:1], @"menuicon", [NSNumber numberWithInt:1], @"dockicon", nil]];
+}
+
+-(void)updateMenuIcon {
+
+ if ([[NSUserDefaults standardUserDefaults] boolForKey:@"menuicon"] && !statusItem) {
+ NSStatusBar *statusBar = [NSStatusBar systemStatusBar];
+ statusItem = [[statusBar statusItemWithLength:NSVariableStatusItemLength] retain];
+
+ NSImage *statusIcon = [[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"icon_menu" ofType:@"png"]];
+
+ [statusItem setImage:statusIcon];
+ [statusItem setToolTip:@"MilkMaid"];
+ [statusItem setHighlightMode:YES];
+
+ [statusItem setAction:@selector(toggleWindows)];
+ [statusItem setTarget:self];
+ } else if (statusItem) {
+ [statusItem release];
+ }
+
+
+}
+
-(void)toggleWindows {
for (MilkMaidWindowController *wc in windowControllers) {
if (windowsVisible) {
- NSLog(@"hide");
[wc.window orderOut:self];
} else {
[wc.window orderFrontRegardless];
@@ -55,4 +76,12 @@ -(void)openNewWindow:(id)sender {
[windowController showWindow:self];
}
+-(void)showPreferences:(id)sender {
+ if (!prefsWindowController) {
+ prefsWindowController = [[PreferencesWindowController alloc] initWithWindowNibName:@"Preferences"];
+ [prefsWindowController showWindow:self];
+ }
+ [prefsWindowController.window orderFrontRegardless];
+}
+
@end
@@ -52,7 +52,8 @@ - (void)checkToken {
if ([[data objectForKey:@"stat"] isEqualToString:@"ok"]) {
timeline = [rtmController timeline];
[timeline retain];
- [self performSelectorOnMainThread:@selector(getLists) withObject:nil waitUntilDone:NO];
+ [self getLists];
+ //[self performSelectorOnMainThread:@selector(getLists) withObject:nil waitUntilDone:NO];
} else {
[self getAuthToken];
}
Oops, something went wrong.

0 comments on commit fbd2f57

Please sign in to comment.