public
Description: An OS X application to build a standalone web site as an export from my photo album.
Homepage: http://bleu.west.spy.net/~dustin/projects/photosync/
Clone URL: git://github.com/dustin/photosync.git
Search Repo:
photosync / LocEditController.m
100644 56 lines (49 sloc) 1.304 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#import "LocEditController.h"
#import "PhotoSync.h"
 
@implementation LocEditController
 
- (IBAction)browse:(id)sender
{
  NSOpenPanel *op=[NSOpenPanel openPanel];
  [op setCanChooseFiles:NO];
  [op setCanChooseDirectories:YES];
  [op setCanCreateDirectories:YES];
  [op setAllowsMultipleSelection:NO];
  int result = [op runModalForTypes:nil];
  if(result == NSOKButton) {
    [destination setStringValue:[[op filenames] objectAtIndex:0]];
  }
}
 
- (IBAction)cancel:(id)sender
{
  [[self window] performClose: sender];
}
 
- (IBAction)save:(id)sender
{
  [_loc setUrl:[url stringValue]];
  [_loc setUsername:[username stringValue]];
  [_loc setPassword:[password stringValue]];
  [_loc setDestDir:[destination stringValue]];
  [_loc setForUser:[forUser stringValue]];
  // Throw away our copy
  [_loc release];
  _loc = nil;
  // Close the window
  [[self window] performClose: sender];
  // Send a notification
  [[NSNotificationCenter defaultCenter]
    postNotificationName: PS_DID_UPDATE object: self];
}
 
-(void)setLocation:(Location *)to
{
  if(_loc != nil) {
    [_loc release];
  }
  [to retain];
  _loc=to;
  
  [url setStringValue:[_loc url]];
  [username setStringValue:[_loc username]];
  [password setStringValue:[_loc password]];
  [forUser setStringValue:[_loc forUser]];
  [destination setStringValue:[_loc destDir]];
}
 
@end