1
0
mirror of https://github.com/arsenetar/dupeguru-cocoa.git synced 2024-12-08 05:39:01 +00:00
dupeguru-cocoa/cocoa/DeletionOptions.m

72 lines
1.6 KiB
Mathematica
Raw Normal View History

2017-03-12 01:18:27 +00:00
/*
2017-04-05 00:59:25 +00:00
Copyright 2017 Virgil Dupras
2017-03-12 01:18:27 +00: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-05 00:59:25 +00:00
self = [super initWithWindowNibName:@"DeletionOptions"];
[self window];
2017-03-12 01:18:27 +00:00
model = [[PyDeletionOptions alloc] initWithModel:aPyRef];
[model bindCallback:createCallback(@"DeletionOptionsView", self)];
return self;
}
- (void)dealloc
{
[model release];
[super dealloc];
}
2017-04-05 00:59:25 +00:00
- (IBAction)updateOptions:(id)sender
2017-03-12 01:18:27 +00:00
{
[model setLinkDeleted:[linkButton state] == NSControlStateValueOn];
2017-03-12 01:18:27 +00:00
[model setUseHardlinks:[linkTypeRadio selectedColumn] == 1];
[model setDirect:[directButton state] == NSControlStateValueOn];
2017-03-12 01:18:27 +00:00
}
2017-04-05 00:59:25 +00:00
- (IBAction)proceed:(id)sender
2017-03-12 01:18:27 +00:00
{
[NSApp stopModalWithCode:NSModalResponseOK];
2017-03-12 01:18:27 +00:00
}
2017-04-05 00:59:25 +00:00
- (IBAction)cancel:(id)sender
2017-03-12 01:18:27 +00:00
{
[NSApp stopModalWithCode:NSModalResponseCancel];
2017-03-12 01:18:27 +00:00
}
/* model --> view */
- (void)updateMsg:(NSString *)msg
{
[messageTextField setStringValue:msg];
}
- (BOOL)show
{
[linkButton setState:NSControlStateValueOff];
[directButton setState:NSControlStateValueOff];
2017-03-12 01:18:27 +00:00
[linkTypeRadio selectCellAtRow:0 column:0];
NSInteger r = [NSApp runModalForWindow:[self window]];
[[self window] close];
return r == NSModalResponseOK;
2017-03-12 01:18:27 +00:00
}
- (void)setHardlinkOptionEnabled:(BOOL)enabled
{
[linkTypeRadio setEnabled:enabled];
}
@end