/*
* $Id: STTableViewDelegate.m 224 2011-08-13 20:39:45Z stuart $
*
* SafariTabs
* http://stuconnolly.com/projects/safaritabs/
*
* Copyright (c) 2010 Stuart Connolly. All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#import "STTableViewDelegate.h"
#import "STSessionRestoreTextFieldCell.h"
#import "STSessionRestoreTab.h"
#import "STConstants.h"
#import "STUtilities.h"
@implementation STSessionRestoreController (STTableViewDelegate)
- (NSInteger
)numberOfRowsInTableView
:(NSTableView *)tableView
{
return [_sessionRestoreTabs count];
}
{
return [[_sessionRestoreTabs objectAtIndex:i] valueForKey:[tableColumn identifier]];
}
- (void)tableView
:(NSTableView *)tableView willDisplayCell
:(id)cell forTableColumn
:(NSTableColumn *)tableColumn row
:(NSInteger
)i
{
STSessionRestoreTab *tab = [_sessionRestoreTabs objectAtIndex:i];
if ([[tableColumn identifier] isEqualToString:STTableViewTabTitleColumnIdentifier]) {
NSImage *image
= [[NSImage alloc
] initByReferencingFile
:[STPluginBundle
() pathForResource
:@"Tab" ofType
:@"tiff"]];
[cell setImage:image];
[cell setElementName:[tab tabTitle]];
[cell setElementAddress:[[tab tabURL] absoluteString]];
[image release];
}
}
- (void)tableView
:(NSTableView *)tableView setObjectValue
:(id)object forTableColumn
:(NSTableColumn *)tableColumn row
:(NSInteger
)i
{
[[_sessionRestoreTabs objectAtIndex:i] setValue:object forKey:[tableColumn identifier]];
[self updateUserInterface];
}
@end