Skip to content

Commit

Permalink
Now properly changes the preference for Articles Directory
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrennan committed May 3, 2010
1 parent 397de65 commit ceb5c52
Show file tree
Hide file tree
Showing 4 changed files with 111 additions and 5 deletions.
1 change: 1 addition & 0 deletions JBArticle.h
Expand Up @@ -43,5 +43,6 @@


- (id)initNewArticle;
- (void)save;

@end
91 changes: 87 additions & 4 deletions JBEditorPreferences.xib
Expand Up @@ -3,12 +3,12 @@
<data>
<int key="IBDocument.SystemTarget">1060</int>
<string key="IBDocument.SystemVersion">10D573</string>
<string key="IBDocument.InterfaceBuilderVersion">740</string>
<string key="IBDocument.InterfaceBuilderVersion">762</string>
<string key="IBDocument.AppKitVersion">1038.29</string>
<string key="IBDocument.HIToolboxVersion">460.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="NS.object.0">740</string>
<string key="NS.object.0">762</string>
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
Expand Down Expand Up @@ -59,7 +59,7 @@
<reference key="NSSuperview" ref="1006"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="257582983">
<int key="NSCellFlags">-1804468671</int>
<int key="NSCellFlags">-1803944383</int>
<int key="NSCellFlags2">272630784</int>
<string key="NSContents"/>
<object class="NSFont" key="NSSupport" id="941983486">
Expand Down Expand Up @@ -182,6 +182,9 @@
<string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
<string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
</object>
<object class="NSUserDefaultsController" id="59976239">
<bool key="NSSharedInstance">YES</bool>
</object>
</object>
<object class="IBObjectContainer" key="IBDocument.Objects">
<object class="NSMutableArray" key="connectionRecords">
Expand All @@ -194,6 +197,42 @@
</object>
<int key="connectionID">16</int>
</object>
<object class="IBConnectionRecord">
<object class="IBBindingConnection" key="connection">
<string key="label">value: values.articleDirectory</string>
<reference key="source" ref="543378478"/>
<reference key="destination" ref="59976239"/>
<object class="NSNibBindingConnector" key="connector">
<reference key="NSSource" ref="543378478"/>
<reference key="NSDestination" ref="59976239"/>
<string key="NSLabel">value: values.articleDirectory</string>
<string key="NSBinding">value</string>
<string key="NSKeyPath">values.articleDirectory</string>
<object class="NSDictionary" key="NSOptions">
<string key="NS.key.0">NSContinuouslyUpdatesValue</string>
<boolean value="YES" key="NS.object.0"/>
</object>
<int key="NSNibBindingConnectorVersion">2</int>
</object>
</object>
<int key="connectionID">20</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">browse:</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="880602958"/>
</object>
<int key="connectionID">21</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">pathTextField</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="543378478"/>
</object>
<int key="connectionID">22</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
Expand Down Expand Up @@ -314,6 +353,11 @@
<reference key="object" ref="791838203"/>
<reference key="parent" ref="494937365"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">17</int>
<reference key="object" ref="59976239"/>
<reference key="parent" ref="0"/>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
Expand Down Expand Up @@ -375,19 +419,41 @@
</object>
</object>
<nil key="sourceID"/>
<int key="maxID">16</int>
<int key="maxID">22</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
<string key="className">JBPreferencesWindowController</string>
<string key="superclassName">NSWindowController</string>
<object class="NSMutableDictionary" key="actions">
<string key="NS.key.0">browse:</string>
<string key="NS.object.0">id</string>
</object>
<object class="NSMutableDictionary" key="outlets">
<string key="NS.key.0">pathTextField</string>
<string key="NS.object.0">NSTextField</string>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">JBPreferencesWindowController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">JSON/NSObject+SBJSON.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">JSON/SBJsonWriter.h</string>
</object>
</object>
</object>
<object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+">
<bool key="EncodedWithXMLCoder">YES</bool>
Expand Down Expand Up @@ -481,6 +547,14 @@
<string key="minorKey">AppKit.framework/Headers/NSControl.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSController</string>
<string key="superclassName">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSFormatter</string>
<string key="superclassName">NSObject</string>
Expand Down Expand Up @@ -772,6 +846,14 @@
<string key="minorKey">AppKit.framework/Headers/NSTextFieldCell.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSUserDefaultsController</string>
<string key="superclassName">NSController</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSUserDefaultsController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
Expand Down Expand Up @@ -849,6 +931,7 @@
</object>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
<integer value="1060" key="NS.object.0"/>
Expand Down
6 changes: 5 additions & 1 deletion JBPreferencesWindowController.h
Expand Up @@ -10,7 +10,11 @@


@interface JBPreferencesWindowController : NSWindowController {

NSTextField *pathTextField;
}

@property (nonatomic, retain) IBOutlet NSTextField *pathTextField;

- (IBAction)browse:(id)sender;

@end
18 changes: 18 additions & 0 deletions JBPreferencesWindowController.m
Expand Up @@ -10,5 +10,23 @@


@implementation JBPreferencesWindowController
@synthesize pathTextField;

- (IBAction)browse:(id)sender {
NSLog(@"Browse");

NSOpenPanel *openPanel = [NSOpenPanel openPanel];
[openPanel setCanChooseDirectories:YES];
[openPanel setCanChooseFiles:NO];
[openPanel setCanCreateDirectories:YES];
[openPanel setDirectoryURL:[NSURL URLWithString:NSHomeDirectory()]];

[openPanel beginWithCompletionHandler:^(NSInteger result) {
if (NSFileHandlingPanelOKButton == result) {
[[NSUserDefaults standardUserDefaults] setObject:[[openPanel URL] path] forKey:@"articleDirectory"];
}
}];
}


@end

0 comments on commit ceb5c52

Please sign in to comment.