dupeguru-cocoa/cocoa/DeletionOptions.m

72 lines
1.6 KiB
Mathematica
Raw Permalink Normal View History

2017-03-11 19:18:27 -06:00
/*
2017-04-04 19:59:25 -05:00
Copyright 2017 Virgil Dupras
2017-03-11 19:18:27 -06:00
This software is licensed under the "GPLv3" License as described in the "LICENSE" file,
which should be included with this package. The terms are also available at
http://www.gnu.org/licenses/gpl-3.0.html
*/
#import "DeletionOptions.h"
#import "HSPyUtil.h"
@implementation DeletionOptions
@synthesize messageTextField;
@synthesize linkButton;
@synthesize linkTypeRadio;
@synthesize directButton;
- (id)initWithPyRef:(PyObject *)aPyRef
{
2017-04-04 19:59:25 -05:00
self = [super initWithWindowNibName:@"DeletionOptions"];
[self window];
2017-03-11 19:18:27 -06:00
model = [[PyDeletionOptions alloc] initWithModel:aPyRef];
[model bindCallback:createCallback(@"DeletionOptionsView", self)];
return self;
}
- (void)dealloc
{
[model release];
[super dealloc];
}
2017-04-04 19:59:25 -05:00
- (IBAction)updateOptions:(id)sender
2017-03-11 19:18:27 -06:00
{
[model setLinkDeleted:[linkButton state] == NSControlStateValueOn];
2017-03-11 19:18:27 -06:00
[model setUseHardlinks:[linkTypeRadio selectedColumn] == 1];
[model setDirect:[directButton state] == NSControlStateValueOn];
2017-03-11 19:18:27 -06:00
}
2017-04-04 19:59:25 -05:00
- (IBAction)proceed:(id)sender
2017-03-11 19:18:27 -06:00
{
[NSApp stopModalWithCode:NSModalResponseOK];
2017-03-11 19:18:27 -06:00
}
2017-04-04 19:59:25 -05:00
- (IBAction)cancel:(id)sender
2017-03-11 19:18:27 -06:00
{
[NSApp stopModalWithCode:NSModalResponseCancel];
2017-03-11 19:18:27 -06:00
}
/* model --> view */
- (void)updateMsg:(NSString *)msg
{
[messageTextField setStringValue:msg];
}
- (BOOL)show
{
[linkButton setState:NSControlStateValueOff];
[directButton setState:NSControlStateValueOff];
2017-03-11 19:18:27 -06:00
[linkTypeRadio selectCellAtRow:0 column:0];
NSInteger r = [NSApp runModalForWindow:[self window]];
[[self window] close];
return r == NSModalResponseOK;
2017-03-11 19:18:27 -06:00
}
- (void)setHardlinkOptionEnabled:(BOOL)enabled
{
[linkTypeRadio setEnabled:enabled];
}
@end