mirror of
https://github.com/arsenetar/dupeguru.git
synced 2025-03-10 05:34:36 +00:00
Delegate model instantiation to HSGUIController where possible.
--HG-- branch : objp
This commit is contained in:
parent
1b571f6fd2
commit
302050b2d6
@ -15,5 +15,5 @@ http://www.hardcoded.net/licenses/bsd_license
|
||||
|
||||
@interface DirectoryOutline : HSOutline {}
|
||||
- (id)initWithPyRef:(PyObject *)aPyRef outlineView:(HSOutlineView *)aOutlineView;
|
||||
- (PyDirectoryOutline *)py;
|
||||
- (PyDirectoryOutline *)model;
|
||||
@end;
|
@ -7,22 +7,19 @@ http://www.hardcoded.net/licenses/bsd_license
|
||||
*/
|
||||
|
||||
#import "DirectoryOutline.h"
|
||||
#import "Utils.h"
|
||||
|
||||
@implementation DirectoryOutline
|
||||
- (id)initWithPyRef:(PyObject *)aPyRef outlineView:(HSOutlineView *)aOutlineView
|
||||
{
|
||||
PyDirectoryOutline *model = [[PyDirectoryOutline alloc] initWithModel:aPyRef];
|
||||
self = [super initWithPy:model view:aOutlineView];
|
||||
[model bindCallback:createCallback(@"DirectoryOutlineView", self)];
|
||||
[model release];
|
||||
[outlineView registerForDraggedTypes:[NSArray arrayWithObject:NSFilenamesPboardType]];
|
||||
self = [super initWithPyRef:aPyRef wrapperClass:[PyDirectoryOutline class]
|
||||
callbackClassName:@"DirectoryOutlineView" view:aOutlineView];
|
||||
[[self view] registerForDraggedTypes:[NSArray arrayWithObject:NSFilenamesPboardType]];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (PyDirectoryOutline *)py
|
||||
- (PyDirectoryOutline *)model
|
||||
{
|
||||
return (PyDirectoryOutline *)py;
|
||||
return (PyDirectoryOutline *)model;
|
||||
}
|
||||
|
||||
/* Delegate */
|
||||
@ -50,7 +47,7 @@ http://www.hardcoded.net/licenses/bsd_license
|
||||
if (!(sourceDragMask & NSDragOperationLink))
|
||||
return NO;
|
||||
for (NSString *foldername in foldernames) {
|
||||
[[self py] addDirectory:foldername];
|
||||
[[self model] addDirectory:foldername];
|
||||
}
|
||||
NSDictionary *userInfo = [NSDictionary dictionaryWithObject:foldernames forKey:@"foldernames"];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:DGAddedFoldersNotification
|
||||
@ -64,7 +61,7 @@ http://www.hardcoded.net/licenses/bsd_license
|
||||
if ([cell isKindOfClass:[NSTextFieldCell class]]) {
|
||||
NSTextFieldCell *textCell = cell;
|
||||
NSIndexPath *path = item;
|
||||
BOOL selected = [path isEqualTo:[outlineView selectedPath]];
|
||||
BOOL selected = [path isEqualTo:[[self view] selectedPath]];
|
||||
if (selected) {
|
||||
[textCell setTextColor:[NSColor blackColor]];
|
||||
return;
|
||||
|
@ -100,7 +100,7 @@ http://www.hardcoded.net/licenses/bsd_license
|
||||
- (IBAction)removeSelectedDirectory:(id)sender
|
||||
{
|
||||
[[self window] makeKeyAndOrderFront:nil];
|
||||
[[outline py] removeSelectedDirectory];
|
||||
[[outline model] removeSelectedDirectory];
|
||||
[self refreshRemoveButtonText];
|
||||
}
|
||||
|
||||
|
@ -13,10 +13,8 @@ http://www.hardcoded.net/licenses/bsd_license
|
||||
@implementation PrioritizeList
|
||||
- (id)initWithPyRef:(PyObject *)aPyRef tableView:(NSTableView *)aTableView
|
||||
{
|
||||
PyPrioritizeList *m = [[PyPrioritizeList alloc] initWithModel:aPyRef];
|
||||
self = [super initWithModel:m tableView:aTableView];
|
||||
[m bindCallback:createCallback(@"PrioritizeListView", self)];
|
||||
[m release];
|
||||
self = [super initWithPyRef:aPyRef wrapperClass:[PyPrioritizeList class]
|
||||
callbackClassName:@"PrioritizeListView" view:aTableView];
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -20,10 +20,7 @@ http://www.hardcoded.net/licenses/bsd_license
|
||||
@implementation ResultTable
|
||||
- (id)initWithPyRef:(PyObject *)aPyRef view:(NSTableView *)aTableView
|
||||
{
|
||||
PyResultTable *m = [[PyResultTable alloc] initWithModel:aPyRef];
|
||||
self = [super initWithModel:m tableView:aTableView];
|
||||
[m bindCallback:createCallback(@"ResultTableView", self)];
|
||||
[m release];
|
||||
self = [super initWithPyRef:aPyRef wrapperClass:[PyResultTable class] callbackClassName:@"ResultTableView" view:aTableView];
|
||||
_deltaColumns = [[NSSet setWithArray:[[self model] deltaColumns]] retain];
|
||||
return self;
|
||||
}
|
||||
|
@ -12,11 +12,8 @@ http://www.hardcoded.net/licenses/bsd_license
|
||||
@implementation StatsLabel
|
||||
- (id)initWithPyRef:(PyObject *)aPyRef view:(NSTextField *)aLabelView
|
||||
{
|
||||
PyStatsLabel *m = [[PyStatsLabel alloc] initWithModel:aPyRef];
|
||||
self = [self initWithModel:m view:aLabelView];
|
||||
[m bindCallback:createCallback(@"StatsLabelView", self)];
|
||||
[m release];
|
||||
return self;
|
||||
return [super initWithPyRef:aPyRef wrapperClass:[PyStatsLabel class]
|
||||
callbackClassName:@"StatsLabelView" view:aLabelView];
|
||||
}
|
||||
|
||||
- (PyStatsLabel *)model
|
||||
|
Loading…
x
Reference in New Issue
Block a user