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 / Locations.m
100644 95 lines (81 sloc) 1.827 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#import "Locations.h"
 
@implementation Locations
 
-init
{
  self=[super init];
  _locations=[[NSMutableArray alloc] init];
  return self;
}
 
-(void)dealloc
{
  NSLog(@"Deallocing Locations");
  [_locations release];
  [super dealloc];
}
 
-(int)numberOfRowsInTableView:(NSTableView *)aTableView
{
  return([_locations count]);
}
 
-tableView:(NSTableView *)aTableView
    objectValueForTableColumn:(NSTableColumn *)aTableColumn
    row:(int)rowIndex
{
  id theItem=[_locations objectAtIndex: rowIndex];
  id rv=[theItem valueForKey:[aTableColumn identifier]];
  return(rv);
}
 
-(void)tableView:(NSTableView *)aTableView
    setObjectValue:anObject
    forTableColumn:(NSTableColumn *)aTableColumn
    row:(int)rowIndex
{
  id theItem=[_locations objectAtIndex: rowIndex];
  if([@"active" isEqual: [aTableColumn identifier]]) {
    [theItem setActive: [anObject boolValue]];
  } else {
    NSLog(@"Not editing column %@", [aTableColumn identifier]);
  }
}
 
-(void)addItem: (Location *)loc
{
  [_locations addObject: loc];
}
 
-(void)removeItemAt: (int)which
{
  [_locations removeObjectAtIndex: which];
}
 
-(void)removeAll
{
  [_locations removeAllObjects];
}
 
-toArray
{
  NSMutableArray *a=[[NSMutableArray alloc] init];
  NSEnumerator *e=[_locations objectEnumerator];
  id object=nil;
  while(object = [e nextObject]) {
    [a addObject: [object toDict]];
  }
  NSArray *rv=[NSArray arrayWithArray: (NSArray *)a];
  [a release];
  return(rv);
}
 
-(void)loadArray:(id)arry
{
  NSEnumerator *e=[arry objectEnumerator];
  id object=nil;
  while(object = [e nextObject]) {
    Location *loc=[[Location alloc] initWithDict:(NSDictionary *)object];
    [_locations addObject: loc];
    [loc release];
  }
}
 
-objectAtIndex:(unsigned)which
{
  return([_locations objectAtIndex:which]);
}
 
-(NSEnumerator *)objectEnumerator
{
    return([_locations objectEnumerator]);
}
 
@end